Imported Upstream version 0.6
authorDiane Trout <diane@caltech.edu>
Tue, 6 Nov 2012 22:37:08 +0000 (14:37 -0800)
committerDiane Trout <diane@caltech.edu>
Tue, 6 Nov 2012 22:37:08 +0000 (14:37 -0800)
55 files changed:
PKG-INFO
pysam.egg-info/PKG-INFO
pysam.egg-info/SOURCES.txt
pysam/TabProxies.c
pysam/TabProxies.pxd
pysam/TabProxies.pyx
pysam/VCF.py [deleted file]
pysam/__init__.py
pysam/csamtools.c
pysam/csamtools.pxd
pysam/csamtools.pyx
pysam/ctabix.c
pysam/ctabix.pxd
pysam/ctabix.pyx
pysam/cvcf.c
pysam/pysam_util.c
pysam/pysam_util.h
pysam/version.py
samtools/bam.c.pysam.c
samtools/bam.h
samtools/bam2bcf.c.pysam.c
samtools/bam2bcf.h
samtools/bam2bcf_indel.c.pysam.c
samtools/bam_aux.c.pysam.c
samtools/bam_import.c.pysam.c
samtools/bam_index.c.pysam.c
samtools/bam_maqcns.c.pysam.c [deleted file]
samtools/bam_maqcns.h [deleted file]
samtools/bam_md.c.pysam.c
samtools/bam_pileup.c.pysam.c
samtools/bam_plcmd.c.pysam.c
samtools/bam_reheader.c.pysam.c [new file with mode: 0644]
samtools/bam_tview.c.pysam.c
samtools/bcftools/bcf.h
samtools/bcftools/bcfutils.c.pysam.c
samtools/bcftools/call1.c.pysam.c
samtools/bcftools/em.c.pysam.c
samtools/bcftools/mut.c.pysam.c [new file with mode: 0644]
samtools/bcftools/prob1.c.pysam.c
samtools/bcftools/prob1.h
samtools/bedidx.c.pysam.c
samtools/faidx.c.pysam.c
samtools/glf.c.pysam.c [deleted file]
samtools/glf.h [deleted file]
samtools/kprobaln.c.pysam.c
samtools/kseq.h
samtools/misc/seqtk.c.pysam.c [new file with mode: 0644]
samtools/msvc_compat.h [deleted file]
samtools/sam_view.c.pysam.c
samtools/sample.c.pysam.c
setup.py
tabix/msvc_compat.h [deleted file]
tests/example.py
tests/pysam_test.py
tests/tabix_test.py

index c90139fb55ade84c9847aff21305dc3f8301070c..99d7ae966b891d802a6415d3d178fc92a79a4211 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.5
+Version: 0.6
 Summary: pysam
 Home-page: http://code.google.com/p/pysam/
 Author: Andreas Heger
index c90139fb55ade84c9847aff21305dc3f8301070c..99d7ae966b891d802a6415d3d178fc92a79a4211 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.5
+Version: 0.6
 Summary: pysam
 Home-page: http://code.google.com/p/pysam/
 Author: Andreas Heger
index 6f8ca43c3ff766feb62846754803ec4f991333db..45bcda92e7a5771b41a9988695e116d1aa7ea0ba 100644 (file)
@@ -10,7 +10,6 @@ pysam/Pileup.py
 pysam/TabProxies.c
 pysam/TabProxies.pxd
 pysam/TabProxies.pyx
-pysam/VCF.py
 pysam/__init__.py
 pysam/csamtools.c
 pysam/csamtools.pxd
@@ -45,12 +44,11 @@ samtools/bam_endian.h
 samtools/bam_import.c.pysam.c
 samtools/bam_index.c.pysam.c
 samtools/bam_lpileup.c.pysam.c
-samtools/bam_maqcns.c.pysam.c
-samtools/bam_maqcns.h
 samtools/bam_mate.c.pysam.c
 samtools/bam_md.c.pysam.c
 samtools/bam_pileup.c.pysam.c
 samtools/bam_plcmd.c.pysam.c
+samtools/bam_reheader.c.pysam.c
 samtools/bam_rmdup.c.pysam.c
 samtools/bam_rmdupse.c.pysam.c
 samtools/bam_sort.c.pysam.c
@@ -64,8 +62,6 @@ samtools/errmod.c.pysam.c
 samtools/errmod.h
 samtools/faidx.c.pysam.c
 samtools/faidx.h
-samtools/glf.c.pysam.c
-samtools/glf.h
 samtools/kaln.c.pysam.c
 samtools/kaln.h
 samtools/khash.h
@@ -78,7 +74,6 @@ samtools/kseq.h
 samtools/ksort.h
 samtools/kstring.c.pysam.c
 samtools/kstring.h
-samtools/msvc_compat.h
 samtools/phase.c.pysam.c
 samtools/pysam.h
 samtools/razf.c.pysam.c
@@ -101,11 +96,13 @@ samtools/bcftools/index.c.pysam.c
 samtools/bcftools/kfunc.c.pysam.c
 samtools/bcftools/kmin.c.pysam.c
 samtools/bcftools/kmin.h
+samtools/bcftools/mut.c.pysam.c
 samtools/bcftools/prob1.c.pysam.c
 samtools/bcftools/prob1.h
 samtools/bcftools/vcf.c.pysam.c
 samtools/misc/md5.c.pysam.c
 samtools/misc/md5.h
+samtools/misc/seqtk.c.pysam.c
 samtools/win32/xcurses.h
 samtools/win32/zconf.h
 samtools/win32/zlib.h
@@ -122,7 +119,6 @@ tabix/kseq.h
 tabix/ksort.h
 tabix/kstring.c.pysam.c
 tabix/kstring.h
-tabix/msvc_compat.h
 tabix/pysam.h
 tabix/tabix.h
 tests/00README.txt
index dc9e21c534b8e02409f3651ca4249e577228c9cd..4edcb4d48407c7137b2a0ea739c5cfa3864b92c6 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13 on Thu May  5 14:57:52 2011 */
+/* Generated by Cython 0.14.1 on Thu Nov 17 22:34:01 2011 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
   #define PyBytes_Repr                 PyString_Repr
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
 #endif
-
 #ifndef PySet_CheckExact
-#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
+  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
 
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
   #define PyInt_Check(op)              PyLong_Check(op)
   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
 #endif
 
 #if PY_MAJOR_VERSION >= 3
-  #define PyBoolObject PyLongObject
+  #define PyBoolObject                 PyLongObject
 #endif
 
 
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
 #endif
 
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
 #include "stdio.h"
 #include "pythread.h"
 
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
 /* inline attribute */
 #ifndef CYTHON_INLINE
   #if defined(__GNUC__)
   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
     #define CYTHON_INLINE inline
   #else
-    #define CYTHON_INLINE 
+    #define CYTHON_INLINE
   #endif
 #endif
 
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
 #   else
 #     define CYTHON_UNUSED
 #   endif
 # elif defined(__ICC) || defined(__INTEL_COMPILER)
-#   define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
-#   define CYTHON_UNUSED 
+#   define CYTHON_UNUSED
 # endif
 #endif
 
@@ -251,7 +280,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
 #ifdef __GNUC__
 /* Test for GCC > 2.95 */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
 #define likely(x)   __builtin_expect(!!(x), 1)
 #define unlikely(x) __builtin_expect(!!(x), 0)
 #else /* __GNUC__ > 2 ... */
@@ -276,11 +305,12 @@ static const char *__pyx_filename;
 static const char *__pyx_f[] = {
   "TabProxies.pyx",
   "bool.pxd",
+  "complex.pxd",
 };
 
 /* Type declarations */
 
-/* "pysam/TabProxies.pxd":42
+/* "TabProxies.pxd":42
  *   ctypedef int uint64_t
  * 
  * cdef class TupleProxy:             # <<<<<<<<<<<<<<
@@ -300,7 +330,7 @@ struct __pyx_obj_10TabProxies_TupleProxy {
   int is_modified;
 };
 
-/* "pysam/TabProxies.pxd":77
+/* "TabProxies.pxd":78
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -312,7 +342,7 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
   struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
 };
 
-/* "pysam/TabProxies.pxd":91
+/* "TabProxies.pxd":92
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -326,7 +356,7 @@ struct __pyx_obj_10TabProxies_VCFProxy {
   uint32_t pos;
 };
 
-/* "pysam/TabProxies.pxd":60
+/* "TabProxies.pxd":61
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -348,7 +378,7 @@ struct __pyx_obj_10TabProxies_GTFProxy {
   int hasOwnAttributes;
 };
 
-/* "pysam/TabProxies.pxd":80
+/* "TabProxies.pxd":81
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -365,7 +395,7 @@ struct __pyx_obj_10TabProxies_BedProxy {
 };
 
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":20
+/* "TabProxies.pyx":20
  *      return not (buffer <= p < buffer + nbytes )
  * 
  * cdef class TupleProxy:             # <<<<<<<<<<<<<<
@@ -383,7 +413,7 @@ struct __pyx_vtabstruct_10TabProxies_TupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":488
+/* "TabProxies.pyx":493
  *         self.fromDict( r )
  * 
  * cdef class NamedTupleProxy( TupleProxy ):             # <<<<<<<<<<<<<<
@@ -397,7 +427,7 @@ struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":573
+/* "TabProxies.pyx":578
  *         TupleProxy._setindex(self, idx, str(value) )
  * 
  * cdef class VCFProxy( NamedTupleProxy ):             # <<<<<<<<<<<<<<
@@ -411,7 +441,7 @@ struct __pyx_vtabstruct_10TabProxies_VCFProxy {
 static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":507
+/* "TabProxies.pyx":512
  *         return f( self.fields[idx] )
  * 
  * cdef class BedProxy( NamedTupleProxy ):             # <<<<<<<<<<<<<<
@@ -425,7 +455,7 @@ struct __pyx_vtabstruct_10TabProxies_BedProxy {
 static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":231
+/* "TabProxies.pyx":240
  *         return str(v)
  * 
  * cdef class GTFProxy( TupleProxy ):             # <<<<<<<<<<<<<<
@@ -486,12 +516,24 @@ static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies
 
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
     const char* function_name, int kw_allowed); /*proto*/
 
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
+static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
+
 static void __Pyx_RaiseDoubleKeywordsError(
     const char* func_name, PyObject* kw_name); /*proto*/
 
@@ -582,23 +624,11 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
     ((likely(PyFloat_CheckExact(obj))) ? \
      PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
 
-static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
-
-static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
-static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
-
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
 
 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *);
@@ -685,8 +715,11 @@ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
 
 /* 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 */
@@ -730,11 +763,12 @@ static char *__pyx_f_10TabProxies_nextItem(char *); /*proto*/
 static char *__pyx_f_10TabProxies_StrOrEmpty(char *); /*proto*/
 static int __pyx_f_10TabProxies_isNew(char *, char *, size_t); /*proto*/
 #define __Pyx_MODULE_NAME "TabProxies"
-int __pyx_module_is_main_TabProxies = 0;
+static int __pyx_module_is_main_TabProxies = 0;
 
 /* Implementation of TabProxies */
 static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_IndexError;
+static PyObject *__pyx_builtin_range;
 static PyObject *__pyx_builtin_StopIteration;
 static PyObject *__pyx_builtin_xrange;
 static PyObject *__pyx_builtin_TypeError;
@@ -743,45 +777,31 @@ static PyObject *__pyx_builtin_KeyError;
 static char __pyx_k_1[] = "malformatted entry at %s";
 static char __pyx_k_2[] = "";
 static char __pyx_k_3[] = "out of memory";
-static char __pyx_k_4[] = "incomplete line at %s";
-static char __pyx_k_5[] = "row too large - more than %i fields";
-static char __pyx_k_6[] = "list index out of range";
-static char __pyx_k_7[] = "\t";
-static char __pyx_k_8[] = ".";
-static char __pyx_k_9[] = "\"%s\"";
-static char __pyx_k_10[] = ";";
-static char __pyx_k_11[] = " ";
-static char __pyx_k_12[] = "\"";
-static char __pyx_k_13[] = "%s \"%s\"";
-static char __pyx_k_14[] = "%s %s";
-static char __pyx_k_15[] = "; ";
-static char __pyx_k_16[] = "'GTFProxy' has no attribute '%s'";
-static char __pyx_k_17[] = "field %s not set";
-static char __pyx_k_18[] = "bed format requires at least three columns";
-static char __pyx_k_19[] = "contig of feature.";
-static char __pyx_k_20[] = "feature name.";
-static char __pyx_k_21[] = "feature source.";
-static char __pyx_k_22[] = "feature start (in 0-based open/closed coordinates).";
-static char __pyx_k_23[] = "feature end (in 0-based open/closed coordinates).";
-static char __pyx_k_24[] = "feature score.";
-static char __pyx_k_25[] = "feature strand.";
-static char __pyx_k_26[] = "feature frame.";
-static char __pyx_k_27[] = "feature attributes (as a string).";
-static char __pyx_k_28[] = "TupleProxy._setindex (line 154)";
-static char __pyx_k_29[] = "TupleProxy.__setitem__ (line 177)";
-static char __pyx_k_30[] = "TupleProxy.__next__ (line 192)";
-static char __pyx_k_31[] = "TupleProxy.__str__ (line 202)";
-static char __pyx_k_32[] = "toDot (line 219)";
-static char __pyx_k_33[] = "quote (line 224)";
-static char __pyx_k_34[] = "GTFProxy.asDict (line 350)";
-static char __pyx_k_35[] = "GTFProxy.fromDict (line 385)";
-static char __pyx_k_36[] = "GTFProxy.invert (line 430)";
-static char __pyx_k_37[] = "GTFProxy.keys (line 441)";
-static char __pyx_k_38[] = "GTFProxy.__getattr__ (line 449)";
-static char __pyx_k_39[] = "GTFProxy.setAttribute (line 482)";
-static char __pyx_k_40[] = "NamedTupleProxy.__setattr__ (line 492)";
-static char __pyx_k_41[] = "BedProxy.__setattr__ (line 564)";
-static char __pyx_k_42[] = "VCFProxy.__setattr__ (line 608)";
+static char __pyx_k_5[] = "incomplete line at %s";
+static char __pyx_k_7[] = "row too large - more than %i fields";
+static char __pyx_k_8[] = "list index out of range";
+static char __pyx_k_10[] = "list index out of range %i >= %i";
+static char __pyx_k_14[] = "\t";
+static char __pyx_k_16[] = ".";
+static char __pyx_k_17[] = "\"%s\"";
+static char __pyx_k_18[] = ";";
+static char __pyx_k_20[] = " ";
+static char __pyx_k_22[] = "\"";
+static char __pyx_k_23[] = "%s \"%s\"";
+static char __pyx_k_24[] = "%s %s";
+static char __pyx_k_25[] = "; ";
+static char __pyx_k_29[] = "'GTFProxy' has no attribute '%s'";
+static char __pyx_k_30[] = "field %s not set";
+static char __pyx_k_31[] = "bed format requires at least three columns";
+static char __pyx_k_33[] = "contig of feature.";
+static char __pyx_k_34[] = "feature name.";
+static char __pyx_k_35[] = "feature source.";
+static char __pyx_k_36[] = "feature start (in 0-based open/closed coordinates).";
+static char __pyx_k_37[] = "feature end (in 0-based open/closed coordinates).";
+static char __pyx_k_38[] = "feature score.";
+static char __pyx_k_39[] = "feature strand.";
+static char __pyx_k_40[] = "feature frame.";
+static char __pyx_k_41[] = "feature attributes (as a string).";
 static char __pyx_k__id[] = "id";
 static char __pyx_k__alt[] = "alt";
 static char __pyx_k__end[] = "end";
@@ -790,7 +810,6 @@ static char __pyx_k__ref[] = "ref";
 static char __pyx_k__data[] = "data";
 static char __pyx_k__info[] = "info";
 static char __pyx_k__join[] = "join";
-static char __pyx_k__keys[] = "keys";
 static char __pyx_k__name[] = "name";
 static char __pyx_k__qual[] = "qual";
 static char __pyx_k__frame[] = "frame";
@@ -805,12 +824,12 @@ static char __pyx_k__strip[] = "strip";
 static char __pyx_k__toDot[] = "toDot";
 static char __pyx_k__types[] = "types";
 static char __pyx_k__value[] = "value";
+static char __pyx_k__append[] = "append";
 static char __pyx_k__asDict[] = "asDict";
 static char __pyx_k__contig[] = "contig";
 static char __pyx_k__fields[] = "fields";
 static char __pyx_k__filter[] = "filter";
 static char __pyx_k__format[] = "format";
-static char __pyx_k__invert[] = "invert";
 static char __pyx_k__nbytes[] = "nbytes";
 static char __pyx_k__offset[] = "offset";
 static char __pyx_k__source[] = "source";
@@ -819,23 +838,21 @@ static char __pyx_k__update[] = "update";
 static char __pyx_k__xrange[] = "xrange";
 static char __pyx_k____str__[] = "__str__";
 static char __pyx_k__feature[] = "feature";
+static char __pyx_k__indices[] = "indices";
 static char __pyx_k__itemRGB[] = "itemRGB";
 static char __pyx_k__nfields[] = "nfields";
-static char __pyx_k__BedProxy[] = "BedProxy";
-static char __pyx_k__GTFProxy[] = "GTFProxy";
 static char __pyx_k__KeyError[] = "KeyError";
-static char __pyx_k__VCFProxy[] = "VCFProxy";
 static char __pyx_k____main__[] = "__main__";
-static char __pyx_k____next__[] = "__next__";
 static char __pyx_k____test__[] = "__test__";
 static char __pyx_k__fromDict[] = "fromDict";
 static char __pyx_k__thickEnd[] = "thickEnd";
 static char __pyx_k__TypeError[] = "TypeError";
+static char __pyx_k___getindex[] = "_getindex";
 static char __pyx_k___setindex[] = "_setindex";
 static char __pyx_k__bedfields[] = "bedfields";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__StringType[] = "StringType";
-static char __pyx_k__TupleProxy[] = "TupleProxy";
+static char __pyx_k__TabProxies[] = "TabProxies";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k__attributes[] = "attributes";
 static char __pyx_k__blockCount[] = "blockCount";
@@ -843,72 +860,51 @@ static char __pyx_k__blockSizes[] = "blockSizes";
 static char __pyx_k__thickStart[] = "thickStart";
 static char __pyx_k__StringTypes[] = "StringTypes";
 static char __pyx_k____getattr__[] = "__getattr__";
-static char __pyx_k____setattr__[] = "__setattr__";
 static char __pyx_k____setitem__[] = "__setitem__";
 static char __pyx_k__blockStarts[] = "blockStarts";
 static char __pyx_k__is_modified[] = "is_modified";
 static char __pyx_k__getMaxFields[] = "getMaxFields";
-static char __pyx_k__setAttribute[] = "setAttribute";
 static char __pyx_k__StopIteration[] = "StopIteration";
 static char __pyx_k__map_key2field[] = "map_key2field";
 static char __pyx_k__AttributeError[] = "AttributeError";
-static char __pyx_k__NamedTupleProxy[] = "NamedTupleProxy";
 static char __pyx_k__hasOwnAttributes[] = "hasOwnAttributes";
 static PyObject *__pyx_kp_s_1;
 static PyObject *__pyx_kp_s_10;
-static PyObject *__pyx_kp_s_11;
-static PyObject *__pyx_kp_s_12;
-static PyObject *__pyx_kp_s_13;
 static PyObject *__pyx_kp_s_14;
-static PyObject *__pyx_kp_s_15;
 static PyObject *__pyx_kp_s_16;
 static PyObject *__pyx_kp_s_17;
 static PyObject *__pyx_kp_s_18;
 static PyObject *__pyx_kp_s_2;
-static PyObject *__pyx_kp_u_28;
-static PyObject *__pyx_kp_u_29;
+static PyObject *__pyx_kp_s_20;
+static PyObject *__pyx_kp_s_22;
+static PyObject *__pyx_kp_s_23;
+static PyObject *__pyx_kp_s_24;
+static PyObject *__pyx_kp_s_25;
+static PyObject *__pyx_kp_s_29;
 static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_u_30;
-static PyObject *__pyx_kp_u_31;
-static PyObject *__pyx_kp_u_32;
-static PyObject *__pyx_kp_u_33;
-static PyObject *__pyx_kp_u_34;
-static PyObject *__pyx_kp_u_35;
-static PyObject *__pyx_kp_u_36;
-static PyObject *__pyx_kp_u_37;
-static PyObject *__pyx_kp_u_38;
-static PyObject *__pyx_kp_u_39;
-static PyObject *__pyx_kp_s_4;
-static PyObject *__pyx_kp_u_40;
-static PyObject *__pyx_kp_u_41;
-static PyObject *__pyx_kp_u_42;
+static PyObject *__pyx_kp_s_30;
+static PyObject *__pyx_kp_s_31;
 static PyObject *__pyx_kp_s_5;
-static PyObject *__pyx_kp_s_6;
 static PyObject *__pyx_kp_s_7;
 static PyObject *__pyx_kp_s_8;
-static PyObject *__pyx_kp_s_9;
 static PyObject *__pyx_n_s__AttributeError;
-static PyObject *__pyx_n_s__BedProxy;
-static PyObject *__pyx_n_s__GTFProxy;
 static PyObject *__pyx_n_s__IndexError;
 static PyObject *__pyx_n_s__KeyError;
-static PyObject *__pyx_n_s__NamedTupleProxy;
 static PyObject *__pyx_n_s__StopIteration;
 static PyObject *__pyx_n_s__StringType;
 static PyObject *__pyx_n_s__StringTypes;
-static PyObject *__pyx_n_s__TupleProxy;
+static PyObject *__pyx_n_s__TabProxies;
 static PyObject *__pyx_n_s__TypeError;
-static PyObject *__pyx_n_s__VCFProxy;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____getattr__;
 static PyObject *__pyx_n_s____main__;
-static PyObject *__pyx_n_s____next__;
-static PyObject *__pyx_n_s____setattr__;
 static PyObject *__pyx_n_s____setitem__;
 static PyObject *__pyx_n_s____str__;
 static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s___getindex;
 static PyObject *__pyx_n_s___setindex;
 static PyObject *__pyx_n_s__alt;
+static PyObject *__pyx_n_s__append;
 static PyObject *__pyx_n_s__asDict;
 static PyObject *__pyx_n_s__attributes;
 static PyObject *__pyx_n_s__bedfields;
@@ -928,13 +924,12 @@ static PyObject *__pyx_n_s__getMaxFields;
 static PyObject *__pyx_n_s__hasOwnAttributes;
 static PyObject *__pyx_n_s__id;
 static PyObject *__pyx_n_s__index;
+static PyObject *__pyx_n_s__indices;
 static PyObject *__pyx_n_s__info;
-static PyObject *__pyx_n_s__invert;
 static PyObject *__pyx_n_s__is_modified;
 static PyObject *__pyx_n_s__itemRGB;
 static PyObject *__pyx_n_s__items;
 static PyObject *__pyx_n_s__join;
-static PyObject *__pyx_n_s__keys;
 static PyObject *__pyx_n_s__map_key2field;
 static PyObject *__pyx_n_s__name;
 static PyObject *__pyx_n_s__nbytes;
@@ -946,7 +941,6 @@ static PyObject *__pyx_n_s__quote;
 static PyObject *__pyx_n_s__range;
 static PyObject *__pyx_n_s__ref;
 static PyObject *__pyx_n_s__score;
-static PyObject *__pyx_n_s__setAttribute;
 static PyObject *__pyx_n_s__source;
 static PyObject *__pyx_n_s__split;
 static PyObject *__pyx_n_s__start;
@@ -971,8 +965,21 @@ static PyObject *__pyx_int_8;
 static PyObject *__pyx_int_9;
 static PyObject *__pyx_int_10;
 static PyObject *__pyx_int_11;
-
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":4
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_9;
+static PyObject *__pyx_k_tuple_11;
+static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_19;
+static PyObject *__pyx_k_tuple_21;
+static PyObject *__pyx_k_tuple_26;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_28;
+static PyObject *__pyx_k_tuple_32;
+
+/* "TabProxies.pyx":4
  * from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING
  * 
  * cdef char * nextItem( char * buffer ):             # <<<<<<<<<<<<<<
@@ -988,7 +995,7 @@ static  char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) {
   PyObject *__pyx_t_3 = NULL;
   __Pyx_RefNannySetupContext("nextItem");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":6
+  /* "TabProxies.pyx":6
  * cdef char * nextItem( char * buffer ):
  *     cdef char * pos
  *     pos = strchr( buffer, '\t' )             # <<<<<<<<<<<<<<
@@ -997,7 +1004,7 @@ static  char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) {
  */
   __pyx_v_pos = strchr(__pyx_v_buffer, '\t');
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":7
+  /* "TabProxies.pyx":7
  *     cdef char * pos
  *     pos = strchr( buffer, '\t' )
  *     if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer )             # <<<<<<<<<<<<<<
@@ -1012,13 +1019,13 @@ static  char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) {
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1026,7 +1033,7 @@ static  char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) {
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":8
+  /* "TabProxies.pyx":8
  *     pos = strchr( buffer, '\t' )
  *     if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer )
  *     pos[0] = '\0'             # <<<<<<<<<<<<<<
@@ -1035,16 +1042,16 @@ static  char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) {
  */
   (__pyx_v_pos[0]) = '\x00';
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":9
+  /* "TabProxies.pyx":9
  *     if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer )
  *     pos[0] = '\0'
  *     pos += 1             # <<<<<<<<<<<<<<
  *     return pos
  * 
  */
-  __pyx_v_pos += 1;
+  __pyx_v_pos = (__pyx_v_pos + 1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":10
+  /* "TabProxies.pyx":10
  *     pos[0] = '\0'
  *     pos += 1
  *     return pos             # <<<<<<<<<<<<<<
@@ -1066,7 +1073,7 @@ static  char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":12
+/* "TabProxies.pyx":12
  *     return pos
  * 
  * cdef char *StrOrEmpty( char * buffer ):             # <<<<<<<<<<<<<<
@@ -1079,7 +1086,7 @@ static  char *__pyx_f_10TabProxies_StrOrEmpty(char *__pyx_v_buffer) {
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("StrOrEmpty");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":13
+  /* "TabProxies.pyx":13
  * 
  * cdef char *StrOrEmpty( char * buffer ):
  *      if buffer == NULL: return ""             # <<<<<<<<<<<<<<
@@ -1094,7 +1101,7 @@ static  char *__pyx_f_10TabProxies_StrOrEmpty(char *__pyx_v_buffer) {
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":14
+    /* "TabProxies.pyx":14
  * cdef char *StrOrEmpty( char * buffer ):
  *      if buffer == NULL: return ""
  *      else: return buffer             # <<<<<<<<<<<<<<
@@ -1112,7 +1119,7 @@ static  char *__pyx_f_10TabProxies_StrOrEmpty(char *__pyx_v_buffer) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":16
+/* "TabProxies.pyx":16
  *      else: return buffer
  * 
  * cdef int isNew( char * p, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -1125,7 +1132,7 @@ static  int __pyx_f_10TabProxies_isNew(char *__pyx_v_p, char *__pyx_v_buffer, si
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("isNew");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":17
+  /* "TabProxies.pyx":17
  * 
  * cdef int isNew( char * p, char * buffer, size_t nbytes ):
  *      if p == NULL: return 0             # <<<<<<<<<<<<<<
@@ -1140,7 +1147,7 @@ static  int __pyx_f_10TabProxies_isNew(char *__pyx_v_p, char *__pyx_v_buffer, si
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":18
+  /* "TabProxies.pyx":18
  * cdef int isNew( char * p, char * buffer, size_t nbytes ):
  *      if p == NULL: return 0
  *      return not (buffer <= p < buffer + nbytes )             # <<<<<<<<<<<<<<
@@ -1160,7 +1167,7 @@ static  int __pyx_f_10TabProxies_isNew(char *__pyx_v_p, char *__pyx_v_buffer, si
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":30
+/* "TabProxies.pyx":30
  *     '''
  * 
  *     def __cinit__(self ):             # <<<<<<<<<<<<<<
@@ -1176,7 +1183,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":31
+  /* "TabProxies.pyx":31
  * 
  *     def __cinit__(self ):
  *         self.data = NULL             # <<<<<<<<<<<<<<
@@ -1185,7 +1192,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":32
+  /* "TabProxies.pyx":32
  *     def __cinit__(self ):
  *         self.data = NULL
  *         self.fields = NULL             # <<<<<<<<<<<<<<
@@ -1194,7 +1201,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":33
+  /* "TabProxies.pyx":33
  *         self.data = NULL
  *         self.fields = NULL
  *         self.index = 0             # <<<<<<<<<<<<<<
@@ -1203,7 +1210,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":34
+  /* "TabProxies.pyx":34
  *         self.fields = NULL
  *         self.index = 0
  *         self.nbytes = 0             # <<<<<<<<<<<<<<
@@ -1212,7 +1219,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":35
+  /* "TabProxies.pyx":35
  *         self.index = 0
  *         self.nbytes = 0
  *         self.is_modified = 0             # <<<<<<<<<<<<<<
@@ -1221,7 +1228,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":36
+  /* "TabProxies.pyx":36
  *         self.nbytes = 0
  *         self.is_modified = 0
  *         self.nfields = 0             # <<<<<<<<<<<<<<
@@ -1230,7 +1237,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":38
+  /* "TabProxies.pyx":38
  *         self.nfields = 0
  *         # start counting at field offset
  *         self.offset = 0             # <<<<<<<<<<<<<<
@@ -1244,7 +1251,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":40
+/* "TabProxies.pyx":40
  *         self.offset = 0
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -1252,15 +1259,15 @@ static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self,
  *         if self.is_modified:
  */
 
-static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_10TabProxies_10TupleProxy_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_10TabProxies_10TupleProxy_1__dealloc__(PyObject *__pyx_v_self) {
   int __pyx_v_x;
   int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   __Pyx_RefNannySetupContext("__dealloc__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":42
+  /* "TabProxies.pyx":42
  *     def __dealloc__(self):
  *         cdef int x
  *         if self.is_modified:             # <<<<<<<<<<<<<<
@@ -1269,7 +1276,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
  */
   if (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":43
+    /* "TabProxies.pyx":43
  *         cdef int x
  *         if self.is_modified:
  *             for x from 0 <= x < self.nfields:             # <<<<<<<<<<<<<<
@@ -1279,7 +1286,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
     __pyx_t_1 = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_1; __pyx_v_x++) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":44
+      /* "TabProxies.pyx":44
  *         if self.is_modified:
  *             for x from 0 <= x < self.nfields:
  *                 if isNew( self.fields[x], self.data, self.nbytes ):             # <<<<<<<<<<<<<<
@@ -1289,7 +1296,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
       __pyx_t_2 = __pyx_f_10TabProxies_isNew((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]), ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes);
       if (__pyx_t_2) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":45
+        /* "TabProxies.pyx":45
  *             for x from 0 <= x < self.nfields:
  *                 if isNew( self.fields[x], self.data, self.nbytes ):
  *                     free( self.fields[x] )             # <<<<<<<<<<<<<<
@@ -1298,7 +1305,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
  */
         free((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]));
 
-        /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":46
+        /* "TabProxies.pyx":46
  *                 if isNew( self.fields[x], self.data, self.nbytes ):
  *                     free( self.fields[x] )
  *                     self.fields[x] = NULL             # <<<<<<<<<<<<<<
@@ -1314,7 +1321,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":48
+  /* "TabProxies.pyx":48
  *                     self.fields[x] = NULL
  * 
  *         if self.data != NULL: free(self.data)             # <<<<<<<<<<<<<<
@@ -1328,7 +1335,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":49
+  /* "TabProxies.pyx":49
  * 
  *         if self.data != NULL: free(self.data)
  *         if self.fields != NULL: free( self.fields )             # <<<<<<<<<<<<<<
@@ -1345,7 +1352,7 @@ static void __pyx_pf_10TabProxies_10TupleProxy___dealloc__(PyObject *__pyx_v_sel
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":51
+/* "TabProxies.pyx":51
  *         if self.fields != NULL: free( self.fields )
  * 
  *     cdef take( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -1358,7 +1365,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_take(struct __pyx_obj_10TabP
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("take");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":56
+  /* "TabProxies.pyx":56
  *         Take ownership of the pointer.
  *         '''
  *         self.data = buffer             # <<<<<<<<<<<<<<
@@ -1367,7 +1374,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_take(struct __pyx_obj_10TabP
  */
   __pyx_v_self->data = __pyx_v_buffer;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":57
+  /* "TabProxies.pyx":57
  *         '''
  *         self.data = buffer
  *         self.nbytes = nbytes             # <<<<<<<<<<<<<<
@@ -1376,7 +1383,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_take(struct __pyx_obj_10TabP
  */
   __pyx_v_self->nbytes = __pyx_v_nbytes;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":58
+  /* "TabProxies.pyx":58
  *         self.data = buffer
  *         self.nbytes = nbytes
  *         self.update( buffer, nbytes )             # <<<<<<<<<<<<<<
@@ -1399,7 +1406,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_take(struct __pyx_obj_10TabP
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":60
+/* "TabProxies.pyx":60
  *         self.update( buffer, nbytes )
  * 
  *     cdef present( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -1412,7 +1419,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_present(struct __pyx_obj_10T
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("present");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":65
+  /* "TabProxies.pyx":65
  *         Do not take ownership of the pointer.
  *         '''
  *         self.update( buffer, nbytes )             # <<<<<<<<<<<<<<
@@ -1435,7 +1442,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_present(struct __pyx_obj_10T
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":67
+/* "TabProxies.pyx":67
  *         self.update( buffer, nbytes )
  * 
  *     cdef copy( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -1448,10 +1455,9 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
   __Pyx_RefNannySetupContext("copy");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":74
+  /* "TabProxies.pyx":74
  *         cdef int s
  *         # +1 for '\0'
  *         s = sizeof(char) *  (nbytes + 1)             # <<<<<<<<<<<<<<
@@ -1460,7 +1466,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
  */
   __pyx_v_s = ((sizeof(char)) * (__pyx_v_nbytes + 1));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":75
+  /* "TabProxies.pyx":75
  *         # +1 for '\0'
  *         s = sizeof(char) *  (nbytes + 1)
  *         self.data = <char*>malloc( s )             # <<<<<<<<<<<<<<
@@ -1469,7 +1475,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
  */
   __pyx_v_self->data = ((char *)malloc(__pyx_v_s));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":76
+  /* "TabProxies.pyx":76
  *         s = sizeof(char) *  (nbytes + 1)
  *         self.data = <char*>malloc( s )
  *         if self.data == NULL:             # <<<<<<<<<<<<<<
@@ -1479,29 +1485,23 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
   __pyx_t_1 = (__pyx_v_self->data == NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":77
+    /* "TabProxies.pyx":77
  *         self.data = <char*>malloc( s )
  *         if self.data == NULL:
  *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
  *         self.nbytes = nbytes
  *         memcpy( <char*>self.data, buffer, s )
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":78
+  /* "TabProxies.pyx":78
  *         if self.data == NULL:
  *             raise ValueError("out of memory" )
  *         self.nbytes = nbytes             # <<<<<<<<<<<<<<
@@ -1510,7 +1510,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
  */
   __pyx_v_self->nbytes = __pyx_v_nbytes;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":79
+  /* "TabProxies.pyx":79
  *             raise ValueError("out of memory" )
  *         self.nbytes = nbytes
  *         memcpy( <char*>self.data, buffer, s )             # <<<<<<<<<<<<<<
@@ -1519,22 +1519,21 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
  */
   memcpy(__pyx_v_self->data, __pyx_v_buffer, __pyx_v_s);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":80
+  /* "TabProxies.pyx":80
  *         self.nbytes = nbytes
  *         memcpy( <char*>self.data, buffer, s )
  *         self.update( self.data, nbytes )             # <<<<<<<<<<<<<<
  * 
  *     cdef int getMaxFields( self, size_t nbytes ):
  */
-  __pyx_t_3 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->update(__pyx_v_self, __pyx_v_self->data, __pyx_v_nbytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->update(__pyx_v_self, __pyx_v_self->data, __pyx_v_nbytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("TabProxies.TupleProxy.copy");
   __pyx_r = 0;
   __pyx_L0:;
@@ -1543,7 +1542,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabP
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":82
+/* "TabProxies.pyx":82
  *         self.update( self.data, nbytes )
  * 
  *     cdef int getMaxFields( self, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -1555,7 +1554,7 @@ static  int __pyx_f_10TabProxies_10TupleProxy_getMaxFields(struct __pyx_obj_10Ta
   int __pyx_r;
   __Pyx_RefNannySetupContext("getMaxFields");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":84
+  /* "TabProxies.pyx":84
  *     cdef int getMaxFields( self, size_t nbytes ):
  *         '''initialize fields.'''
  *         return nbytes / 2             # <<<<<<<<<<<<<<
@@ -1571,7 +1570,7 @@ static  int __pyx_f_10TabProxies_10TupleProxy_getMaxFields(struct __pyx_obj_10Ta
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":86
+/* "TabProxies.pyx":86
  *         return nbytes / 2
  * 
  *     cdef update( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -1592,7 +1591,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   int __pyx_t_5;
   __Pyx_RefNannySetupContext("update");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":101
+  /* "TabProxies.pyx":101
  *         cdef int max_fields, x
  * 
  *         if buffer[nbytes] != 0:             # <<<<<<<<<<<<<<
@@ -1602,7 +1601,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   __pyx_t_1 = ((__pyx_v_buffer[__pyx_v_nbytes]) != 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":102
+    /* "TabProxies.pyx":102
  * 
  *         if buffer[nbytes] != 0:
  *             raise ValueError( "incomplete line at %s" % buffer )             # <<<<<<<<<<<<<<
@@ -1611,17 +1610,17 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
     __pyx_t_2 = PyBytes_FromString(__pyx_v_buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1629,7 +1628,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":106
+  /* "TabProxies.pyx":106
  *         #################################
  *         # clear data
  *         if self.fields != NULL: free(self.fields)             # <<<<<<<<<<<<<<
@@ -1643,7 +1642,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   }
   __pyx_L4:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":108
+  /* "TabProxies.pyx":108
  *         if self.fields != NULL: free(self.fields)
  * 
  *         for field from 0 <= field < self.nfields:             # <<<<<<<<<<<<<<
@@ -1653,7 +1652,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   __pyx_t_4 = __pyx_v_self->nfields;
   for (__pyx_v_field = 0; __pyx_v_field < __pyx_t_4; __pyx_v_field++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":109
+    /* "TabProxies.pyx":109
  * 
  *         for field from 0 <= field < self.nfields:
  *             if isNew( self.fields[field], self.data, self.nbytes ):             # <<<<<<<<<<<<<<
@@ -1663,7 +1662,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
     __pyx_t_5 = __pyx_f_10TabProxies_isNew((__pyx_v_self->fields[__pyx_v_field]), __pyx_v_self->data, __pyx_v_self->nbytes);
     if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":110
+      /* "TabProxies.pyx":110
  *         for field from 0 <= field < self.nfields:
  *             if isNew( self.fields[field], self.data, self.nbytes ):
  *                 free( self.fields[field] )             # <<<<<<<<<<<<<<
@@ -1676,7 +1675,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
     __pyx_L7:;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":112
+  /* "TabProxies.pyx":112
  *                 free( self.fields[field] )
  * 
  *         self.is_modified = self.nfields = 0             # <<<<<<<<<<<<<<
@@ -1686,7 +1685,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   __pyx_v_self->is_modified = 0;
   __pyx_v_self->nfields = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":116
+  /* "TabProxies.pyx":116
  *         #################################
  *         # allocate new
  *         max_fields = self.getMaxFields( nbytes )             # <<<<<<<<<<<<<<
@@ -1695,7 +1694,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
   __pyx_v_max_fields = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->getMaxFields(__pyx_v_self, __pyx_v_nbytes);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":117
+  /* "TabProxies.pyx":117
  *         # allocate new
  *         max_fields = self.getMaxFields( nbytes )
  *         self.fields = <char **>calloc( max_fields, sizeof(char *) )             # <<<<<<<<<<<<<<
@@ -1704,7 +1703,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
   __pyx_v_self->fields = ((char **)calloc(__pyx_v_max_fields, (sizeof(char *))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":118
+  /* "TabProxies.pyx":118
  *         max_fields = self.getMaxFields( nbytes )
  *         self.fields = <char **>calloc( max_fields, sizeof(char *) )
  *         if self.fields == NULL:             # <<<<<<<<<<<<<<
@@ -1714,29 +1713,23 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   __pyx_t_1 = (__pyx_v_self->fields == NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":119
+    /* "TabProxies.pyx":119
  *         self.fields = <char **>calloc( max_fields, sizeof(char *) )
  *         if self.fields == NULL:
  *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
  * 
  *         #################################
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L8;
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":123
+  /* "TabProxies.pyx":123
  *         #################################
  *         # start filling
  *         field = 0             # <<<<<<<<<<<<<<
@@ -1745,7 +1738,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
   __pyx_v_field = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":124
+  /* "TabProxies.pyx":124
  *         # start filling
  *         field = 0
  *         self.fields[field] = pos = buffer             # <<<<<<<<<<<<<<
@@ -1755,16 +1748,16 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   (__pyx_v_self->fields[__pyx_v_field]) = __pyx_v_buffer;
   __pyx_v_pos = __pyx_v_buffer;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":125
+  /* "TabProxies.pyx":125
  *         field = 0
  *         self.fields[field] = pos = buffer
  *         field += 1             # <<<<<<<<<<<<<<
  *         old_pos = pos
  * 
  */
-  __pyx_v_field += 1;
+  __pyx_v_field = (__pyx_v_field + 1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":126
+  /* "TabProxies.pyx":126
  *         self.fields[field] = pos = buffer
  *         field += 1
  *         old_pos = pos             # <<<<<<<<<<<<<<
@@ -1773,7 +1766,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
   __pyx_v_old_pos = __pyx_v_pos;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":128
+  /* "TabProxies.pyx":128
  *         old_pos = pos
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -1783,7 +1776,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   while (1) {
     if (!1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":130
+    /* "TabProxies.pyx":130
  *         while 1:
  * 
  *             pos = <char*>memchr( pos, '\t', nbytes )             # <<<<<<<<<<<<<<
@@ -1792,7 +1785,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
     __pyx_v_pos = ((char *)memchr(__pyx_v_pos, '\t', __pyx_v_nbytes));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":131
+    /* "TabProxies.pyx":131
  * 
  *             pos = <char*>memchr( pos, '\t', nbytes )
  *             if pos == NULL: break             # <<<<<<<<<<<<<<
@@ -1806,7 +1799,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
     }
     __pyx_L11:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":132
+    /* "TabProxies.pyx":132
  *             pos = <char*>memchr( pos, '\t', nbytes )
  *             if pos == NULL: break
  *             pos[0] = '\0'             # <<<<<<<<<<<<<<
@@ -1815,16 +1808,16 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
     (__pyx_v_pos[0]) = '\x00';
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":133
+    /* "TabProxies.pyx":133
  *             if pos == NULL: break
  *             pos[0] = '\0'
  *             pos += 1             # <<<<<<<<<<<<<<
  *             self.fields[field] = pos
  *             field += 1
  */
-    __pyx_v_pos += 1;
+    __pyx_v_pos = (__pyx_v_pos + 1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":134
+    /* "TabProxies.pyx":134
  *             pos[0] = '\0'
  *             pos += 1
  *             self.fields[field] = pos             # <<<<<<<<<<<<<<
@@ -1833,16 +1826,16 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
  */
     (__pyx_v_self->fields[__pyx_v_field]) = __pyx_v_pos;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":135
+    /* "TabProxies.pyx":135
  *             pos += 1
  *             self.fields[field] = pos
  *             field += 1             # <<<<<<<<<<<<<<
  *             if field >= max_fields:
  *                 raise ValueError("row too large - more than %i fields" % max_fields )
  */
-    __pyx_v_field += 1;
+    __pyx_v_field = (__pyx_v_field + 1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":136
+    /* "TabProxies.pyx":136
  *             self.fields[field] = pos
  *             field += 1
  *             if field >= max_fields:             # <<<<<<<<<<<<<<
@@ -1852,43 +1845,43 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
     __pyx_t_1 = (__pyx_v_field >= __pyx_v_max_fields);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":137
+      /* "TabProxies.pyx":137
  *             field += 1
  *             if field >= max_fields:
  *                 raise ValueError("row too large - more than %i fields" % max_fields )             # <<<<<<<<<<<<<<
  *             nbytes -= pos - old_pos
  *             if nbytes < 0: break
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_max_fields); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_max_fields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L12;
     }
     __pyx_L12:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":138
+    /* "TabProxies.pyx":138
  *             if field >= max_fields:
  *                 raise ValueError("row too large - more than %i fields" % max_fields )
  *             nbytes -= pos - old_pos             # <<<<<<<<<<<<<<
  *             if nbytes < 0: break
  *             old_pos = pos
  */
-    __pyx_v_nbytes -= (__pyx_v_pos - __pyx_v_old_pos);
+    __pyx_v_nbytes = (__pyx_v_nbytes - (__pyx_v_pos - __pyx_v_old_pos));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":139
+    /* "TabProxies.pyx":139
  *                 raise ValueError("row too large - more than %i fields" % max_fields )
  *             nbytes -= pos - old_pos
  *             if nbytes < 0: break             # <<<<<<<<<<<<<<
@@ -1902,7 +1895,7 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
     }
     __pyx_L13:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":140
+    /* "TabProxies.pyx":140
  *             nbytes -= pos - old_pos
  *             if nbytes < 0: break
  *             old_pos = pos             # <<<<<<<<<<<<<<
@@ -1913,12 +1906,12 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   }
   __pyx_L10_break:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":142
+  /* "TabProxies.pyx":142
  *             old_pos = pos
  * 
  *         self.nfields = field             # <<<<<<<<<<<<<<
  * 
- *     def __getitem__( self, key ):
+ *     def _getindex( self, int index ):
  */
   __pyx_v_self->nfields = __pyx_v_field;
 
@@ -1935,106 +1928,125 @@ static  PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10Ta
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":144
+/* "TabProxies.pyx":144
  *         self.nfields = field
  * 
- *     def __getitem__( self, key ):             # <<<<<<<<<<<<<<
- * 
- *         cdef int i = key
+ *     def _getindex( self, int index ):             # <<<<<<<<<<<<<<
+ *         '''return item at idx index'''
+ *         cdef int i = index
  */
 
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_2_getindex(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
+static char __pyx_doc_10TabProxies_10TupleProxy_2_getindex[] = "return item at idx index";
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_2_getindex(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
+  int __pyx_v_index;
   int __pyx_v_i;
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
-  int __pyx_t_2;
+  PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
-  __Pyx_RefNannySetupContext("__getitem__");
+  __Pyx_RefNannySetupContext("_getindex");
+  assert(__pyx_arg_index); {
+    __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("TabProxies.TupleProxy._getindex");
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":146
- *     def __getitem__( self, key ):
- * 
- *         cdef int i = key             # <<<<<<<<<<<<<<
+  /* "TabProxies.pyx":146
+ *     def _getindex( self, int index ):
+ *         '''return item at idx index'''
+ *         cdef int i = index             # <<<<<<<<<<<<<<
  *         if i < 0: i += self.nfields
  *         if i < 0: raise IndexError( "list index out of range" )
  */
-  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_key); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_i = __pyx_t_1;
+  __pyx_v_i = __pyx_v_index;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":147
- * 
- *         cdef int i = key
+  /* "TabProxies.pyx":147
+ *         '''return item at idx index'''
+ *         cdef int i = index
  *         if i < 0: i += self.nfields             # <<<<<<<<<<<<<<
  *         if i < 0: raise IndexError( "list index out of range" )
  *         i += self.offset
  */
-  __pyx_t_2 = (__pyx_v_i < 0);
-  if (__pyx_t_2) {
-    __pyx_v_i += ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields;
+  __pyx_t_1 = (__pyx_v_i < 0);
+  if (__pyx_t_1) {
+    __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":148
- *         cdef int i = key
+  /* "TabProxies.pyx":148
+ *         cdef int i = index
  *         if i < 0: i += self.nfields
  *         if i < 0: raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
  *         i += self.offset
  *         if i >= self.nfields:
  */
-  __pyx_t_2 = (__pyx_v_i < 0);
-  if (__pyx_t_2) {
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = (__pyx_v_i < 0);
+  if (__pyx_t_1) {
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":149
+  /* "TabProxies.pyx":149
  *         if i < 0: i += self.nfields
  *         if i < 0: raise IndexError( "list index out of range" )
  *         i += self.offset             # <<<<<<<<<<<<<<
  *         if i >= self.nfields:
- *             raise IndexError( "list index out of range)
+ *             raise IndexError( "list index out of range %i >= %i" % (i, self.nfields ))
  */
-  __pyx_v_i += ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset;
+  __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":150
+  /* "TabProxies.pyx":150
  *         if i < 0: raise IndexError( "list index out of range" )
  *         i += self.offset
  *         if i >= self.nfields:             # <<<<<<<<<<<<<<
- *             raise IndexError( "list index out of range)
+ *             raise IndexError( "list index out of range %i >= %i" % (i, self.nfields ))
  *         return self.fields[i]
  */
-  __pyx_t_2 = (__pyx_v_i >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_i >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
+  if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":151
+    /* "TabProxies.pyx":151
  *         i += self.offset
  *         if i >= self.nfields:
- *             raise IndexError( "list index out of range)             # <<<<<<<<<<<<<<
+ *             raise IndexError( "list index out of range %i >= %i" % (i, self.nfields ))             # <<<<<<<<<<<<<<
  *         return self.fields[i]
  * 
  */
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
+    __Pyx_GIVEREF(__pyx_t_3);
+    __pyx_t_2 = 0;
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2042,12 +2054,12 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___getitem__(PyObject *__pyx_
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":152
+  /* "TabProxies.pyx":152
  *         if i >= self.nfields:
- *             raise IndexError( "list index out of range)
+ *             raise IndexError( "list index out of range %i >= %i" % (i, self.nfields ))
  *         return self.fields[i]             # <<<<<<<<<<<<<<
  * 
- *     def _setindex( self, index, value ):
+ *     def __getitem__( self, key ):
  */
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_3 = PyBytes_FromString((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2059,9 +2071,10 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___getitem__(PyObject *__pyx_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("TabProxies.TupleProxy.__getitem__");
+  __Pyx_AddTraceback("TabProxies.TupleProxy._getindex");
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -2069,137 +2082,363 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___getitem__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":154
+/* "TabProxies.pyx":154
  *         return self.fields[i]
  * 
- *     def _setindex( self, index, value ):             # <<<<<<<<<<<<<<
- *         '''set item at idx index.'''
- *         cdef int idx = index
+ *     def __getitem__( self, key ):             # <<<<<<<<<<<<<<
+ *         if type(key) == int: return self._getindex( key )
+ *         # slice object
  */
 
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_10TabProxies_10TupleProxy__setindex[] = "set item at idx index.";
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_index = 0;
-  PyObject *__pyx_v_value = 0;
-  int __pyx_v_idx;
-  char *__pyx_v_tmp;
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+  PyObject *__pyx_v_start;
+  PyObject *__pyx_v_end;
+  PyObject *__pyx_v_step;
+  PyObject *__pyx_v_result;
+  PyObject *__pyx_v_index;
   PyObject *__pyx_r = NULL;
-  int __pyx_t_1;
+  PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
-  char *__pyx_t_5;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__value,0};
-  __Pyx_RefNannySetupContext("_setindex");
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[2] = {0,0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-      case  1:
-      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
-      if (likely(values[1])) kw_args--;
-      else {
-        __Pyx_RaiseArgtupleInvalid("_setindex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_setindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_index = values[0];
-    __pyx_v_value = values[1];
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0);
-    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_setindex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("TabProxies.TupleProxy._setindex");
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":156
- *     def _setindex( self, index, value ):
- *         '''set item at idx index.'''
- *         cdef int idx = index             # <<<<<<<<<<<<<<
- *         if idx < 0: raise IndexError( "list index out of range" )
- *         if idx >= self.nfields:
- */
-  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_idx = __pyx_t_1;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  int __pyx_t_8;
+  __Pyx_RefNannySetupContext("__getitem__");
+  __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_end = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_step = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_index = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":157
- *         '''set item at idx index.'''
- *         cdef int idx = index
- *         if idx < 0: raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
- *         if idx >= self.nfields:
- *             raise IndexError( "list index out of range" )
+  /* "TabProxies.pyx":155
+ * 
+ *     def __getitem__( self, key ):
+ *         if type(key) == int: return self._getindex( key )             # <<<<<<<<<<<<<<
+ *         # slice object
+ *         start, end, step = key.indices( self.nfields )
  */
-  __pyx_t_2 = (__pyx_v_idx < 0);
+  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_XDECREF(__pyx_r);
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___getindex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_INCREF(__pyx_v_key);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
+    __Pyx_GIVEREF(__pyx_v_key);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L6;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_r = __pyx_t_4;
+    __pyx_t_4 = 0;
+    goto __pyx_L0;
+    goto __pyx_L5;
   }
-  __pyx_L6:;
+  __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":158
- *         cdef int idx = index
- *         if idx < 0: raise IndexError( "list index out of range" )
- *         if idx >= self.nfields:             # <<<<<<<<<<<<<<
- *             raise IndexError( "list index out of range" )
- * 
+  /* "TabProxies.pyx":157
+ *         if type(key) == int: return self._getindex( key )
+ *         # slice object
+ *         start, end, step = key.indices( self.nfields )             # <<<<<<<<<<<<<<
+ *         result = []
+ *         for index in range( start, end, step ):
  */
-  __pyx_t_2 = (__pyx_v_idx >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
-  if (__pyx_t_2) {
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__indices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 3)) {
+    PyObject* tuple = __pyx_t_3;
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
+    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_v_start);
+    __pyx_v_start = __pyx_t_1;
+    __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_end);
+    __pyx_v_end = __pyx_t_4;
+    __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_v_step);
+    __pyx_v_step = __pyx_t_5;
+    __pyx_t_5 = 0;
+  } else {
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_EndUnpack(__pyx_t_6, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_v_start);
+    __pyx_v_start = __pyx_t_1;
+    __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_end);
+    __pyx_v_end = __pyx_t_4;
+    __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_v_step);
+    __pyx_v_step = __pyx_t_5;
+    __pyx_t_5 = 0;
+  }
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":159
- *         if idx < 0: raise IndexError( "list index out of range" )
- *         if idx >= self.nfields:
- *             raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
- * 
- *         if isNew( self.fields[idx], self.data, self.nbytes ):
+  /* "TabProxies.pyx":158
+ *         # slice object
+ *         start, end, step = key.indices( self.nfields )
+ *         result = []             # <<<<<<<<<<<<<<
+ *         for index in range( start, end, step ):
+ *             result.append( self._getindex( index ) )
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_DECREF(((PyObject *)__pyx_v_result));
+  __pyx_v_result = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "TabProxies.pyx":159
+ *         start, end, step = key.indices( self.nfields )
+ *         result = []
+ *         for index in range( start, end, step ):             # <<<<<<<<<<<<<<
+ *             result.append( self._getindex( index ) )
+ *         return result
+ */
+  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_INCREF(__pyx_v_start);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start);
+  __Pyx_GIVEREF(__pyx_v_start);
+  __Pyx_INCREF(__pyx_v_end);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end);
+  __Pyx_GIVEREF(__pyx_v_end);
+  __Pyx_INCREF(__pyx_v_step);
+  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_step);
+  __Pyx_GIVEREF(__pyx_v_step);
+  __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
+    __pyx_t_7 = 0; __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3);
+  } else {
+    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+  }
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  for (;;) {
+    if (likely(PyList_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++;
+    } else {
+      __pyx_t_5 = PyIter_Next(__pyx_t_3);
+      if (!__pyx_t_5) {
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        break;
+      }
+      __Pyx_GOTREF(__pyx_t_5);
+    }
+    __Pyx_DECREF(__pyx_v_index);
+    __pyx_v_index = __pyx_t_5;
+    __pyx_t_5 = 0;
+
+    /* "TabProxies.pyx":160
+ *         result = []
+ *         for index in range( start, end, step ):
+ *             result.append( self._getindex( index ) )             # <<<<<<<<<<<<<<
+ *         return result
+ * 
+ */
+    if (unlikely(__pyx_v_result == Py_None)) {
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___getindex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __Pyx_INCREF(__pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_index);
+    __Pyx_GIVEREF(__pyx_v_index);
+    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_8 = PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "TabProxies.pyx":161
+ *         for index in range( start, end, step ):
+ *             result.append( self._getindex( index ) )
+ *         return result             # <<<<<<<<<<<<<<
+ * 
+ *     def _setindex( self, index, value ):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(((PyObject *)__pyx_v_result));
+  __pyx_r = ((PyObject *)__pyx_v_result);
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_AddTraceback("TabProxies.TupleProxy.__getitem__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_start);
+  __Pyx_DECREF(__pyx_v_end);
+  __Pyx_DECREF(__pyx_v_step);
+  __Pyx_DECREF(__pyx_v_result);
+  __Pyx_DECREF(__pyx_v_index);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "TabProxies.pyx":163
+ *         return result
+ * 
+ *     def _setindex( self, index, value ):             # <<<<<<<<<<<<<<
+ *         '''set item at idx index.'''
+ *         cdef int idx = index
+ */
+
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_4_setindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_10TabProxies_10TupleProxy_4_setindex[] = "set item at idx index.";
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_4_setindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_index = 0;
+  PyObject *__pyx_v_value = 0;
+  int __pyx_v_idx;
+  char *__pyx_v_tmp;
+  PyObject *__pyx_r = NULL;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__value,0};
+  __Pyx_RefNannySetupContext("_setindex");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[2] = {0,0};
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("_setindex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_setindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_index = values[0];
+    __pyx_v_value = values[1];
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0);
+    __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1);
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_setindex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("TabProxies.TupleProxy._setindex");
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "TabProxies.pyx":165
+ *     def _setindex( self, index, value ):
+ *         '''set item at idx index.'''
+ *         cdef int idx = index             # <<<<<<<<<<<<<<
+ *         if idx < 0: raise IndexError( "list index out of range" )
+ *         if idx >= self.nfields:
+ */
+  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_idx = __pyx_t_1;
+
+  /* "TabProxies.pyx":166
+ *         '''set item at idx index.'''
+ *         cdef int idx = index
+ *         if idx < 0: raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
+ *         if idx >= self.nfields:
+ *             raise IndexError( "list index out of range" )
+ */
+  __pyx_t_2 = (__pyx_v_idx < 0);
+  if (__pyx_t_2) {
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "TabProxies.pyx":167
+ *         cdef int idx = index
+ *         if idx < 0: raise IndexError( "list index out of range" )
+ *         if idx >= self.nfields:             # <<<<<<<<<<<<<<
+ *             raise IndexError( "list index out of range" )
+ * 
+ */
+  __pyx_t_2 = (__pyx_v_idx >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
+  if (__pyx_t_2) {
+
+    /* "TabProxies.pyx":168
+ *         if idx < 0: raise IndexError( "list index out of range" )
+ *         if idx >= self.nfields:
+ *             raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
+ * 
+ *         if isNew( self.fields[idx], self.data, self.nbytes ):
+ */
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":161
+  /* "TabProxies.pyx":170
  *             raise IndexError( "list index out of range" )
  * 
  *         if isNew( self.fields[idx], self.data, self.nbytes ):             # <<<<<<<<<<<<<<
@@ -2209,7 +2448,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
   __pyx_t_1 = __pyx_f_10TabProxies_isNew((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]), ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":162
+    /* "TabProxies.pyx":171
  * 
  *         if isNew( self.fields[idx], self.data, self.nbytes ):
  *             free( self.fields[idx] )             # <<<<<<<<<<<<<<
@@ -2221,7 +2460,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":164
+  /* "TabProxies.pyx":173
  *             free( self.fields[idx] )
  * 
  *         self.is_modified = 1             # <<<<<<<<<<<<<<
@@ -2230,20 +2469,20 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":166
+  /* "TabProxies.pyx":175
  *         self.is_modified = 1
  * 
  *         if value == None:             # <<<<<<<<<<<<<<
  *             self.fields[idx] = NULL
  *             return
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":167
+    /* "TabProxies.pyx":176
  * 
  *         if value == None:
  *             self.fields[idx] = NULL             # <<<<<<<<<<<<<<
@@ -2252,7 +2491,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
  */
     (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]) = NULL;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":168
+    /* "TabProxies.pyx":177
  *         if value == None:
  *             self.fields[idx] = NULL
  *             return             # <<<<<<<<<<<<<<
@@ -2266,17 +2505,17 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":171
+  /* "TabProxies.pyx":180
  * 
  *         # conversion with error checking
  *         cdef char * tmp = PyString_AsString( value )             # <<<<<<<<<<<<<<
  *         self.fields[idx] = <char*>malloc( (strlen( tmp ) + 1) * sizeof(char) )
  *         if self.fields[idx] == NULL:
  */
-  __pyx_t_5 = PyString_AsString(__pyx_v_value); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_tmp = __pyx_t_5;
+  __pyx_t_4 = PyString_AsString(__pyx_v_value); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_tmp = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":172
+  /* "TabProxies.pyx":181
  *         # conversion with error checking
  *         cdef char * tmp = PyString_AsString( value )
  *         self.fields[idx] = <char*>malloc( (strlen( tmp ) + 1) * sizeof(char) )             # <<<<<<<<<<<<<<
@@ -2285,7 +2524,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
  */
   (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]) = ((char *)malloc(((strlen(__pyx_v_tmp) + 1) * (sizeof(char)))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":173
+  /* "TabProxies.pyx":182
  *         cdef char * tmp = PyString_AsString( value )
  *         self.fields[idx] = <char*>malloc( (strlen( tmp ) + 1) * sizeof(char) )
  *         if self.fields[idx] == NULL:             # <<<<<<<<<<<<<<
@@ -2295,29 +2534,23 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
   __pyx_t_2 = ((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]) == NULL);
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":174
+    /* "TabProxies.pyx":183
  *         self.fields[idx] = <char*>malloc( (strlen( tmp ) + 1) * sizeof(char) )
  *         if self.fields[idx] == NULL:
  *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
  *         strcpy( self.fields[idx], tmp )
  * 
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
   __pyx_L10:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":175
+  /* "TabProxies.pyx":184
  *         if self.fields[idx] == NULL:
  *             raise ValueError("out of memory" )
  *         strcpy( self.fields[idx], tmp )             # <<<<<<<<<<<<<<
@@ -2330,7 +2563,6 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("TabProxies.TupleProxy._setindex");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -2339,7 +2571,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":177
+/* "TabProxies.pyx":186
  *         strcpy( self.fields[idx], tmp )
  * 
  *     def __setitem__(self, index, value ):             # <<<<<<<<<<<<<<
@@ -2347,10 +2579,10 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy__setindex(PyObject *__pyx_v_
  *         cdef int i = index
  */
 
-static int __pyx_pf_10TabProxies_10TupleProxy___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
-static char __pyx_doc_10TabProxies_10TupleProxy___setitem__[] = "set item at *index* to *value*";
-struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy___setitem__;
-static int __pyx_pf_10TabProxies_10TupleProxy___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_10TupleProxy_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
+static char __pyx_doc_10TabProxies_10TupleProxy_5__setitem__[] = "set item at *index* to *value*";
+struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__;
+static int __pyx_pf_10TabProxies_10TupleProxy_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
   int __pyx_v_i;
   int __pyx_r;
   int __pyx_t_1;
@@ -2360,17 +2592,17 @@ static int __pyx_pf_10TabProxies_10TupleProxy___setitem__(PyObject *__pyx_v_self
   PyObject *__pyx_t_5 = NULL;
   __Pyx_RefNannySetupContext("__setitem__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":179
+  /* "TabProxies.pyx":188
  *     def __setitem__(self, index, value ):
  *         '''set item at *index* to *value*'''
  *         cdef int i = index             # <<<<<<<<<<<<<<
  *         if i < 0: i += self.nfields
  *         i += self.offset
  */
-  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_i = __pyx_t_1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":180
+  /* "TabProxies.pyx":189
  *         '''set item at *index* to *value*'''
  *         cdef int i = index
  *         if i < 0: i += self.nfields             # <<<<<<<<<<<<<<
@@ -2379,43 +2611,43 @@ static int __pyx_pf_10TabProxies_10TupleProxy___setitem__(PyObject *__pyx_v_self
  */
   __pyx_t_2 = (__pyx_v_i < 0);
   if (__pyx_t_2) {
-    __pyx_v_i += ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields;
+    __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":181
+  /* "TabProxies.pyx":190
  *         cdef int i = index
  *         if i < 0: i += self.nfields
  *         i += self.offset             # <<<<<<<<<<<<<<
  * 
  *         self._setindex( i, value )
  */
-  __pyx_v_i += ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset;
+  __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":183
+  /* "TabProxies.pyx":192
  *         i += self.offset
  * 
  *         self._setindex( i, value )             # <<<<<<<<<<<<<<
  * 
  *     def __len__(self):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setindex); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setindex); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __Pyx_INCREF(__pyx_v_value);
   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_value);
   __Pyx_GIVEREF(__pyx_v_value);
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
   __pyx_r = 0;
@@ -2431,7 +2663,7 @@ static int __pyx_pf_10TabProxies_10TupleProxy___setitem__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":185
+/* "TabProxies.pyx":194
  *         self._setindex( i, value )
  * 
  *     def __len__(self):             # <<<<<<<<<<<<<<
@@ -2439,12 +2671,12 @@ static int __pyx_pf_10TabProxies_10TupleProxy___setitem__(PyObject *__pyx_v_self
  * 
  */
 
-static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy___len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy___len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy_6__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy_6__len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   __Pyx_RefNannySetupContext("__len__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":186
+  /* "TabProxies.pyx":195
  * 
  *     def __len__(self):
  *         return self.nfields             # <<<<<<<<<<<<<<
@@ -2460,7 +2692,7 @@ static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy___len__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":188
+/* "TabProxies.pyx":197
  *         return self.nfields
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -2468,12 +2700,12 @@ static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy___len__(PyObject *__pyx_v_s
  *         return self
  */
 
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_7__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_7__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannySetupContext("__iter__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":189
+  /* "TabProxies.pyx":198
  * 
  *     def __iter__(self):
  *         self.index = 0             # <<<<<<<<<<<<<<
@@ -2482,7 +2714,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___iter__(PyObject *__pyx_v_s
  */
   ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":190
+  /* "TabProxies.pyx":199
  *     def __iter__(self):
  *         self.index = 0
  *         return self             # <<<<<<<<<<<<<<
@@ -2501,7 +2733,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___iter__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":192
+/* "TabProxies.pyx":201
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -2509,17 +2741,17 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___iter__(PyObject *__pyx_v_s
  *         """
  */
 
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_10TabProxies_10TupleProxy___next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy___next__;
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_8__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_10TabProxies_10TupleProxy_8__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__;
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_8__next__(PyObject *__pyx_v_self) {
   char *__pyx_v_retval;
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   __Pyx_RefNannySetupContext("__next__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":195
+  /* "TabProxies.pyx":204
  *         """python version of next().
  *         """
  *         if self.index >= self.nfields:             # <<<<<<<<<<<<<<
@@ -2529,7 +2761,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
   __pyx_t_1 = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":196
+    /* "TabProxies.pyx":205
  *         """
  *         if self.index >= self.nfields:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -2537,12 +2769,12 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
  *         self.index += 1
  */
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":197
+  /* "TabProxies.pyx":206
  *         if self.index >= self.nfields:
  *             raise StopIteration
  *         cdef char * retval = self.fields[self.index]             # <<<<<<<<<<<<<<
@@ -2551,16 +2783,16 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
  */
   __pyx_v_retval = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index]);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":198
+  /* "TabProxies.pyx":207
  *             raise StopIteration
  *         cdef char * retval = self.fields[self.index]
  *         self.index += 1             # <<<<<<<<<<<<<<
  *         if retval == NULL: return None
  *         else: return retval
  */
-  ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index += 1;
+  ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index + 1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":199
+  /* "TabProxies.pyx":208
  *         cdef char * retval = self.fields[self.index]
  *         self.index += 1
  *         if retval == NULL: return None             # <<<<<<<<<<<<<<
@@ -2577,7 +2809,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":200
+    /* "TabProxies.pyx":209
  *         self.index += 1
  *         if retval == NULL: return None
  *         else: return retval             # <<<<<<<<<<<<<<
@@ -2585,7 +2817,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
  *     def __str__(self):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyBytes_FromString(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromString(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -2605,7 +2837,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":202
+/* "TabProxies.pyx":211
  *         else: return retval
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -2613,10 +2845,10 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___next__(PyObject *__pyx_v_s
  *         # copy and replace \0 bytes with \t characters
  */
 
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_10TabProxies_10TupleProxy___str__[] = "return original data";
-struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy___str__;
-static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_9__str__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_10TabProxies_10TupleProxy_9__str__[] = "return original data";
+struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__;
+static PyObject *__pyx_pf_10TabProxies_10TupleProxy_9__str__(PyObject *__pyx_v_self) {
   char *__pyx_v_cpy;
   long __pyx_v_x;
   PyObject *__pyx_v_result;
@@ -2630,7 +2862,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
   __Pyx_RefNannySetupContext("__str__");
   __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":205
+  /* "TabProxies.pyx":214
  *         '''return original data'''
  *         # copy and replace \0 bytes with \t characters
  *         if self.is_modified:             # <<<<<<<<<<<<<<
@@ -2639,7 +2871,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
  */
   if (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":207
+    /* "TabProxies.pyx":216
  *         if self.is_modified:
  *             # todo: treat NULL values
  *             return "\t".join( [StrOrEmpty( self.fields[x]) for x in xrange(0, self.nfields ) ] )             # <<<<<<<<<<<<<<
@@ -2647,28 +2879,28 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
  *             cpy = <char*>calloc( sizeof(char), self.nbytes+1 )
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_t_3 = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields;
     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
       __pyx_v_x = __pyx_t_4;
-      __pyx_t_5 = PyBytes_FromString(__pyx_f_10TabProxies_StrOrEmpty((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyBytes_FromString(__pyx_f_10TabProxies_StrOrEmpty((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     }
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_INCREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
@@ -2676,7 +2908,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":209
+    /* "TabProxies.pyx":218
  *             return "\t".join( [StrOrEmpty( self.fields[x]) for x in xrange(0, self.nfields ) ] )
  *         else:
  *             cpy = <char*>calloc( sizeof(char), self.nbytes+1 )             # <<<<<<<<<<<<<<
@@ -2685,7 +2917,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
  */
     __pyx_v_cpy = ((char *)calloc((sizeof(char)), (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes + 1)));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":210
+    /* "TabProxies.pyx":219
  *         else:
  *             cpy = <char*>calloc( sizeof(char), self.nbytes+1 )
  *             if cpy == NULL:             # <<<<<<<<<<<<<<
@@ -2695,29 +2927,23 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
     __pyx_t_6 = (__pyx_v_cpy == NULL);
     if (__pyx_t_6) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":211
+      /* "TabProxies.pyx":220
  *             cpy = <char*>calloc( sizeof(char), self.nbytes+1 )
  *             if cpy == NULL:
  *                 raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
  *             memcpy( cpy, self.data, self.nbytes+1)
  *             for x from 0 <= x < self.nbytes:
  */
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":212
+    /* "TabProxies.pyx":221
  *             if cpy == NULL:
  *                 raise ValueError("out of memory" )
  *             memcpy( cpy, self.data, self.nbytes+1)             # <<<<<<<<<<<<<<
@@ -2726,7 +2952,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
  */
     memcpy(__pyx_v_cpy, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data, (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes + 1));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":213
+    /* "TabProxies.pyx":222
  *                 raise ValueError("out of memory" )
  *             memcpy( cpy, self.data, self.nbytes+1)
  *             for x from 0 <= x < self.nbytes:             # <<<<<<<<<<<<<<
@@ -2736,7 +2962,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
     __pyx_t_3 = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":214
+      /* "TabProxies.pyx":223
  *             memcpy( cpy, self.data, self.nbytes+1)
  *             for x from 0 <= x < self.nbytes:
  *                 if cpy[x] == '\0': cpy[x] = '\t'             # <<<<<<<<<<<<<<
@@ -2751,20 +2977,20 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
       __pyx_L11:;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":215
+    /* "TabProxies.pyx":224
  *             for x from 0 <= x < self.nbytes:
  *                 if cpy[x] == '\0': cpy[x] = '\t'
  *             result = PyString_FromStringAndSize(cpy, self.nbytes)             # <<<<<<<<<<<<<<
  *             free(cpy)
  *             return result
  */
-    __pyx_t_5 = PyString_FromStringAndSize(__pyx_v_cpy, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_cpy, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_result);
-    __pyx_v_result = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_v_result = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":216
+    /* "TabProxies.pyx":225
  *                 if cpy[x] == '\0': cpy[x] = '\t'
  *             result = PyString_FromStringAndSize(cpy, self.nbytes)
  *             free(cpy)             # <<<<<<<<<<<<<<
@@ -2773,7 +2999,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
  */
     free(__pyx_v_cpy);
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":217
+    /* "TabProxies.pyx":226
  *             result = PyString_FromStringAndSize(cpy, self.nbytes)
  *             free(cpy)
  *             return result             # <<<<<<<<<<<<<<
@@ -2802,7 +3028,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":219
+/* "TabProxies.pyx":228
  *             return result
  * 
  * def toDot( v ):             # <<<<<<<<<<<<<<
@@ -2812,6 +3038,7 @@ static PyObject *__pyx_pf_10TabProxies_10TupleProxy___str__(PyObject *__pyx_v_se
 
 static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__pyx_v_v); /*proto*/
 static char __pyx_doc_10TabProxies_toDot[] = "convert value to '.' if None";
+static PyMethodDef __pyx_mdef_10TabProxies_toDot = {__Pyx_NAMESTR("toDot"), (PyCFunction)__pyx_pf_10TabProxies_toDot, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_toDot)};
 static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__pyx_v_v) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
@@ -2820,27 +3047,27 @@ static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__p
   __Pyx_RefNannySetupContext("toDot");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":221
+  /* "TabProxies.pyx":230
  * def toDot( v ):
  *     '''convert value to '.' if None'''
  *     if v == None: return "."             # <<<<<<<<<<<<<<
  *     else: return str(v)
  * 
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-    __pyx_r = ((PyObject *)__pyx_kp_s_8);
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
+    __pyx_r = ((PyObject *)__pyx_kp_s_16);
     goto __pyx_L0;
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":222
+    /* "TabProxies.pyx":231
  *     '''convert value to '.' if None'''
  *     if v == None: return "."
  *     else: return str(v)             # <<<<<<<<<<<<<<
@@ -2848,14 +3075,14 @@ static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__p
  * def quote( v ):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_v);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
     __Pyx_GIVEREF(__pyx_v_v);
-    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __pyx_r = __pyx_t_3;
     __pyx_t_3 = 0;
     goto __pyx_L0;
@@ -2875,7 +3102,7 @@ static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":224
+/* "TabProxies.pyx":233
  *     else: return str(v)
  * 
  * def quote( v ):             # <<<<<<<<<<<<<<
@@ -2883,9 +3110,10 @@ static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__p
  *     if type(v) in types.StringTypes:
  */
 
-static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__pyx_v_v); /*proto*/
-static char __pyx_doc_10TabProxies_quote[] = "return a quoted attribute.";
-static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__pyx_v_v) {
+static PyObject *__pyx_pf_10TabProxies_1quote(PyObject *__pyx_self, PyObject *__pyx_v_v); /*proto*/
+static char __pyx_doc_10TabProxies_1quote[] = "return a quoted attribute.";
+static PyMethodDef __pyx_mdef_10TabProxies_1quote = {__Pyx_NAMESTR("quote"), (PyCFunction)__pyx_pf_10TabProxies_1quote, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_1quote)};
+static PyObject *__pyx_pf_10TabProxies_1quote(PyObject *__pyx_self, PyObject *__pyx_v_v) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -2893,23 +3121,23 @@ static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__p
   __Pyx_RefNannySetupContext("quote");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":226
+  /* "TabProxies.pyx":235
  * def quote( v ):
  *     '''return a quoted attribute.'''
  *     if type(v) in types.StringTypes:             # <<<<<<<<<<<<<<
  *         return '"%s"' % v
  *     else:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = ((PySequence_Contains(__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_v))))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = ((PySequence_Contains(__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_v))))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":227
+    /* "TabProxies.pyx":236
  *     '''return a quoted attribute.'''
  *     if type(v) in types.StringTypes:
  *         return '"%s"' % v             # <<<<<<<<<<<<<<
@@ -2917,7 +3145,7 @@ static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__p
  *         return str(v)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -2926,7 +3154,7 @@ static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__p
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":229
+    /* "TabProxies.pyx":238
  *         return '"%s"' % v
  *     else:
  *         return str(v)             # <<<<<<<<<<<<<<
@@ -2934,14 +3162,14 @@ static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__p
  * cdef class GTFProxy( TupleProxy ):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_v);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v);
     __Pyx_GIVEREF(__pyx_v_v);
-    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
@@ -2961,7 +3189,7 @@ static PyObject *__pyx_pf_10TabProxies_quote(PyObject *__pyx_self, PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":245
+/* "TabProxies.pyx":254
  *     '''
  * 
  *     def __cinit__(self ):             # <<<<<<<<<<<<<<
@@ -2977,7 +3205,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy___cinit__(PyObject *__pyx_v_self, PyO
     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":247
+  /* "TabProxies.pyx":256
  *     def __cinit__(self ):
  *         # automatically calls TupleProxy.__cinit__
  *         self.hasOwnAttributes = False             # <<<<<<<<<<<<<<
@@ -2991,7 +3219,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy___cinit__(PyObject *__pyx_v_self, PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":249
+/* "TabProxies.pyx":258
  *         self.hasOwnAttributes = False
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -2999,11 +3227,11 @@ static int __pyx_pf_10TabProxies_8GTFProxy___cinit__(PyObject *__pyx_v_self, PyO
  *         if self.hasOwnAttributes:
  */
 
-static void __pyx_pf_10TabProxies_8GTFProxy___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_10TabProxies_8GTFProxy___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_10TabProxies_8GTFProxy_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_10TabProxies_8GTFProxy_1__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannySetupContext("__dealloc__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":251
+  /* "TabProxies.pyx":260
  *     def __dealloc__(self):
  *         # automatically calls TupleProxy.__dealloc__
  *         if self.hasOwnAttributes:             # <<<<<<<<<<<<<<
@@ -3012,7 +3240,7 @@ static void __pyx_pf_10TabProxies_8GTFProxy___dealloc__(PyObject *__pyx_v_self)
  */
   if (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":252
+    /* "TabProxies.pyx":261
  *         # automatically calls TupleProxy.__dealloc__
  *         if self.hasOwnAttributes:
  *             free(self.attributes)             # <<<<<<<<<<<<<<
@@ -3027,7 +3255,7 @@ static void __pyx_pf_10TabProxies_8GTFProxy___dealloc__(PyObject *__pyx_v_self)
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":254
+/* "TabProxies.pyx":263
  *             free(self.attributes)
  * 
  *     cdef int getMaxFields( self, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -3039,7 +3267,7 @@ static  int __pyx_f_10TabProxies_8GTFProxy_getMaxFields(struct __pyx_obj_10TabPr
   int __pyx_r;
   __Pyx_RefNannySetupContext("getMaxFields");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":256
+  /* "TabProxies.pyx":265
  *     cdef int getMaxFields( self, size_t nbytes ):
  *         '''return max number of fields.'''
  *         return 9             # <<<<<<<<<<<<<<
@@ -3055,7 +3283,7 @@ static  int __pyx_f_10TabProxies_8GTFProxy_getMaxFields(struct __pyx_obj_10TabPr
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":258
+/* "TabProxies.pyx":267
  *         return 9
  * 
  *     cdef update( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -3074,7 +3302,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   char *__pyx_t_4;
   __Pyx_RefNannySetupContext("update");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":265
+  /* "TabProxies.pyx":274
  *         cdef int end
  *         cdef char * cstart, * cend, * cscore
  *         self.contig = buffer             # <<<<<<<<<<<<<<
@@ -3083,7 +3311,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
  */
   __pyx_v_self->contig = __pyx_v_buffer;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":268
+  /* "TabProxies.pyx":277
  *         cdef char * pos
  * 
  *         if buffer[nbytes] != 0:             # <<<<<<<<<<<<<<
@@ -3093,34 +3321,34 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_t_1 = ((__pyx_v_buffer[__pyx_v_nbytes]) != 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":269
+    /* "TabProxies.pyx":278
  * 
  *         if buffer[nbytes] != 0:
  *             raise ValueError( "incomplete line at %s" % buffer )             # <<<<<<<<<<<<<<
  * 
  *         self.source = pos = nextItem( buffer )
  */
-    __pyx_t_2 = PyBytes_FromString(__pyx_v_buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromString(__pyx_v_buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":271
+  /* "TabProxies.pyx":280
  *             raise ValueError( "incomplete line at %s" % buffer )
  * 
  *         self.source = pos = nextItem( buffer )             # <<<<<<<<<<<<<<
@@ -3131,7 +3359,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_self->source = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":272
+  /* "TabProxies.pyx":281
  * 
  *         self.source = pos = nextItem( buffer )
  *         self.feature = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3142,7 +3370,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_self->feature = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":273
+  /* "TabProxies.pyx":282
  *         self.source = pos = nextItem( buffer )
  *         self.feature = pos = nextItem( pos )
  *         cstart = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3153,7 +3381,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_cstart = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":274
+  /* "TabProxies.pyx":283
  *         self.feature = pos = nextItem( pos )
  *         cstart = pos = nextItem( pos )
  *         cend = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3164,7 +3392,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_cend = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":275
+  /* "TabProxies.pyx":284
  *         cstart = pos = nextItem( pos )
  *         cend = pos = nextItem( pos )
  *         self.score = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3175,7 +3403,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_self->score = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":276
+  /* "TabProxies.pyx":285
  *         cend = pos = nextItem( pos )
  *         self.score = pos = nextItem( pos )
  *         self.strand = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3186,7 +3414,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_self->strand = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":277
+  /* "TabProxies.pyx":286
  *         self.score = pos = nextItem( pos )
  *         self.strand = pos = nextItem( pos )
  *         self.frame = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3197,7 +3425,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_self->frame = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":278
+  /* "TabProxies.pyx":287
  *         self.strand = pos = nextItem( pos )
  *         self.frame = pos = nextItem( pos )
  *         self.attributes = pos = nextItem( pos )             # <<<<<<<<<<<<<<
@@ -3208,24 +3436,33 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   __pyx_v_self->attributes = __pyx_t_4;
   __pyx_v_pos = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":280
+  /* "TabProxies.pyx":289
  *         self.attributes = pos = nextItem( pos )
  * 
  *         self.start = atoi( cstart ) - 1             # <<<<<<<<<<<<<<
  *         self.end = atoi( cend )
- * 
+ *         self.nfields = 9
  */
   __pyx_v_self->start = (atoi(__pyx_v_cstart) - 1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":281
+  /* "TabProxies.pyx":290
  * 
  *         self.start = atoi( cstart ) - 1
  *         self.end = atoi( cend )             # <<<<<<<<<<<<<<
+ *         self.nfields = 9
  * 
- *     property contig:
  */
   __pyx_v_self->end = atoi(__pyx_v_cend);
 
+  /* "TabProxies.pyx":291
+ *         self.start = atoi( cstart ) - 1
+ *         self.end = atoi( cend )
+ *         self.nfields = 9             # <<<<<<<<<<<<<<
+ * 
+ *     property contig:
+ */
+  __pyx_v_self->__pyx_base.nfields = 9;
+
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -3239,7 +3476,7 @@ static  PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabPr
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":285
+/* "TabProxies.pyx":295
  *     property contig:
  *        '''contig of feature.'''
  *        def __get__( self ): return self.contig             # <<<<<<<<<<<<<<
@@ -3253,7 +3490,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6contig___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3271,7 +3508,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6contig___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":286
+/* "TabProxies.pyx":296
  *        '''contig of feature.'''
  *        def __get__( self ): return self.contig
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3279,13 +3516,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6contig___get__(PyObject *__pyx
  *            self.contig = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_6contig___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_6contig___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_6contig_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_6contig_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":287
+  /* "TabProxies.pyx":297
  *        def __get__( self ): return self.contig
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3294,14 +3531,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_6contig___set__(PyObject *__pyx_v_sel
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":288
+  /* "TabProxies.pyx":298
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.contig = value             # <<<<<<<<<<<<<<
  * 
  *     property feature:
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3314,7 +3551,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_6contig___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":292
+/* "TabProxies.pyx":302
  *     property feature:
  *        '''feature name.'''
  *        def __get__( self ): return self.feature             # <<<<<<<<<<<<<<
@@ -3328,7 +3565,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7feature___get__(PyObject *__py
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3346,7 +3583,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7feature___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":293
+/* "TabProxies.pyx":303
  *        '''feature name.'''
  *        def __get__( self ): return self.feature
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3354,13 +3591,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7feature___get__(PyObject *__py
  *            self.feature = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_7feature___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_7feature___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_7feature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_7feature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":294
+  /* "TabProxies.pyx":304
  *        def __get__( self ): return self.feature
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3369,14 +3606,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_7feature___set__(PyObject *__pyx_v_se
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":295
+  /* "TabProxies.pyx":305
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.feature = value             # <<<<<<<<<<<<<<
  * 
  *     property source:
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3389,7 +3626,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_7feature___set__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":299
+/* "TabProxies.pyx":309
  *     property source:
  *        '''feature source.'''
  *        def __get__( self ): return self.source             # <<<<<<<<<<<<<<
@@ -3403,7 +3640,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6source___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3421,7 +3658,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6source___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":300
+/* "TabProxies.pyx":310
  *        '''feature source.'''
  *        def __get__( self ): return self.source
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3429,13 +3666,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6source___get__(PyObject *__pyx
  *            self.source = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_6source___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_6source___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_6source_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_6source_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":301
+  /* "TabProxies.pyx":311
  *        def __get__( self ): return self.source
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3444,14 +3681,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_6source___set__(PyObject *__pyx_v_sel
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":302
+  /* "TabProxies.pyx":312
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.source = value             # <<<<<<<<<<<<<<
  * 
  *     property start:
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3464,7 +3701,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_6source___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":306
+/* "TabProxies.pyx":316
  *     property start:
  *        '''feature start (in 0-based open/closed coordinates).'''
  *        def __get__( self ): return self.start             # <<<<<<<<<<<<<<
@@ -3478,7 +3715,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5start___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3496,7 +3733,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5start___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":307
+/* "TabProxies.pyx":317
  *        '''feature start (in 0-based open/closed coordinates).'''
  *        def __get__( self ): return self.start
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3504,13 +3741,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5start___get__(PyObject *__pyx_
  *            self.start = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_5start___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_5start___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   uint32_t __pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":308
+  /* "TabProxies.pyx":318
  *        def __get__( self ): return self.start
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3519,14 +3756,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_5start___set__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":309
+  /* "TabProxies.pyx":319
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.start = value             # <<<<<<<<<<<<<<
  * 
  *     property end:
  */
-  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3539,7 +3776,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_5start___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":313
+/* "TabProxies.pyx":323
  *     property end:
  *        '''feature end (in 0-based open/closed coordinates).'''
  *        def __get__( self ): return self.end             # <<<<<<<<<<<<<<
@@ -3553,7 +3790,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3end___get__(PyObject *__pyx_v_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -3571,7 +3808,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3end___get__(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":314
+/* "TabProxies.pyx":324
  *        '''feature end (in 0-based open/closed coordinates).'''
  *        def __get__( self ): return self.end
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3579,13 +3816,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3end___get__(PyObject *__pyx_v_
  *            self.end = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_3end___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_3end___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   uint32_t __pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":315
+  /* "TabProxies.pyx":325
  *        def __get__( self ): return self.end
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3594,14 +3831,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_3end___set__(PyObject *__pyx_v_self,
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":316
+  /* "TabProxies.pyx":326
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.end = value             # <<<<<<<<<<<<<<
  * 
  *     property score:
  */
-  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3614,7 +3851,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_3end___set__(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":320
+/* "TabProxies.pyx":330
  *     property score:
  *        '''feature score.'''
  *        def __get__( self ):             # <<<<<<<<<<<<<<
@@ -3631,7 +3868,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_
   PyObject *__pyx_t_4 = NULL;
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":321
+  /* "TabProxies.pyx":331
  *        '''feature score.'''
  *        def __get__( self ):
  *            if self.score[0] == '.' and self.score[1] == '\0' :             # <<<<<<<<<<<<<<
@@ -3647,7 +3884,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_
   }
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":322
+    /* "TabProxies.pyx":332
  *        def __get__( self ):
  *            if self.score[0] == '.' and self.score[1] == '\0' :
  *                return None             # <<<<<<<<<<<<<<
@@ -3662,7 +3899,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":324
+    /* "TabProxies.pyx":334
  *                return None
  *            else:
  *                return atof(self.score)             # <<<<<<<<<<<<<<
@@ -3670,7 +3907,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_
  *            self.is_modified = True
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_4 = PyFloat_FromDouble(atof(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyFloat_FromDouble(atof(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_r = __pyx_t_4;
     __pyx_t_4 = 0;
@@ -3690,7 +3927,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":325
+/* "TabProxies.pyx":335
  *            else:
  *                return atof(self.score)
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3698,13 +3935,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_
  *            self.score = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_5score___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_5score___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_5score_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_5score_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":326
+  /* "TabProxies.pyx":336
  *                return atof(self.score)
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3713,14 +3950,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_5score___set__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":327
+  /* "TabProxies.pyx":337
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.score = value             # <<<<<<<<<<<<<<
  * 
  *     property strand:
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3733,7 +3970,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_5score___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":331
+/* "TabProxies.pyx":341
  *     property strand:
  *        '''feature strand.'''
  *        def __get__( self ): return self.strand             # <<<<<<<<<<<<<<
@@ -3747,7 +3984,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6strand___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3765,7 +4002,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6strand___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":332
+/* "TabProxies.pyx":342
  *        '''feature strand.'''
  *        def __get__( self ): return self.strand
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3773,13 +4010,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6strand___get__(PyObject *__pyx
  *            self.strand = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_6strand___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_6strand___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_6strand_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_6strand_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":333
+  /* "TabProxies.pyx":343
  *        def __get__( self ): return self.strand
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3788,14 +4025,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_6strand___set__(PyObject *__pyx_v_sel
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":334
+  /* "TabProxies.pyx":344
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.strand = value             # <<<<<<<<<<<<<<
  * 
  *     property frame:
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3808,7 +4045,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_6strand___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":338
+/* "TabProxies.pyx":348
  *     property frame:
  *        '''feature frame.'''
  *        def __get__( self ): return self.frame             # <<<<<<<<<<<<<<
@@ -3822,7 +4059,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5frame___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3840,7 +4077,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5frame___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":339
+/* "TabProxies.pyx":349
  *        '''feature frame.'''
  *        def __get__( self ): return self.frame
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3848,13 +4085,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5frame___get__(PyObject *__pyx_
  *            self.frame = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_5frame___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_5frame___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_5frame_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_5frame_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":340
+  /* "TabProxies.pyx":350
  *        def __get__( self ): return self.frame
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3863,14 +4100,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_5frame___set__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":341
+  /* "TabProxies.pyx":351
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.frame = value             # <<<<<<<<<<<<<<
  * 
  *     property attributes:
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3883,7 +4120,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_5frame___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":345
+/* "TabProxies.pyx":355
  *     property attributes:
  *        '''feature attributes (as a string).'''
  *        def __get__( self ): return self.attributes             # <<<<<<<<<<<<<<
@@ -3897,7 +4134,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_10attributes___get__(PyObject *
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3915,7 +4152,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_10attributes___get__(PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":346
+/* "TabProxies.pyx":356
  *        '''feature attributes (as a string).'''
  *        def __get__( self ): return self.attributes
  *        def __set__( self, value ):             # <<<<<<<<<<<<<<
@@ -3923,13 +4160,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_10attributes___get__(PyObject *
  *            self.attributes = value
  */
 
-static int __pyx_pf_10TabProxies_8GTFProxy_10attributes___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
-static int __pyx_pf_10TabProxies_8GTFProxy_10attributes___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8GTFProxy_10attributes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_10TabProxies_8GTFProxy_10attributes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   char *__pyx_t_1;
   __Pyx_RefNannySetupContext("__set__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":347
+  /* "TabProxies.pyx":357
  *        def __get__( self ): return self.attributes
  *        def __set__( self, value ):
  *            self.is_modified = True             # <<<<<<<<<<<<<<
@@ -3938,14 +4175,14 @@ static int __pyx_pf_10TabProxies_8GTFProxy_10attributes___set__(PyObject *__pyx_
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":348
+  /* "TabProxies.pyx":358
  *        def __set__( self, value ):
  *            self.is_modified = True
  *            self.attributes = value             # <<<<<<<<<<<<<<
  * 
  *     def asDict( self ):
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes = __pyx_t_1;
 
   __pyx_r = 0;
@@ -3958,7 +4195,7 @@ static int __pyx_pf_10TabProxies_8GTFProxy_10attributes___set__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":350
+/* "TabProxies.pyx":360
  *            self.attributes = value
  * 
  *     def asDict( self ):             # <<<<<<<<<<<<<<
@@ -3966,9 +4203,9 @@ static int __pyx_pf_10TabProxies_8GTFProxy_10attributes___set__(PyObject *__pyx_
  *         """
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_10TabProxies_8GTFProxy_asDict[] = "parse attributes - return as dict\n        ";
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_2asDict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_10TabProxies_8GTFProxy_2asDict[] = "parse attributes - return as dict\n        ";
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_2asDict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   char *__pyx_v_attributes;
   PyObject *__pyx_v_fields;
   PyObject *__pyx_v_result;
@@ -3991,15 +4228,15 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
   double __pyx_t_11;
   int __pyx_t_12;
   __Pyx_RefNannySetupContext("asDict");
-  __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_fields = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_d = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_n = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":355
+  /* "TabProxies.pyx":365
  * 
  *         # remove comments
  *         attributes = self.attributes             # <<<<<<<<<<<<<<
@@ -4008,181 +4245,168 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
  */
   __pyx_v_attributes = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":358
+  /* "TabProxies.pyx":368
  * 
  *         # separate into fields
  *         fields = [ x.strip() for x in attributes.split(";")[:-1]]             # <<<<<<<<<<<<<<
  * 
  *         result = {}
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_3 = PyBytes_FromString(__pyx_v_attributes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyBytes_FromString(__pyx_v_attributes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
-  __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_3, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PySequence_GetSlice(__pyx_t_5, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
-    __pyx_t_2 = 0; __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5);
+  if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+    __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3);
   } else {
-    __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
   }
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_5))) {
-      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break;
-      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
-      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
-      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
+    if (likely(PyList_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
     } else {
-      __pyx_t_3 = PyIter_Next(__pyx_t_5);
-      if (!__pyx_t_3) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyIter_Next(__pyx_t_3);
+      if (!__pyx_t_4) {
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_GOTREF(__pyx_t_4);
     }
     __Pyx_DECREF(__pyx_v_x);
-    __pyx_v_x = __pyx_t_3;
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_x = __pyx_t_4;
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_INCREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_fields));
   __pyx_v_fields = __pyx_t_1;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":360
+  /* "TabProxies.pyx":370
  *         fields = [ x.strip() for x in attributes.split(";")[:-1]]
  * 
  *         result = {}             # <<<<<<<<<<<<<<
  * 
  *         for f in fields:
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_result));
   __pyx_v_result = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":362
+  /* "TabProxies.pyx":372
  *         result = {}
  * 
  *         for f in fields:             # <<<<<<<<<<<<<<
  * 
  *             d = [ x.strip() for x in f.split(" ")]
  */
-  if (likely(((PyObject *)__pyx_v_fields) != Py_None)) {
-    __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields); __Pyx_INCREF(__pyx_t_1);
-  } else {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__pyx_v_fields == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
+  __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields); __Pyx_INCREF(__pyx_t_1);
   for (;;) {
     if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
-    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
+    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
     __Pyx_DECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_v_f = __pyx_t_3;
+    __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":364
+    /* "TabProxies.pyx":374
  *         for f in fields:
  * 
  *             d = [ x.strip() for x in f.split(" ")]             # <<<<<<<<<<<<<<
  * 
  *             n,v = d[0], d[1]
  */
-    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_11));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
-    __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
-      __pyx_t_6 = 0; __pyx_t_3 = __pyx_t_7; __Pyx_INCREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+      __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
     } else {
-      __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_7); __pyx_t_6++;
+      if (likely(PyList_CheckExact(__pyx_t_5))) {
+        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
+        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
+        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
       } else {
-        __pyx_t_7 = PyIter_Next(__pyx_t_3);
-        if (!__pyx_t_7) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyIter_Next(__pyx_t_5);
+        if (!__pyx_t_4) {
+          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(__pyx_t_4);
       }
       __Pyx_DECREF(__pyx_v_x);
-      __pyx_v_x = __pyx_t_7;
-      __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_x = __pyx_t_4;
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_INCREF(((PyObject *)__pyx_t_5));
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_INCREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(((PyObject *)__pyx_v_d));
-    __pyx_v_d = __pyx_t_5;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __pyx_v_d = __pyx_t_3;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":366
+    /* "TabProxies.pyx":376
  *             d = [ x.strip() for x in f.split(" ")]
  * 
  *             n,v = d[0], d[1]             # <<<<<<<<<<<<<<
  *             if len(d) > 2: v = d[1:]
  * 
  */
-    __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_d), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_d), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_d), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_d), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_v_n);
-    __pyx_v_n = __pyx_t_5;
-    __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_v_v);
-    __pyx_v_v = __pyx_t_3;
+    __pyx_v_n = __pyx_t_3;
     __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_v_v);
+    __pyx_v_v = __pyx_t_5;
+    __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":367
+    /* "TabProxies.pyx":377
  * 
  *             n,v = d[0], d[1]
  *             if len(d) > 2: v = d[1:]             # <<<<<<<<<<<<<<
@@ -4190,65 +4414,65 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
  *             if v[0] == '"' and v[-1] == '"':
  */
     if (unlikely(__pyx_v_d == Py_None)) {
-      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
     __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_d)); 
     __pyx_t_8 = (__pyx_t_6 > 2);
     if (__pyx_t_8) {
-      __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_d), 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_d), 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_DECREF(__pyx_v_v);
-      __pyx_v_v = ((PyObject *)__pyx_t_3);
-      __pyx_t_3 = 0;
+      __pyx_v_v = ((PyObject *)__pyx_t_5);
+      __pyx_t_5 = 0;
       goto __pyx_L11;
     }
     __pyx_L11:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":369
+    /* "TabProxies.pyx":379
  *             if len(d) > 2: v = d[1:]
  * 
  *             if v[0] == '"' and v[-1] == '"':             # <<<<<<<<<<<<<<
  *                 v = v[1:-1]
  *             else:
  */
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_v, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_12), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_v, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_22), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (__pyx_t_8) {
-      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_v, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_12), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_v, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_22), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_10 = __pyx_t_9;
     } else {
       __pyx_t_10 = __pyx_t_8;
     }
     if (__pyx_t_10) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":370
+      /* "TabProxies.pyx":380
  * 
  *             if v[0] == '"' and v[-1] == '"':
  *                 v = v[1:-1]             # <<<<<<<<<<<<<<
  *             else:
  *                 ## try to convert to a value
  */
-      __pyx_t_3 = PySequence_GetSlice(__pyx_v_v, 1, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_v, 1, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_v = __pyx_t_5;
+      __pyx_t_5 = 0;
       goto __pyx_L12;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":373
+      /* "TabProxies.pyx":383
  *             else:
  *                 ## try to convert to a value
  *                 try:             # <<<<<<<<<<<<<<
@@ -4263,50 +4487,50 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
         __Pyx_XGOTREF(__pyx_save_exc_tb);
         /*try:*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":374
+          /* "TabProxies.pyx":384
  *                 ## try to convert to a value
  *                 try:
  *                     v = float( v )             # <<<<<<<<<<<<<<
  *                     v = int( v )
  *                 except ValueError:
  */
-          __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_v_v); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-          __pyx_t_3 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_v_v); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+          __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+          __Pyx_GOTREF(__pyx_t_5);
           __Pyx_DECREF(__pyx_v_v);
-          __pyx_v_v = __pyx_t_3;
-          __pyx_t_3 = 0;
+          __pyx_v_v = __pyx_t_5;
+          __pyx_t_5 = 0;
 
-          /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":375
+          /* "TabProxies.pyx":385
  *                 try:
  *                     v = float( v )
  *                     v = int( v )             # <<<<<<<<<<<<<<
  *                 except ValueError:
  *                     pass
  */
-          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
           __Pyx_INCREF(__pyx_v_v);
-          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_v);
+          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v);
           __Pyx_GIVEREF(__pyx_v_v);
-          __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-          __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+          __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
           __Pyx_DECREF(__pyx_v_v);
-          __pyx_v_v = __pyx_t_5;
-          __pyx_t_5 = 0;
+          __pyx_v_v = __pyx_t_3;
+          __pyx_t_3 = 0;
         }
         __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
         __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
         __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
         goto __pyx_L20_try_end;
         __pyx_L13_error:;
-        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":376
+        /* "TabProxies.pyx":386
  *                     v = float( v )
  *                     v = int( v )
  *                 except ValueError:             # <<<<<<<<<<<<<<
@@ -4319,7 +4543,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
           goto __pyx_L14_exception_handled;
         }
 
-        /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":378
+        /* "TabProxies.pyx":388
  *                 except ValueError:
  *                     pass
  *                 except TypeError:             # <<<<<<<<<<<<<<
@@ -4346,18 +4570,18 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
     }
     __pyx_L12:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":381
+    /* "TabProxies.pyx":391
  *                     pass
  * 
  *             result[n] = v             # <<<<<<<<<<<<<<
  * 
  *         return result
  */
-    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_n, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_n, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":383
+  /* "TabProxies.pyx":393
  *             result[n] = v
  * 
  *         return result             # <<<<<<<<<<<<<<
@@ -4392,7 +4616,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":385
+/* "TabProxies.pyx":395
  *         return result
  * 
  *     def fromDict( self, d ):             # <<<<<<<<<<<<<<
@@ -4400,9 +4624,9 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_asDict(PyObject *__pyx_v_self,
  *         cdef char * p
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
-static char __pyx_doc_10TabProxies_8GTFProxy_fromDict[] = "set attributes from a dictionary.";
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3fromDict(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/
+static char __pyx_doc_10TabProxies_8GTFProxy_3fromDict[] = "set attributes from a dictionary.";
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3fromDict(PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
   char *__pyx_v_p;
   int __pyx_v_l;
   PyObject *__pyx_v_aa;
@@ -4420,12 +4644,12 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
   int __pyx_t_8;
   char *__pyx_t_9;
   __Pyx_RefNannySetupContext("fromDict");
-  __pyx_v_aa = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_aa = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_a = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":391
+  /* "TabProxies.pyx":401
  * 
  *         # clean up if this field is set twice
  *         if self.hasOwnAttributes:             # <<<<<<<<<<<<<<
@@ -4434,7 +4658,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  */
   if (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":392
+    /* "TabProxies.pyx":402
  *         # clean up if this field is set twice
  *         if self.hasOwnAttributes:
  *             free(self.attributes)             # <<<<<<<<<<<<<<
@@ -4446,35 +4670,35 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":394
+  /* "TabProxies.pyx":404
  *             free(self.attributes)
  * 
  *         aa = []             # <<<<<<<<<<<<<<
  *         for k,v in d.items():
  *             if type(v) == types.StringType:
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_aa));
   __pyx_v_aa = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":395
+  /* "TabProxies.pyx":405
  * 
  *         aa = []
  *         for k,v in d.items():             # <<<<<<<<<<<<<<
  *             if type(v) == types.StringType:
  *                 aa.append( '%s "%s"' % (k,v) )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_d, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_d, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
     __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1);
   } else {
-    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -4488,7 +4712,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
     } else {
       __pyx_t_3 = PyIter_Next(__pyx_t_1);
       if (!__pyx_t_3) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
       __Pyx_GOTREF(__pyx_t_3);
@@ -4505,14 +4729,14 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
       __pyx_v_v = __pyx_t_5;
       __pyx_t_5 = 0;
     } else {
-      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_v_k);
       __pyx_v_k = __pyx_t_4;
@@ -4522,26 +4746,26 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
       __pyx_t_5 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":396
+    /* "TabProxies.pyx":406
  *         aa = []
  *         for k,v in d.items():
  *             if type(v) == types.StringType:             # <<<<<<<<<<<<<<
  *                 aa.append( '%s "%s"' % (k,v) )
  *             else:
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__StringType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__StringType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (__pyx_t_7) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":397
+      /* "TabProxies.pyx":407
  *         for k,v in d.items():
  *             if type(v) == types.StringType:
  *                 aa.append( '%s "%s"' % (k,v) )             # <<<<<<<<<<<<<<
@@ -4549,26 +4773,26 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  *                 aa.append( '%s %s' % (k,str(v)) )
  */
       if (unlikely(__pyx_v_aa == Py_None)) {
-        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
       __Pyx_INCREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k);
       __Pyx_GIVEREF(__pyx_v_k);
       __Pyx_INCREF(__pyx_v_v);
       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_v);
       __Pyx_GIVEREF(__pyx_v_v);
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_aa), ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __pyx_t_8 = PyList_Append(__pyx_v_aa, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       goto __pyx_L8;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":399
+      /* "TabProxies.pyx":409
  *                 aa.append( '%s "%s"' % (k,v) )
  *             else:
  *                 aa.append( '%s %s' % (k,str(v)) )             # <<<<<<<<<<<<<<
@@ -4576,80 +4800,80 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  *         a = "; ".join( aa ) + ";"
  */
       if (unlikely(__pyx_v_aa == Py_None)) {
-        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_v);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v);
       __Pyx_GIVEREF(__pyx_v_v);
-      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_k);
       __Pyx_GIVEREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
       __Pyx_GIVEREF(__pyx_t_3);
       __pyx_t_3 = 0;
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_aa), ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __pyx_t_8 = PyList_Append(__pyx_v_aa, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     }
     __pyx_L8:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":401
+  /* "TabProxies.pyx":411
  *                 aa.append( '%s %s' % (k,str(v)) )
  * 
  *         a = "; ".join( aa ) + ";"             # <<<<<<<<<<<<<<
  *         p = a
  *         l = len(a)
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_15), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_25), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(((PyObject *)__pyx_v_aa));
   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_aa));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_aa));
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __Pyx_DECREF(__pyx_v_a);
   __pyx_v_a = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":402
+  /* "TabProxies.pyx":412
  * 
  *         a = "; ".join( aa ) + ";"
  *         p = a             # <<<<<<<<<<<<<<
  *         l = len(a)
  *         self.attributes = <char *>calloc( l + 1, sizeof(char) )
  */
-  __pyx_t_9 = PyBytes_AsString(__pyx_v_a); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyBytes_AsString(__pyx_v_a); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_p = __pyx_t_9;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":403
+  /* "TabProxies.pyx":413
  *         a = "; ".join( aa ) + ";"
  *         p = a
  *         l = len(a)             # <<<<<<<<<<<<<<
  *         self.attributes = <char *>calloc( l + 1, sizeof(char) )
  *         if self.attributes == NULL:
  */
-  __pyx_t_2 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_l = __pyx_t_2;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":404
+  /* "TabProxies.pyx":414
  *         p = a
  *         l = len(a)
  *         self.attributes = <char *>calloc( l + 1, sizeof(char) )             # <<<<<<<<<<<<<<
@@ -4658,7 +4882,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes = ((char *)calloc((__pyx_v_l + 1), (sizeof(char))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":405
+  /* "TabProxies.pyx":415
  *         l = len(a)
  *         self.attributes = <char *>calloc( l + 1, sizeof(char) )
  *         if self.attributes == NULL:             # <<<<<<<<<<<<<<
@@ -4668,29 +4892,23 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
   __pyx_t_7 = (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes == NULL);
   if (__pyx_t_7) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":406
+    /* "TabProxies.pyx":416
  *         self.attributes = <char *>calloc( l + 1, sizeof(char) )
  *         if self.attributes == NULL:
  *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
  *         memcpy( self.attributes, p, l )
  * 
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L9;
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":407
+  /* "TabProxies.pyx":417
  *         if self.attributes == NULL:
  *             raise ValueError("out of memory" )
  *         memcpy( self.attributes, p, l )             # <<<<<<<<<<<<<<
@@ -4699,7 +4917,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  */
   memcpy(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes, __pyx_v_p, __pyx_v_l);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":409
+  /* "TabProxies.pyx":419
  *         memcpy( self.attributes, p, l )
  * 
  *         self.hasOwnAttributes = True             # <<<<<<<<<<<<<<
@@ -4708,7 +4926,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":410
+  /* "TabProxies.pyx":420
  * 
  *         self.hasOwnAttributes = True
  *         self.is_modified = True             # <<<<<<<<<<<<<<
@@ -4737,7 +4955,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":412
+/* "TabProxies.pyx":422
  *         self.is_modified = True
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -4745,8 +4963,8 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_fromDict(PyObject *__pyx_v_self
  *         cdef int x
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_4__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_4__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -4761,7 +4979,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
   PyObject *__pyx_t_11 = NULL;
   __Pyx_RefNannySetupContext("__str__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":416
+  /* "TabProxies.pyx":426
  *         cdef int x
  * 
  *         if self.is_modified:             # <<<<<<<<<<<<<<
@@ -4770,7 +4988,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
  */
   if (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":417
+    /* "TabProxies.pyx":427
  * 
  *         if self.is_modified:
  *             return "\t".join(             # <<<<<<<<<<<<<<
@@ -4778,127 +4996,127 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
  *                  self.source,
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":418
+    /* "TabProxies.pyx":428
  *         if self.is_modified:
  *             return "\t".join(
  *                 (self.contig,             # <<<<<<<<<<<<<<
  *                  self.source,
  *                  self.feature,
  */
-    __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":419
+    /* "TabProxies.pyx":429
  *             return "\t".join(
  *                 (self.contig,
  *                  self.source,             # <<<<<<<<<<<<<<
  *                  self.feature,
  *                  str(self.start+1),
  */
-    __pyx_t_3 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":420
+    /* "TabProxies.pyx":430
  *                 (self.contig,
  *                  self.source,
  *                  self.feature,             # <<<<<<<<<<<<<<
  *                  str(self.start+1),
  *                  str(self.end),
  */
-    __pyx_t_4 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":421
+    /* "TabProxies.pyx":431
  *                  self.source,
  *                  self.feature,
  *                  str(self.start+1),             # <<<<<<<<<<<<<<
  *                  str(self.end),
  *                  toDot(self.score),
  */
-    __pyx_t_5 = PyInt_FromLong((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyInt_FromLong((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":422
+    /* "TabProxies.pyx":432
  *                  self.feature,
  *                  str(self.start+1),
  *                  str(self.end),             # <<<<<<<<<<<<<<
  *                  toDot(self.score),
  *                  self.strand,
  */
-    __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
     __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":423
+    /* "TabProxies.pyx":433
  *                  str(self.start+1),
  *                  str(self.end),
  *                  toDot(self.score),             # <<<<<<<<<<<<<<
  *                  self.strand,
  *                  self.frame,
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__toDot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__toDot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":424
+    /* "TabProxies.pyx":434
  *                  str(self.end),
  *                  toDot(self.score),
  *                  self.strand,             # <<<<<<<<<<<<<<
  *                  self.frame,
  *                  self.attributes ) )
  */
-    __pyx_t_9 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_9));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":425
+    /* "TabProxies.pyx":435
  *                  toDot(self.score),
  *                  self.strand,
  *                  self.frame,             # <<<<<<<<<<<<<<
  *                  self.attributes ) )
  *         else:
  */
-    __pyx_t_7 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_7));
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":426
+    /* "TabProxies.pyx":436
  *                  self.strand,
  *                  self.frame,
  *                  self.attributes ) )             # <<<<<<<<<<<<<<
  *         else:
  *             return TupleProxy.__str__(self)
  */
-    __pyx_t_10 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-    __pyx_t_11 = PyTuple_New(9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
+    __pyx_t_11 = PyTuple_New(9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_11));
     PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_t_3));
@@ -4926,15 +5144,15 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
     __pyx_t_9 = 0;
     __pyx_t_7 = 0;
     __pyx_t_10 = 0;
-    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
-    __Pyx_GIVEREF(__pyx_t_11);
+    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_11));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
     __pyx_t_11 = 0;
-    __pyx_t_11 = PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
     __pyx_r = __pyx_t_11;
     __pyx_t_11 = 0;
     goto __pyx_L0;
@@ -4942,7 +5160,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":428
+    /* "TabProxies.pyx":438
  *                  self.attributes ) )
  *         else:
  *             return TupleProxy.__str__(self)             # <<<<<<<<<<<<<<
@@ -4950,17 +5168,17 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
  *     def invert( self, int lcontig ):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_11 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____str__); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____str__); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
     __Pyx_INCREF(__pyx_v_self);
     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_self);
     __Pyx_GIVEREF(__pyx_v_self);
-    __pyx_t_1 = PyObject_Call(__pyx_t_11, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
@@ -4989,7 +5207,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":430
+/* "TabProxies.pyx":440
  *             return TupleProxy.__str__(self)
  * 
  *     def invert( self, int lcontig ):             # <<<<<<<<<<<<<<
@@ -4997,9 +5215,9 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___str__(PyObject *__pyx_v_self)
  * 
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self, PyObject *__pyx_arg_lcontig); /*proto*/
-static char __pyx_doc_10TabProxies_8GTFProxy_invert[] = "invert coordinates to negative strand coordinates\n        \n        This method will only act if the feature is on the\n        negative strand.";
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self, PyObject *__pyx_arg_lcontig) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5invert(PyObject *__pyx_v_self, PyObject *__pyx_arg_lcontig); /*proto*/
+static char __pyx_doc_10TabProxies_8GTFProxy_5invert[] = "invert coordinates to negative strand coordinates\n        \n        This method will only act if the feature is on the\n        negative strand.";
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5invert(PyObject *__pyx_v_self, PyObject *__pyx_arg_lcontig) {
   int __pyx_v_lcontig;
   PyObject *__pyx_v_start;
   PyObject *__pyx_v_end;
@@ -5012,7 +5230,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
   PyObject *__pyx_t_6 = NULL;
   __Pyx_RefNannySetupContext("invert");
   assert(__pyx_arg_lcontig); {
-    __pyx_v_lcontig = __Pyx_PyInt_AsInt(__pyx_arg_lcontig); if (unlikely((__pyx_v_lcontig == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_lcontig = __Pyx_PyInt_AsInt(__pyx_arg_lcontig); if (unlikely((__pyx_v_lcontig == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L3_error:;
@@ -5023,7 +5241,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
   __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_end = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":436
+  /* "TabProxies.pyx":446
  *         negative strand.'''
  * 
  *         if self.strand[0] == '-':             # <<<<<<<<<<<<<<
@@ -5033,7 +5251,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
   __pyx_t_1 = ((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand[0]) == '-');
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":437
+    /* "TabProxies.pyx":447
  * 
  *         if self.strand[0] == '-':
  *             start = min(self.start, self.end)             # <<<<<<<<<<<<<<
@@ -5047,13 +5265,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
     } else {
       __pyx_t_4 = __pyx_t_3;
     }
-    __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_v_start);
     __pyx_v_start = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":438
+    /* "TabProxies.pyx":448
  *         if self.strand[0] == '-':
  *             start = min(self.start, self.end)
  *             end = max(self.start, self.end)             # <<<<<<<<<<<<<<
@@ -5067,32 +5285,32 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
     } else {
       __pyx_t_3 = __pyx_t_2;
     }
-    __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_v_end);
     __pyx_v_end = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":439
+    /* "TabProxies.pyx":449
  *             start = min(self.start, self.end)
  *             end = max(self.start, self.end)
  *             self.start, self.end = lcontig - end, lcontig - start             # <<<<<<<<<<<<<<
  * 
  *     def keys( self ):
  */
-    __pyx_t_5 = PyInt_FromLong(__pyx_v_lcontig); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyInt_FromLong(__pyx_v_lcontig); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyNumber_Subtract(__pyx_t_5, __pyx_v_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Subtract(__pyx_t_5, __pyx_v_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyInt_FromLong(__pyx_v_lcontig); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyInt_FromLong(__pyx_v_lcontig); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_5 = PyNumber_Subtract(__pyx_t_6, __pyx_v_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyNumber_Subtract(__pyx_t_6, __pyx_v_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_4 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_4 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_4 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start = __pyx_t_3;
     ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end = __pyx_t_4;
@@ -5115,7 +5333,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":441
+/* "TabProxies.pyx":451
  *             self.start, self.end = lcontig - end, lcontig - start
  * 
  *     def keys( self ):             # <<<<<<<<<<<<<<
@@ -5123,9 +5341,9 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_invert(PyObject *__pyx_v_self,
  *         r = self.attributes
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_10TabProxies_8GTFProxy_keys[] = "return a list of attributes defined in this entry.";
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_10TabProxies_8GTFProxy_6keys[] = "return a list of attributes defined in this entry.";
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   char *__pyx_v_r;
   PyObject *__pyx_v_x;
   PyObject *__pyx_r = NULL;
@@ -5135,11 +5353,10 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_keys(PyObject *__pyx_v_self, CY
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   int __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
   __Pyx_RefNannySetupContext("keys");
   __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":443
+  /* "TabProxies.pyx":453
  *     def keys( self ):
  *         '''return a list of attributes defined in this entry.'''
  *         r = self.attributes             # <<<<<<<<<<<<<<
@@ -5148,93 +5365,81 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_keys(PyObject *__pyx_v_self, CY
  */
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":444
+  /* "TabProxies.pyx":454
  *         '''return a list of attributes defined in this entry.'''
  *         r = self.attributes
  *         return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ]             # <<<<<<<<<<<<<<
  * 
- *     def __getitem__(self, item):
+ *     def __getitem__(self, key):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_3 = PyBytes_FromString(__pyx_v_r); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyBytes_FromString(__pyx_v_r); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
-  __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
-    __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3);
+  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+    __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4);
   } else {
-    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_3))) {
-      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
+    if (likely(PyList_CheckExact(__pyx_t_4))) {
+      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
+      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
     } else {
-      __pyx_t_5 = PyIter_Next(__pyx_t_3);
-      if (!__pyx_t_5) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyIter_Next(__pyx_t_4);
+      if (!__pyx_t_3) {
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(__pyx_t_3);
     }
     __Pyx_DECREF(__pyx_v_x);
-    __pyx_v_x = __pyx_t_5;
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_2), Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_x = __pyx_t_3;
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_2), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (__pyx_t_6) {
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_11));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
-      __pyx_t_7 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_7, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       goto __pyx_L7;
     }
     __pyx_L7:;
   }
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_INCREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
@@ -5247,7 +5452,6 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_keys(PyObject *__pyx_v_self, CY
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_7);
   __Pyx_AddTraceback("TabProxies.GTFProxy.keys");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -5257,41 +5461,41 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_keys(PyObject *__pyx_v_self, CY
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":446
+/* "TabProxies.pyx":456
  *         return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ]
  * 
- *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
- *         return self.__getattr__( item )
+ *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
+ *         return self.__getattr__( key )
  * 
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   __Pyx_RefNannySetupContext("__getitem__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":447
+  /* "TabProxies.pyx":457
  * 
- *     def __getitem__(self, item):
- *         return self.__getattr__( item )             # <<<<<<<<<<<<<<
+ *     def __getitem__(self, key):
+ *         return self.__getattr__( key )             # <<<<<<<<<<<<<<
  * 
  *     def __getattr__(self, item ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattr__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattr__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_item);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_item);
-  __Pyx_GIVEREF(__pyx_v_item);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(__pyx_v_key);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
+  __Pyx_GIVEREF(__pyx_v_key);
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
   goto __pyx_L0;
@@ -5310,24 +5514,23 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getitem__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":449
- *         return self.__getattr__( item )
+/* "TabProxies.pyx":459
+ *         return self.__getattr__( key )
  * 
  *     def __getattr__(self, item ):             # <<<<<<<<<<<<<<
  *         """Generic lookup of attribute from GFF/GTF attributes
  *         Only called if there *isn't* an attribute with this name
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
-static char __pyx_doc_10TabProxies_8GTFProxy___getattr__[] = "Generic lookup of attribute from GFF/GTF attributes \n        Only called if there *isn't* an attribute with this name\n        ";
-struct wrapperbase __pyx_wrapperbase_10TabProxies_8GTFProxy___getattr__;
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_8__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
+static char __pyx_doc_10TabProxies_8GTFProxy_8__getattr__[] = "Generic lookup of attribute from GFF/GTF attributes \n        Only called if there *isn't* an attribute with this name\n        ";
+struct wrapperbase __pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__;
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_8__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
   char *__pyx_v_start;
   char *__pyx_v_query;
-  char *__pyx_v_cpy;
   char *__pyx_v_end;
   int __pyx_v_l;
-  char *__pyx_v_result;
+  PyObject *__pyx_v_result;
   PyObject *__pyx_r = NULL;
   char *__pyx_t_1;
   int __pyx_t_2;
@@ -5336,18 +5539,19 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
   int __pyx_t_5;
   int __pyx_t_6;
   __Pyx_RefNannySetupContext("__getattr__");
+  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":458
+  /* "TabProxies.pyx":468
  *         cdef char * end
  *         cdef int l
  *         query = item             # <<<<<<<<<<<<<<
  * 
  *         start = strstr( self.attributes, query)
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_item); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_item); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_query = __pyx_t_1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":460
+  /* "TabProxies.pyx":470
  *         query = item
  * 
  *         start = strstr( self.attributes, query)             # <<<<<<<<<<<<<<
@@ -5356,7 +5560,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
  */
   __pyx_v_start = strstr(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes, __pyx_v_query);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":461
+  /* "TabProxies.pyx":471
  * 
  *         start = strstr( self.attributes, query)
  *         if start == NULL:             # <<<<<<<<<<<<<<
@@ -5366,55 +5570,55 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
   __pyx_t_2 = (__pyx_v_start == NULL);
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":462
+    /* "TabProxies.pyx":472
  *         start = strstr( self.attributes, query)
  *         if start == NULL:
  *             raise AttributeError("'GTFProxy' has no attribute '%s'" % item )             # <<<<<<<<<<<<<<
  * 
  *         start += strlen(query) + 1
  */
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), __pyx_v_item); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_v_item); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_AttributeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":464
+  /* "TabProxies.pyx":474
  *             raise AttributeError("'GTFProxy' has no attribute '%s'" % item )
  * 
  *         start += strlen(query) + 1             # <<<<<<<<<<<<<<
  *         # skip gaps before
- *         while start[0] == " ": start += 1
+ *         while start[0] == ' ': start += 1
  */
-  __pyx_v_start += (strlen(__pyx_v_query) + 1);
+  __pyx_v_start = (__pyx_v_start + (strlen(__pyx_v_query) + 1));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":466
+  /* "TabProxies.pyx":476
  *         start += strlen(query) + 1
  *         # skip gaps before
- *         while start[0] == " ": start += 1             # <<<<<<<<<<<<<<
+ *         while start[0] == ' ': start += 1             # <<<<<<<<<<<<<<
  *         if start[0] == '"':
  *             start += 1
  */
   while (1) {
     __pyx_t_2 = ((__pyx_v_start[0]) == ' ');
     if (!__pyx_t_2) break;
-    __pyx_v_start += 1;
+    __pyx_v_start = (__pyx_v_start + 1);
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":467
+  /* "TabProxies.pyx":477
  *         # skip gaps before
- *         while start[0] == " ": start += 1
+ *         while start[0] == ' ': start += 1
  *         if start[0] == '"':             # <<<<<<<<<<<<<<
  *             start += 1
  *             end = start
@@ -5422,30 +5626,30 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
   __pyx_t_2 = ((__pyx_v_start[0]) == '"');
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":468
- *         while start[0] == " ": start += 1
+    /* "TabProxies.pyx":478
+ *         while start[0] == ' ': start += 1
  *         if start[0] == '"':
  *             start += 1             # <<<<<<<<<<<<<<
  *             end = start
  *             while end[0] != '\0' and end[0] != '"': end += 1
  */
-    __pyx_v_start += 1;
+    __pyx_v_start = (__pyx_v_start + 1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":469
+    /* "TabProxies.pyx":479
  *         if start[0] == '"':
  *             start += 1
  *             end = start             # <<<<<<<<<<<<<<
  *             while end[0] != '\0' and end[0] != '"': end += 1
- *             l = end - start + 1
+ *             l = end - start
  */
     __pyx_v_end = __pyx_v_start;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":470
+    /* "TabProxies.pyx":480
  *             start += 1
  *             end = start
  *             while end[0] != '\0' and end[0] != '"': end += 1             # <<<<<<<<<<<<<<
- *             l = end - start + 1
- *             cpy = <char*>calloc( l, sizeof(char ) )
+ *             l = end - start
+ *             result = PyString_FromStringAndSize( start, l )
  */
     while (1) {
       __pyx_t_2 = ((__pyx_v_end[0]) != '\x00');
@@ -5456,105 +5660,47 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
         __pyx_t_6 = __pyx_t_2;
       }
       if (!__pyx_t_6) break;
-      __pyx_v_end += 1;
+      __pyx_v_end = (__pyx_v_end + 1);
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":471
+    /* "TabProxies.pyx":481
  *             end = start
  *             while end[0] != '\0' and end[0] != '"': end += 1
- *             l = end - start + 1             # <<<<<<<<<<<<<<
- *             cpy = <char*>calloc( l, sizeof(char ) )
- *             if cpy == NULL: raise ValueError("out of memory" )
- */
-    __pyx_v_l = ((__pyx_v_end - __pyx_v_start) + 1);
-
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":472
- *             while end[0] != '\0' and end[0] != '"': end += 1
- *             l = end - start + 1
- *             cpy = <char*>calloc( l, sizeof(char ) )             # <<<<<<<<<<<<<<
- *             if cpy == NULL: raise ValueError("out of memory" )
- *             memcpy( cpy, start, l )
- */
-    __pyx_v_cpy = ((char *)calloc(__pyx_v_l, (sizeof(char))));
-
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":473
- *             l = end - start + 1
- *             cpy = <char*>calloc( l, sizeof(char ) )
- *             if cpy == NULL: raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
- *             memcpy( cpy, start, l )
- *             cpy[l-1] = '\0'
- */
-    __pyx_t_6 = (__pyx_v_cpy == NULL);
-    if (__pyx_t_6) {
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L11;
-    }
-    __pyx_L11:;
-
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":474
- *             cpy = <char*>calloc( l, sizeof(char ) )
- *             if cpy == NULL: raise ValueError("out of memory" )
- *             memcpy( cpy, start, l )             # <<<<<<<<<<<<<<
- *             cpy[l-1] = '\0'
- *             result = cpy
- */
-    memcpy(__pyx_v_cpy, __pyx_v_start, __pyx_v_l);
-
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":475
- *             if cpy == NULL: raise ValueError("out of memory" )
- *             memcpy( cpy, start, l )
- *             cpy[l-1] = '\0'             # <<<<<<<<<<<<<<
- *             result = cpy
- *             free(cpy)
- */
-    (__pyx_v_cpy[(__pyx_v_l - 1)]) = '\x00';
-
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":476
- *             memcpy( cpy, start, l )
- *             cpy[l-1] = '\0'
- *             result = cpy             # <<<<<<<<<<<<<<
- *             free(cpy)
+ *             l = end - start             # <<<<<<<<<<<<<<
+ *             result = PyString_FromStringAndSize( start, l )
  *             return result
  */
-    __pyx_v_result = __pyx_v_cpy;
+    __pyx_v_l = (__pyx_v_end - __pyx_v_start);
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":477
- *             cpy[l-1] = '\0'
- *             result = cpy
- *             free(cpy)             # <<<<<<<<<<<<<<
+    /* "TabProxies.pyx":482
+ *             while end[0] != '\0' and end[0] != '"': end += 1
+ *             l = end - start
+ *             result = PyString_FromStringAndSize( start, l )             # <<<<<<<<<<<<<<
  *             return result
  *         else:
  */
-    free(__pyx_v_cpy);
+    __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_start, __pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_v_result);
+    __pyx_v_result = __pyx_t_3;
+    __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":478
- *             result = cpy
- *             free(cpy)
+    /* "TabProxies.pyx":483
+ *             l = end - start
+ *             result = PyString_FromStringAndSize( start, l )
  *             return result             # <<<<<<<<<<<<<<
  *         else:
  *             return start
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_4 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_r = ((PyObject *)__pyx_t_4);
-    __pyx_t_4 = 0;
+    __Pyx_INCREF(__pyx_v_result);
+    __pyx_r = __pyx_v_result;
     goto __pyx_L0;
     goto __pyx_L8;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":480
+    /* "TabProxies.pyx":485
  *             return result
  *         else:
  *             return start             # <<<<<<<<<<<<<<
@@ -5562,10 +5708,10 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
  *     def setAttribute( self, name, value ):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_4 = PyBytes_FromString(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_r = ((PyObject *)__pyx_t_4);
-    __pyx_t_4 = 0;
+    __pyx_t_3 = PyBytes_FromString(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_r = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L8:;
@@ -5578,12 +5724,13 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
   __Pyx_AddTraceback("TabProxies.GTFProxy.__getattr__");
   __pyx_r = NULL;
   __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_result);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":482
+/* "TabProxies.pyx":487
  *             return start
  * 
  *     def setAttribute( self, name, value ):             # <<<<<<<<<<<<<<
@@ -5591,9 +5738,9 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy___getattr__(PyObject *__pyx_v_s
  *         r = self.asDict()
  */
 
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_setAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_10TabProxies_8GTFProxy_setAttribute[] = "convenience method to set an attribute.";
-static PyObject *__pyx_pf_10TabProxies_8GTFProxy_setAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_9setAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_10TabProxies_8GTFProxy_9setAttribute[] = "convenience method to set an attribute.";
+static PyObject *__pyx_pf_10TabProxies_8GTFProxy_9setAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
   PyObject *__pyx_v_value = 0;
   PyObject *__pyx_v_r;
@@ -5621,11 +5768,11 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_setAttribute(PyObject *__pyx_v_
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("setAttribute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("setAttribute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setAttribute") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setAttribute") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_name = values[0];
     __pyx_v_value = values[1];
@@ -5637,7 +5784,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_setAttribute(PyObject *__pyx_v_
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("setAttribute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("setAttribute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("TabProxies.GTFProxy.setAttribute");
   __Pyx_RefNannyFinishContext();
@@ -5645,49 +5792,49 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_setAttribute(PyObject *__pyx_v_
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":484
+  /* "TabProxies.pyx":489
  *     def setAttribute( self, name, value ):
  *         '''convenience method to set an attribute.'''
  *         r = self.asDict()             # <<<<<<<<<<<<<<
  *         r[name] = value
  *         self.fromDict( r )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__asDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__asDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_v_r);
   __pyx_v_r = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":485
+  /* "TabProxies.pyx":490
  *         '''convenience method to set an attribute.'''
  *         r = self.asDict()
  *         r[name] = value             # <<<<<<<<<<<<<<
  *         self.fromDict( r )
  * 
  */
-  if (PyObject_SetItem(__pyx_v_r, __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_v_r, __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":486
+  /* "TabProxies.pyx":491
  *         r = self.asDict()
  *         r[name] = value
  *         self.fromDict( r )             # <<<<<<<<<<<<<<
  * 
  * cdef class NamedTupleProxy( TupleProxy ):
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fromDict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fromDict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_r);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_r);
   __Pyx_GIVEREF(__pyx_v_r);
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -5705,7 +5852,7 @@ static PyObject *__pyx_pf_10TabProxies_8GTFProxy_setAttribute(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":492
+/* "TabProxies.pyx":497
  *     map_key2field = {}
  * 
  *     def __setattr__(self, key, value ):             # <<<<<<<<<<<<<<
@@ -5729,22 +5876,22 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
   __Pyx_RefNannySetupContext("__setattr__");
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":495
+  /* "TabProxies.pyx":500
  *         '''set attribute.'''
  *         cdef int idx
  *         idx, f = self.map_key2field[key]             # <<<<<<<<<<<<<<
  *         if self.nfields < idx:
  *             raise KeyError( "field %s not set" % key )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
     PyObject* tuple = __pyx_t_2;
     __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -5753,16 +5900,16 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
     __pyx_v_f = __pyx_t_3;
     __pyx_t_3 = 0;
   } else {
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_v_idx = __pyx_t_4;
     __Pyx_DECREF(__pyx_v_f);
@@ -5770,7 +5917,7 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
     __pyx_t_3 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":496
+  /* "TabProxies.pyx":501
  *         cdef int idx
  *         idx, f = self.map_key2field[key]
  *         if self.nfields < idx:             # <<<<<<<<<<<<<<
@@ -5780,51 +5927,51 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
   __pyx_t_6 = (((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.nfields < __pyx_v_idx);
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":497
+    /* "TabProxies.pyx":502
  *         idx, f = self.map_key2field[key]
  *         if self.nfields < idx:
  *             raise KeyError( "field %s not set" % key )             # <<<<<<<<<<<<<<
  *         TupleProxy.__setitem__(self, idx, str(value) )
  * 
  */
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":498
+  /* "TabProxies.pyx":503
  *         if self.nfields < idx:
  *             raise KeyError( "field %s not set" % key )
  *         TupleProxy.__setitem__(self, idx, str(value) )             # <<<<<<<<<<<<<<
  * 
  *     def __getattr__(self, key ):
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____setitem__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____setitem__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_value);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
   __Pyx_GIVEREF(__pyx_v_value);
-  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
   __Pyx_GIVEREF(__pyx_v_self);
@@ -5834,10 +5981,10 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_3 = 0;
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
   __pyx_r = 0;
@@ -5855,7 +6002,7 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":500
+/* "TabProxies.pyx":505
  *         TupleProxy.__setitem__(self, idx, str(value) )
  * 
  *     def __getattr__(self, key ):             # <<<<<<<<<<<<<<
@@ -5863,8 +6010,8 @@ static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v
  *         idx, f = self.map_key2field[key]
  */
 
-static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
-static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
   int __pyx_v_idx;
   PyObject *__pyx_v_f;
   PyObject *__pyx_r = NULL;
@@ -5877,22 +6024,22 @@ static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *_
   __Pyx_RefNannySetupContext("__getattr__");
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":502
+  /* "TabProxies.pyx":507
  *     def __getattr__(self, key ):
  *         cdef int idx
  *         idx, f = self.map_key2field[key]             # <<<<<<<<<<<<<<
  *         if self.nfields < idx:
  *             raise KeyError( "field %s not set" % key )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
     PyObject* tuple = __pyx_t_2;
     __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -5901,16 +6048,16 @@ static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *_
     __pyx_v_f = __pyx_t_3;
     __pyx_t_3 = 0;
   } else {
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_v_idx = __pyx_t_4;
     __Pyx_DECREF(__pyx_v_f);
@@ -5918,7 +6065,7 @@ static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *_
     __pyx_t_3 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":503
+  /* "TabProxies.pyx":508
  *         cdef int idx
  *         idx, f = self.map_key2field[key]
  *         if self.nfields < idx:             # <<<<<<<<<<<<<<
@@ -5928,31 +6075,31 @@ static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *_
   __pyx_t_6 = (((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.nfields < __pyx_v_idx);
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":504
+    /* "TabProxies.pyx":509
  *         idx, f = self.map_key2field[key]
  *         if self.nfields < idx:
  *             raise KeyError( "field %s not set" % key )             # <<<<<<<<<<<<<<
  *         return f( self.fields[idx] )
  * 
  */
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":505
+  /* "TabProxies.pyx":510
  *         if self.nfields < idx:
  *             raise KeyError( "field %s not set" % key )
  *         return f( self.fields[idx] )             # <<<<<<<<<<<<<<
@@ -5960,16 +6107,16 @@ static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *_
  * cdef class BedProxy( NamedTupleProxy ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.fields[__pyx_v_idx])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.fields[__pyx_v_idx])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_v_f, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_v_f, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
   goto __pyx_L0;
@@ -5990,7 +6137,7 @@ static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":526
+/* "TabProxies.pyx":531
  *         'blockStarts': (11,str), }
  * 
  *     cdef int getMaxFields( self, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -6002,7 +6149,7 @@ static  int __pyx_f_10TabProxies_8BedProxy_getMaxFields(struct __pyx_obj_10TabPr
   int __pyx_r;
   __Pyx_RefNannySetupContext("getMaxFields");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":528
+  /* "TabProxies.pyx":533
  *     cdef int getMaxFields( self, size_t nbytes ):
  *         '''return max number of fields.'''
  *         return 12             # <<<<<<<<<<<<<<
@@ -6018,7 +6165,7 @@ static  int __pyx_f_10TabProxies_8BedProxy_getMaxFields(struct __pyx_obj_10TabPr
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":530
+/* "TabProxies.pyx":535
  *         return 12
  * 
  *     cdef update( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -6030,21 +6177,20 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
   __Pyx_RefNannySetupContext("update");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":535
+  /* "TabProxies.pyx":540
  *         nbytes does not include the terminal '\0'.
  *         '''
  *         TupleProxy.update( self, buffer, nbytes )             # <<<<<<<<<<<<<<
  * 
  *         if self.nfields < 3:
  */
-  __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":537
+  /* "TabProxies.pyx":542
  *         TupleProxy.update( self, buffer, nbytes )
  * 
  *         if self.nfields < 3:             # <<<<<<<<<<<<<<
@@ -6054,29 +6200,23 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
   __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base.nfields < 3);
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":538
+    /* "TabProxies.pyx":543
  * 
  *         if self.nfields < 3:
  *             raise ValueError( "bed format requires at least three columns" )             # <<<<<<<<<<<<<<
  * 
  *         # determines bed format
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_18));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_1, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":541
+  /* "TabProxies.pyx":546
  * 
  *         # determines bed format
  *         self.bedfields = self.nfields             # <<<<<<<<<<<<<<
@@ -6085,7 +6225,7 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
  */
   __pyx_v_self->bedfields = __pyx_v_self->__pyx_base.__pyx_base.nfields;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":544
+  /* "TabProxies.pyx":549
  * 
  *         # do automatic conversion
  *         self.contig = self.fields[0]             # <<<<<<<<<<<<<<
@@ -6094,7 +6234,7 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
  */
   __pyx_v_self->contig = (__pyx_v_self->__pyx_base.__pyx_base.fields[0]);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":545
+  /* "TabProxies.pyx":550
  *         # do automatic conversion
  *         self.contig = self.fields[0]
  *         self.start = atoi( self.fields[1] )             # <<<<<<<<<<<<<<
@@ -6103,7 +6243,7 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
  */
   __pyx_v_self->start = atoi((__pyx_v_self->__pyx_base.__pyx_base.fields[1]));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":546
+  /* "TabProxies.pyx":551
  *         self.contig = self.fields[0]
  *         self.start = atoi( self.fields[1] )
  *         self.end = atoi( self.fields[2] )             # <<<<<<<<<<<<<<
@@ -6116,7 +6256,6 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("TabProxies.BedProxy.update");
   __pyx_r = 0;
   __pyx_L0:;
@@ -6125,7 +6264,7 @@ static  PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabPr
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":555
+/* "TabProxies.pyx":560
  *     #    def __get__( self ): return self.end
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -6144,7 +6283,7 @@ static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self)
   __Pyx_RefNannySetupContext("__str__");
   __pyx_v_retval = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":557
+  /* "TabProxies.pyx":562
  *     def __str__(self):
  * 
  *         cdef int save_fields = self.nfields             # <<<<<<<<<<<<<<
@@ -6153,7 +6292,7 @@ static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self)
  */
   __pyx_v_save_fields = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":559
+  /* "TabProxies.pyx":564
  *         cdef int save_fields = self.nfields
  *         # ensure fields to use correct format
  *         self.nfields = self.bedfields             # <<<<<<<<<<<<<<
@@ -6162,29 +6301,29 @@ static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self)
  */
   ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->bedfields;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":560
+  /* "TabProxies.pyx":565
  *         # ensure fields to use correct format
  *         self.nfields = self.bedfields
  *         retval = TupleProxy.__str__( self )             # <<<<<<<<<<<<<<
  *         self.nfields = save_fields
  *         return retval
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____str__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____str__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
   __Pyx_GIVEREF(__pyx_v_self);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_retval);
   __pyx_v_retval = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":561
+  /* "TabProxies.pyx":566
  *         self.nfields = self.bedfields
  *         retval = TupleProxy.__str__( self )
  *         self.nfields = save_fields             # <<<<<<<<<<<<<<
@@ -6193,7 +6332,7 @@ static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self)
  */
   ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields = __pyx_v_save_fields;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":562
+  /* "TabProxies.pyx":567
  *         retval = TupleProxy.__str__( self )
  *         self.nfields = save_fields
  *         return retval             # <<<<<<<<<<<<<<
@@ -6220,7 +6359,7 @@ static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":564
+/* "TabProxies.pyx":569
  *         return retval
  * 
  *     def __setattr__(self, key, value ):             # <<<<<<<<<<<<<<
@@ -6228,10 +6367,10 @@ static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self)
  *         if key == "start": self.start = value
  */
 
-static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
-static char __pyx_doc_10TabProxies_8BedProxy___setattr__[] = "set attribute.";
-struct wrapperbase __pyx_wrapperbase_10TabProxies_8BedProxy___setattr__;
-static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8BedProxy_1__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
+static char __pyx_doc_10TabProxies_8BedProxy_1__setattr__[] = "set attribute.";
+struct wrapperbase __pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__;
+static int __pyx_pf_10TabProxies_8BedProxy_1__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
   int __pyx_v_idx;
   PyObject *__pyx_v_f;
   int __pyx_r;
@@ -6245,57 +6384,57 @@ static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, P
   __Pyx_RefNannySetupContext("__setattr__");
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":566
+  /* "TabProxies.pyx":571
  *     def __setattr__(self, key, value ):
  *         '''set attribute.'''
  *         if key == "start": self.start = value             # <<<<<<<<<<<<<<
  *         elif key == "end": self.end = value
  * 
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__start), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__start), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
-    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->start = __pyx_t_3;
     goto __pyx_L5;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":567
+  /* "TabProxies.pyx":572
  *         '''set attribute.'''
  *         if key == "start": self.start = value
  *         elif key == "end": self.end = value             # <<<<<<<<<<<<<<
  * 
  *         cdef int idx
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__end), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__end), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
-    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->end = __pyx_t_3;
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":570
+  /* "TabProxies.pyx":575
  * 
  *         cdef int idx
  *         idx, f = self.map_key2field[key]             # <<<<<<<<<<<<<<
  *         TupleProxy._setindex(self, idx, str(value) )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
     PyObject* tuple = __pyx_t_4;
     __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -6304,16 +6443,16 @@ static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, P
     __pyx_v_f = __pyx_t_5;
     __pyx_t_5 = 0;
   } else {
-    __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __pyx_v_idx = __pyx_t_6;
     __Pyx_DECREF(__pyx_v_f);
@@ -6321,27 +6460,27 @@ static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, P
     __pyx_t_5 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":571
+  /* "TabProxies.pyx":576
  *         cdef int idx
  *         idx, f = self.map_key2field[key]
  *         TupleProxy._setindex(self, idx, str(value) )             # <<<<<<<<<<<<<<
  * 
  * cdef class VCFProxy( NamedTupleProxy ):
  */
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s___setindex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s___setindex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_value);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
   __Pyx_GIVEREF(__pyx_v_value);
-  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
   __Pyx_GIVEREF(__pyx_v_self);
@@ -6351,10 +6490,10 @@ static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, P
   __Pyx_GIVEREF(__pyx_t_7);
   __pyx_t_5 = 0;
   __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
   __pyx_r = 0;
@@ -6372,7 +6511,7 @@ static int __pyx_pf_10TabProxies_8BedProxy___setattr__(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":589
+/* "TabProxies.pyx":594
  *         'format' : (8,str) }
  * 
  *     def __cinit__(self ):             # <<<<<<<<<<<<<<
@@ -6388,7 +6527,7 @@ static int __pyx_pf_10TabProxies_8VCFProxy___cinit__(PyObject *__pyx_v_self, PyO
     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":592
+  /* "TabProxies.pyx":597
  *         # automatically calls TupleProxy.__cinit__
  *         # start indexed access at genotypes
  *         self.offset = 9             # <<<<<<<<<<<<<<
@@ -6402,7 +6541,7 @@ static int __pyx_pf_10TabProxies_8VCFProxy___cinit__(PyObject *__pyx_v_self, PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":594
+/* "TabProxies.pyx":599
  *         self.offset = 9
  * 
  *     cdef update( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -6415,18 +6554,18 @@ static  PyObject *__pyx_f_10TabProxies_8VCFProxy_update(struct __pyx_obj_10TabPr
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("update");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":599
+  /* "TabProxies.pyx":604
  *         nbytes does not include the terminal '\0'.
  *         '''
  *         TupleProxy.update( self, buffer, nbytes )             # <<<<<<<<<<<<<<
  * 
  *         self.contig = self.fields[0]
  */
-  __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":601
+  /* "TabProxies.pyx":606
  *         TupleProxy.update( self, buffer, nbytes )
  * 
  *         self.contig = self.fields[0]             # <<<<<<<<<<<<<<
@@ -6435,7 +6574,7 @@ static  PyObject *__pyx_f_10TabProxies_8VCFProxy_update(struct __pyx_obj_10TabPr
  */
   __pyx_v_self->contig = (__pyx_v_self->__pyx_base.__pyx_base.fields[0]);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":603
+  /* "TabProxies.pyx":608
  *         self.contig = self.fields[0]
  *         # vcf counts from 1 - correct here
  *         self.pos = atoi( self.fields[1] ) - 1             # <<<<<<<<<<<<<<
@@ -6456,7 +6595,7 @@ static  PyObject *__pyx_f_10TabProxies_8VCFProxy_update(struct __pyx_obj_10TabPr
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":605
+/* "TabProxies.pyx":610
  *         self.pos = atoi( self.fields[1] ) - 1
  * 
  *     def __len__(self):             # <<<<<<<<<<<<<<
@@ -6464,20 +6603,20 @@ static  PyObject *__pyx_f_10TabProxies_8VCFProxy_update(struct __pyx_obj_10TabPr
  * 
  */
 
-static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy___len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy___len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy_1__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy_1__len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   long __pyx_t_1;
   long __pyx_t_2;
   long __pyx_t_3;
   __Pyx_RefNannySetupContext("__len__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":606
+  /* "TabProxies.pyx":611
  * 
  *     def __len__(self):
  *         return max(0, self.nfields - 9)             # <<<<<<<<<<<<<<
  * 
- *     def __setattr__(self, key, value ):
+ *     property pos:
  */
   __pyx_t_1 = (((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields - 9);
   __pyx_t_2 = 0;
@@ -6495,18 +6634,58 @@ static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy___len__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":608
- *         return max(0, self.nfields - 9)
+/* "TabProxies.pyx":615
+ *     property pos:
+ *        '''feature end (in 0-based open/closed coordinates).'''
+ *        def __get__( self ):             # <<<<<<<<<<<<<<
+ *            return self.pos
+ * 
+ */
+
+static PyObject *__pyx_pf_10TabProxies_8VCFProxy_3pos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_10TabProxies_8VCFProxy_3pos___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_RefNannySetupContext("__get__");
+
+  /* "TabProxies.pyx":616
+ *        '''feature end (in 0-based open/closed coordinates).'''
+ *        def __get__( self ):
+ *            return self.pos             # <<<<<<<<<<<<<<
+ * 
+ *     def __setattr__(self, key, value ):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("TabProxies.VCFProxy.pos.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "TabProxies.pyx":618
+ *            return self.pos
  * 
  *     def __setattr__(self, key, value ):             # <<<<<<<<<<<<<<
  *         '''set attribute.'''
  *         if key == "pos":
  */
 
-static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
-static char __pyx_doc_10TabProxies_8VCFProxy___setattr__[] = "set attribute.";
-struct wrapperbase __pyx_wrapperbase_10TabProxies_8VCFProxy___setattr__;
-static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
+static int __pyx_pf_10TabProxies_8VCFProxy_2__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
+static char __pyx_doc_10TabProxies_8VCFProxy_2__setattr__[] = "set attribute.";
+struct wrapperbase __pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__;
+static int __pyx_pf_10TabProxies_8VCFProxy_2__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
   int __pyx_v_idx;
   PyObject *__pyx_v_f;
   int __pyx_r;
@@ -6521,37 +6700,37 @@ static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, P
   __Pyx_INCREF(__pyx_v_value);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":610
+  /* "TabProxies.pyx":620
  *     def __setattr__(self, key, value ):
  *         '''set attribute.'''
  *         if key == "pos":             # <<<<<<<<<<<<<<
  *             self.pos = value
  *             value += 1
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__pos), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__pos), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":611
+    /* "TabProxies.pyx":621
  *         '''set attribute.'''
  *         if key == "pos":
  *             self.pos = value             # <<<<<<<<<<<<<<
  *             value += 1
  * 
  */
-    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->pos = __pyx_t_3;
 
-    /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":612
+    /* "TabProxies.pyx":622
  *         if key == "pos":
  *             self.pos = value
  *             value += 1             # <<<<<<<<<<<<<<
  * 
  *         cdef int idx
  */
-    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_value, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_value, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_value);
     __pyx_v_value = __pyx_t_1;
@@ -6560,22 +6739,22 @@ static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, P
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":615
+  /* "TabProxies.pyx":625
  * 
  *         cdef int idx
  *         idx, f = self.map_key2field[key]             # <<<<<<<<<<<<<<
  *         TupleProxy._setindex(self, idx, str(value) )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
     PyObject* tuple = __pyx_t_4;
     __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -6584,16 +6763,16 @@ static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, P
     __pyx_v_f = __pyx_t_5;
     __pyx_t_5 = 0;
   } else {
-    __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __pyx_v_idx = __pyx_t_6;
     __Pyx_DECREF(__pyx_v_f);
@@ -6601,26 +6780,26 @@ static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, P
     __pyx_t_5 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":616
+  /* "TabProxies.pyx":626
  *         cdef int idx
  *         idx, f = self.map_key2field[key]
  *         TupleProxy._setindex(self, idx, str(value) )             # <<<<<<<<<<<<<<
  * 
  */
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s___setindex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s___setindex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_value);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
   __Pyx_GIVEREF(__pyx_v_value);
-  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
   __Pyx_GIVEREF(__pyx_v_self);
@@ -6630,10 +6809,10 @@ static int __pyx_pf_10TabProxies_8VCFProxy___setattr__(PyObject *__pyx_v_self, P
   __Pyx_GIVEREF(__pyx_t_7);
   __pyx_t_5 = 0;
   __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
   __pyx_r = 0;
@@ -6670,7 +6849,7 @@ static void __pyx_tp_dealloc_10TabProxies_TupleProxy(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_10TabProxies_10TupleProxy___dealloc__(o);
+    __pyx_pf_10TabProxies_10TupleProxy_1__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -6687,7 +6866,7 @@ static PyObject *__pyx_sq_item_10TabProxies_TupleProxy(PyObject *o, Py_ssize_t i
 
 static int __pyx_mp_ass_subscript_10TabProxies_TupleProxy(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_pf_10TabProxies_10TupleProxy___setitem__(o, i, v);
+    return __pyx_pf_10TabProxies_10TupleProxy_5__setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -6697,8 +6876,9 @@ static int __pyx_mp_ass_subscript_10TabProxies_TupleProxy(PyObject *o, PyObject
 }
 
 static PyMethodDef __pyx_methods_10TabProxies_TupleProxy[] = {
-  {__Pyx_NAMESTR("_setindex"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy__setindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy__setindex)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy___next__)},
+  {__Pyx_NAMESTR("_getindex"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy_2_getindex, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy_2_getindex)},
+  {__Pyx_NAMESTR("_setindex"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy_4_setindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy_4_setindex)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy_8__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy_8__next__)},
   {0, 0, 0, 0}
 };
 
@@ -6761,7 +6941,7 @@ static PyNumberMethods __pyx_tp_as_number_TupleProxy = {
 };
 
 static PySequenceMethods __pyx_tp_as_sequence_TupleProxy = {
-  __pyx_pf_10TabProxies_10TupleProxy___len__, /*sq_length*/
+  __pyx_pf_10TabProxies_10TupleProxy_6__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
   __pyx_sq_item_10TabProxies_TupleProxy, /*sq_item*/
@@ -6774,8 +6954,8 @@ static PySequenceMethods __pyx_tp_as_sequence_TupleProxy = {
 };
 
 static PyMappingMethods __pyx_tp_as_mapping_TupleProxy = {
-  __pyx_pf_10TabProxies_10TupleProxy___len__, /*mp_length*/
-  __pyx_pf_10TabProxies_10TupleProxy___getitem__, /*mp_subscript*/
+  __pyx_pf_10TabProxies_10TupleProxy_6__len__, /*mp_length*/
+  __pyx_pf_10TabProxies_10TupleProxy_3__getitem__, /*mp_subscript*/
   __pyx_mp_ass_subscript_10TabProxies_TupleProxy, /*mp_ass_subscript*/
 };
 
@@ -6800,7 +6980,7 @@ static PyBufferProcs __pyx_tp_as_buffer_TupleProxy = {
   #endif
 };
 
-PyTypeObject __pyx_type_10TabProxies_TupleProxy = {
+static PyTypeObject __pyx_type_10TabProxies_TupleProxy = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("TabProxies.TupleProxy"), /*tp_name*/
   sizeof(struct __pyx_obj_10TabProxies_TupleProxy), /*tp_basicsize*/
@@ -6820,18 +7000,18 @@ PyTypeObject __pyx_type_10TabProxies_TupleProxy = {
   &__pyx_tp_as_mapping_TupleProxy, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pf_10TabProxies_10TupleProxy___str__, /*tp_str*/
+  __pyx_pf_10TabProxies_10TupleProxy_9__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_TupleProxy, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("Proxy class for access to parsed row as a tuple.\n\n    This class represents a table row for fast read-access.\n\n    Access to individual fields is via the [] operator.\n    \n    Only read-only access is implemented.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_10TabProxies_10TupleProxy___iter__, /*tp_iter*/
-  __pyx_pf_10TabProxies_10TupleProxy___next__, /*tp_iternext*/
+  __pyx_pf_10TabProxies_10TupleProxy_7__iter__, /*tp_iter*/
+  __pyx_pf_10TabProxies_10TupleProxy_8__next__, /*tp_iternext*/
   __pyx_methods_10TabProxies_TupleProxy, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -6874,7 +7054,7 @@ static void __pyx_tp_dealloc_10TabProxies_GTFProxy(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_10TabProxies_8GTFProxy___dealloc__(o);
+    __pyx_pf_10TabProxies_8GTFProxy_1__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -6893,7 +7073,7 @@ static PyObject *__pyx_tp_getattro_10TabProxies_GTFProxy(PyObject *o, PyObject *
   PyObject *v = PyObject_GenericGetAttr(o, n);
   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
     PyErr_Clear();
-    v = __pyx_pf_10TabProxies_8GTFProxy___getattr__(o, n);
+    v = __pyx_pf_10TabProxies_8GTFProxy_8__getattr__(o, n);
   }
   return v;
 }
@@ -6904,7 +7084,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_contig(PyObject *o, void *
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_contig(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_6contig___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_6contig_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -6918,7 +7098,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_feature(PyObject *o, void
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_feature(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_7feature___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_7feature_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -6932,7 +7112,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_source(PyObject *o, void *
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_source(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_6source___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_6source_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -6946,7 +7126,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_start(PyObject *o, void *x
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_start(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_5start___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_5start_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -6960,7 +7140,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_end(PyObject *o, void *x)
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_end(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_3end___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_3end_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -6974,7 +7154,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_score(PyObject *o, void *x
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_score(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_5score___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_5score_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -6988,7 +7168,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_strand(PyObject *o, void *
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_strand(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_6strand___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_6strand_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -7002,7 +7182,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_frame(PyObject *o, void *x
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_frame(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_5frame___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_5frame_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -7016,7 +7196,7 @@ static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_attributes(PyObject *o, vo
 
 static int __pyx_setprop_10TabProxies_8GTFProxy_attributes(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pf_10TabProxies_8GTFProxy_10attributes___set__(o, v);
+    return __pyx_pf_10TabProxies_8GTFProxy_10attributes_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -7025,25 +7205,25 @@ static int __pyx_setprop_10TabProxies_8GTFProxy_attributes(PyObject *o, PyObject
 }
 
 static PyMethodDef __pyx_methods_10TabProxies_GTFProxy[] = {
-  {__Pyx_NAMESTR("asDict"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_asDict, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_asDict)},
-  {__Pyx_NAMESTR("fromDict"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_fromDict, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_fromDict)},
-  {__Pyx_NAMESTR("invert"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_invert, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_invert)},
-  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_keys)},
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy___getattr__)},
-  {__Pyx_NAMESTR("setAttribute"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_setAttribute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_setAttribute)},
+  {__Pyx_NAMESTR("asDict"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_2asDict, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_2asDict)},
+  {__Pyx_NAMESTR("fromDict"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_3fromDict, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_3fromDict)},
+  {__Pyx_NAMESTR("invert"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_5invert, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_5invert)},
+  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_6keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_6keys)},
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_8__getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_8__getattr__)},
+  {__Pyx_NAMESTR("setAttribute"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_9setAttribute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_9setAttribute)},
   {0, 0, 0, 0}
 };
 
 static struct PyGetSetDef __pyx_getsets_10TabProxies_GTFProxy[] = {
-  {(char *)"contig", __pyx_getprop_10TabProxies_8GTFProxy_contig, __pyx_setprop_10TabProxies_8GTFProxy_contig, __Pyx_DOCSTR(__pyx_k_19), 0},
-  {(char *)"feature", __pyx_getprop_10TabProxies_8GTFProxy_feature, __pyx_setprop_10TabProxies_8GTFProxy_feature, __Pyx_DOCSTR(__pyx_k_20), 0},
-  {(char *)"source", __pyx_getprop_10TabProxies_8GTFProxy_source, __pyx_setprop_10TabProxies_8GTFProxy_source, __Pyx_DOCSTR(__pyx_k_21), 0},
-  {(char *)"start", __pyx_getprop_10TabProxies_8GTFProxy_start, __pyx_setprop_10TabProxies_8GTFProxy_start, __Pyx_DOCSTR(__pyx_k_22), 0},
-  {(char *)"end", __pyx_getprop_10TabProxies_8GTFProxy_end, __pyx_setprop_10TabProxies_8GTFProxy_end, __Pyx_DOCSTR(__pyx_k_23), 0},
-  {(char *)"score", __pyx_getprop_10TabProxies_8GTFProxy_score, __pyx_setprop_10TabProxies_8GTFProxy_score, __Pyx_DOCSTR(__pyx_k_24), 0},
-  {(char *)"strand", __pyx_getprop_10TabProxies_8GTFProxy_strand, __pyx_setprop_10TabProxies_8GTFProxy_strand, __Pyx_DOCSTR(__pyx_k_25), 0},
-  {(char *)"frame", __pyx_getprop_10TabProxies_8GTFProxy_frame, __pyx_setprop_10TabProxies_8GTFProxy_frame, __Pyx_DOCSTR(__pyx_k_26), 0},
-  {(char *)"attributes", __pyx_getprop_10TabProxies_8GTFProxy_attributes, __pyx_setprop_10TabProxies_8GTFProxy_attributes, __Pyx_DOCSTR(__pyx_k_27), 0},
+  {(char *)"contig", __pyx_getprop_10TabProxies_8GTFProxy_contig, __pyx_setprop_10TabProxies_8GTFProxy_contig, __Pyx_DOCSTR(__pyx_k_33), 0},
+  {(char *)"feature", __pyx_getprop_10TabProxies_8GTFProxy_feature, __pyx_setprop_10TabProxies_8GTFProxy_feature, __Pyx_DOCSTR(__pyx_k_34), 0},
+  {(char *)"source", __pyx_getprop_10TabProxies_8GTFProxy_source, __pyx_setprop_10TabProxies_8GTFProxy_source, __Pyx_DOCSTR(__pyx_k_35), 0},
+  {(char *)"start", __pyx_getprop_10TabProxies_8GTFProxy_start, __pyx_setprop_10TabProxies_8GTFProxy_start, __Pyx_DOCSTR(__pyx_k_36), 0},
+  {(char *)"end", __pyx_getprop_10TabProxies_8GTFProxy_end, __pyx_setprop_10TabProxies_8GTFProxy_end, __Pyx_DOCSTR(__pyx_k_37), 0},
+  {(char *)"score", __pyx_getprop_10TabProxies_8GTFProxy_score, __pyx_setprop_10TabProxies_8GTFProxy_score, __Pyx_DOCSTR(__pyx_k_38), 0},
+  {(char *)"strand", __pyx_getprop_10TabProxies_8GTFProxy_strand, __pyx_setprop_10TabProxies_8GTFProxy_strand, __Pyx_DOCSTR(__pyx_k_39), 0},
+  {(char *)"frame", __pyx_getprop_10TabProxies_8GTFProxy_frame, __pyx_setprop_10TabProxies_8GTFProxy_frame, __Pyx_DOCSTR(__pyx_k_40), 0},
+  {(char *)"attributes", __pyx_getprop_10TabProxies_8GTFProxy_attributes, __pyx_setprop_10TabProxies_8GTFProxy_attributes, __Pyx_DOCSTR(__pyx_k_41), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -7120,7 +7300,7 @@ static PySequenceMethods __pyx_tp_as_sequence_GTFProxy = {
 
 static PyMappingMethods __pyx_tp_as_mapping_GTFProxy = {
   0, /*mp_length*/
-  __pyx_pf_10TabProxies_8GTFProxy___getitem__, /*mp_subscript*/
+  __pyx_pf_10TabProxies_8GTFProxy_7__getitem__, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
@@ -7145,7 +7325,7 @@ static PyBufferProcs __pyx_tp_as_buffer_GTFProxy = {
   #endif
 };
 
-PyTypeObject __pyx_type_10TabProxies_GTFProxy = {
+static PyTypeObject __pyx_type_10TabProxies_GTFProxy = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("TabProxies.GTFProxy"), /*tp_name*/
   sizeof(struct __pyx_obj_10TabProxies_GTFProxy), /*tp_basicsize*/
@@ -7165,11 +7345,11 @@ PyTypeObject __pyx_type_10TabProxies_GTFProxy = {
   &__pyx_tp_as_mapping_GTFProxy, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pf_10TabProxies_8GTFProxy___str__, /*tp_str*/
+  __pyx_pf_10TabProxies_8GTFProxy_4__str__, /*tp_str*/
   __pyx_tp_getattro_10TabProxies_GTFProxy, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_GTFProxy, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("Proxy class for access to GTF fields.\n\n    This class represents a GTF entry for fast read-access.\n    Write-access has been added as well, though some care must\n    be taken. If any of the string fields (contig, source, ...)\n    are set, the new value is tied to the lifetime of the\n    argument that was supplied.\n\n    The only exception is the attributes field when set from\n    a dictionary - this field will manage its own memory.\n\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
@@ -7215,7 +7395,7 @@ static PyObject *__pyx_tp_getattro_10TabProxies_NamedTupleProxy(PyObject *o, PyO
   PyObject *v = PyObject_GenericGetAttr(o, n);
   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
     PyErr_Clear();
-    v = __pyx_pf_10TabProxies_15NamedTupleProxy___getattr__(o, n);
+    v = __pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__(o, n);
   }
   return v;
 }
@@ -7232,7 +7412,7 @@ static int __pyx_tp_setattro_10TabProxies_NamedTupleProxy(PyObject *o, PyObject
 }
 
 static PyMethodDef __pyx_methods_10TabProxies_NamedTupleProxy[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_10TabProxies_15NamedTupleProxy___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
@@ -7334,7 +7514,7 @@ static PyBufferProcs __pyx_tp_as_buffer_NamedTupleProxy = {
   #endif
 };
 
-PyTypeObject __pyx_type_10TabProxies_NamedTupleProxy = {
+static PyTypeObject __pyx_type_10TabProxies_NamedTupleProxy = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("TabProxies.NamedTupleProxy"), /*tp_name*/
   sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), /*tp_basicsize*/
@@ -7358,7 +7538,7 @@ PyTypeObject __pyx_type_10TabProxies_NamedTupleProxy = {
   __pyx_tp_getattro_10TabProxies_NamedTupleProxy, /*tp_getattro*/
   __pyx_tp_setattro_10TabProxies_NamedTupleProxy, /*tp_setattro*/
   &__pyx_tp_as_buffer_NamedTupleProxy, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   0, /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
@@ -7402,7 +7582,7 @@ static PyObject *__pyx_tp_new_10TabProxies_BedProxy(PyTypeObject *t, PyObject *a
 
 static int __pyx_tp_setattro_10TabProxies_BedProxy(PyObject *o, PyObject *n, PyObject *v) {
   if (v) {
-    return __pyx_pf_10TabProxies_8BedProxy___setattr__(o, n, v);
+    return __pyx_pf_10TabProxies_8BedProxy_1__setattr__(o, n, v);
   }
   else {
     if (__pyx_ptype_10TabProxies_NamedTupleProxy->tp_setattro)
@@ -7513,7 +7693,7 @@ static PyBufferProcs __pyx_tp_as_buffer_BedProxy = {
   #endif
 };
 
-PyTypeObject __pyx_type_10TabProxies_BedProxy = {
+static PyTypeObject __pyx_type_10TabProxies_BedProxy = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("TabProxies.BedProxy"), /*tp_name*/
   sizeof(struct __pyx_obj_10TabProxies_BedProxy), /*tp_basicsize*/
@@ -7537,7 +7717,7 @@ PyTypeObject __pyx_type_10TabProxies_BedProxy = {
   0, /*tp_getattro*/
   __pyx_tp_setattro_10TabProxies_BedProxy, /*tp_setattro*/
   &__pyx_tp_as_buffer_BedProxy, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("Proxy class for access to Bed fields.\n\n    This class represents a GTF entry for fast read-access.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
@@ -7584,7 +7764,7 @@ static PyObject *__pyx_tp_new_10TabProxies_VCFProxy(PyTypeObject *t, PyObject *a
 
 static int __pyx_tp_setattro_10TabProxies_VCFProxy(PyObject *o, PyObject *n, PyObject *v) {
   if (v) {
-    return __pyx_pf_10TabProxies_8VCFProxy___setattr__(o, n, v);
+    return __pyx_pf_10TabProxies_8VCFProxy_2__setattr__(o, n, v);
   }
   else {
     if (__pyx_ptype_10TabProxies_NamedTupleProxy->tp_setattro)
@@ -7593,10 +7773,19 @@ static int __pyx_tp_setattro_10TabProxies_VCFProxy(PyObject *o, PyObject *n, PyO
   }
 }
 
+static PyObject *__pyx_getprop_10TabProxies_8VCFProxy_pos(PyObject *o, void *x) {
+  return __pyx_pf_10TabProxies_8VCFProxy_3pos___get__(o);
+}
+
 static PyMethodDef __pyx_methods_10TabProxies_VCFProxy[] = {
   {0, 0, 0, 0}
 };
 
+static struct PyGetSetDef __pyx_getsets_10TabProxies_VCFProxy[] = {
+  {(char *)"pos", __pyx_getprop_10TabProxies_8VCFProxy_pos, 0, __Pyx_DOCSTR(__pyx_k_37), 0},
+  {0, 0, 0, 0, 0}
+};
+
 static PyNumberMethods __pyx_tp_as_number_VCFProxy = {
   0, /*nb_add*/
   0, /*nb_subtract*/
@@ -7656,7 +7845,7 @@ static PyNumberMethods __pyx_tp_as_number_VCFProxy = {
 };
 
 static PySequenceMethods __pyx_tp_as_sequence_VCFProxy = {
-  __pyx_pf_10TabProxies_8VCFProxy___len__, /*sq_length*/
+  __pyx_pf_10TabProxies_8VCFProxy_1__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
   0, /*sq_item*/
@@ -7669,7 +7858,7 @@ static PySequenceMethods __pyx_tp_as_sequence_VCFProxy = {
 };
 
 static PyMappingMethods __pyx_tp_as_mapping_VCFProxy = {
-  __pyx_pf_10TabProxies_8VCFProxy___len__, /*mp_length*/
+  __pyx_pf_10TabProxies_8VCFProxy_1__len__, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
@@ -7695,7 +7884,7 @@ static PyBufferProcs __pyx_tp_as_buffer_VCFProxy = {
   #endif
 };
 
-PyTypeObject __pyx_type_10TabProxies_VCFProxy = {
+static PyTypeObject __pyx_type_10TabProxies_VCFProxy = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("TabProxies.VCFProxy"), /*tp_name*/
   sizeof(struct __pyx_obj_10TabProxies_VCFProxy), /*tp_basicsize*/
@@ -7719,7 +7908,7 @@ PyTypeObject __pyx_type_10TabProxies_VCFProxy = {
   0, /*tp_getattro*/
   __pyx_tp_setattro_10TabProxies_VCFProxy, /*tp_setattro*/
   &__pyx_tp_as_buffer_VCFProxy, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("Proxy class for access to VCF fields.\n\n    The genotypes are accessed via index.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
@@ -7729,7 +7918,7 @@ PyTypeObject __pyx_type_10TabProxies_VCFProxy = {
   0, /*tp_iternext*/
   __pyx_methods_10TabProxies_VCFProxy, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_10TabProxies_VCFProxy, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -7752,8 +7941,6 @@ PyTypeObject __pyx_type_10TabProxies_VCFProxy = {
 };
 
 static PyMethodDef __pyx_methods[] = {
-  {__Pyx_NAMESTR("toDot"), (PyCFunction)__pyx_pf_10TabProxies_toDot, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_toDot)},
-  {__Pyx_NAMESTR("quote"), (PyCFunction)__pyx_pf_10TabProxies_quote, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_quote)},
   {0, 0, 0, 0}
 };
 
@@ -7774,59 +7961,41 @@ static struct PyModuleDef __pyx_moduledef = {
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
   {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
-  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
-  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
-  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
   {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
-  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
   {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
   {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
   {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
   {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
-  {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
-  {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
+  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
+  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
+  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
+  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
+  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
+  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
   {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
-  {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
-  {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
-  {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
-  {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0},
-  {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
-  {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0},
-  {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
-  {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0},
-  {&__pyx_kp_u_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0, 0},
-  {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0},
-  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
-  {&__pyx_kp_u_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0, 0},
-  {&__pyx_kp_u_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 1, 0, 0},
-  {&__pyx_kp_u_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0, 0},
+  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
+  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
   {&__pyx_kp_s_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_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
-  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
   {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
-  {&__pyx_n_s__BedProxy, __pyx_k__BedProxy, sizeof(__pyx_k__BedProxy), 0, 0, 1, 1},
-  {&__pyx_n_s__GTFProxy, __pyx_k__GTFProxy, sizeof(__pyx_k__GTFProxy), 0, 0, 1, 1},
   {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
   {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
-  {&__pyx_n_s__NamedTupleProxy, __pyx_k__NamedTupleProxy, sizeof(__pyx_k__NamedTupleProxy), 0, 0, 1, 1},
   {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
   {&__pyx_n_s__StringType, __pyx_k__StringType, sizeof(__pyx_k__StringType), 0, 0, 1, 1},
   {&__pyx_n_s__StringTypes, __pyx_k__StringTypes, sizeof(__pyx_k__StringTypes), 0, 0, 1, 1},
-  {&__pyx_n_s__TupleProxy, __pyx_k__TupleProxy, sizeof(__pyx_k__TupleProxy), 0, 0, 1, 1},
+  {&__pyx_n_s__TabProxies, __pyx_k__TabProxies, sizeof(__pyx_k__TabProxies), 0, 0, 1, 1},
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
-  {&__pyx_n_s__VCFProxy, __pyx_k__VCFProxy, sizeof(__pyx_k__VCFProxy), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____getattr__, __pyx_k____getattr__, sizeof(__pyx_k____getattr__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
-  {&__pyx_n_s____next__, __pyx_k____next__, sizeof(__pyx_k____next__), 0, 0, 1, 1},
-  {&__pyx_n_s____setattr__, __pyx_k____setattr__, sizeof(__pyx_k____setattr__), 0, 0, 1, 1},
   {&__pyx_n_s____setitem__, __pyx_k____setitem__, sizeof(__pyx_k____setitem__), 0, 0, 1, 1},
   {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
+  {&__pyx_n_s___getindex, __pyx_k___getindex, sizeof(__pyx_k___getindex), 0, 0, 1, 1},
   {&__pyx_n_s___setindex, __pyx_k___setindex, sizeof(__pyx_k___setindex), 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__asDict, __pyx_k__asDict, sizeof(__pyx_k__asDict), 0, 0, 1, 1},
   {&__pyx_n_s__attributes, __pyx_k__attributes, sizeof(__pyx_k__attributes), 0, 0, 1, 1},
   {&__pyx_n_s__bedfields, __pyx_k__bedfields, sizeof(__pyx_k__bedfields), 0, 0, 1, 1},
@@ -7846,13 +8015,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__hasOwnAttributes, __pyx_k__hasOwnAttributes, sizeof(__pyx_k__hasOwnAttributes), 0, 0, 1, 1},
   {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
   {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
+  {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1},
   {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1},
-  {&__pyx_n_s__invert, __pyx_k__invert, sizeof(__pyx_k__invert), 0, 0, 1, 1},
   {&__pyx_n_s__is_modified, __pyx_k__is_modified, sizeof(__pyx_k__is_modified), 0, 0, 1, 1},
   {&__pyx_n_s__itemRGB, __pyx_k__itemRGB, sizeof(__pyx_k__itemRGB), 0, 0, 1, 1},
   {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 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__map_key2field, __pyx_k__map_key2field, sizeof(__pyx_k__map_key2field), 0, 0, 1, 1},
   {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
   {&__pyx_n_s__nbytes, __pyx_k__nbytes, sizeof(__pyx_k__nbytes), 0, 0, 1, 1},
@@ -7864,7 +8032,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__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__score, __pyx_k__score, sizeof(__pyx_k__score), 0, 0, 1, 1},
-  {&__pyx_n_s__setAttribute, __pyx_k__setAttribute, sizeof(__pyx_k__setAttribute), 0, 0, 1, 1},
   {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1},
   {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
   {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
@@ -7882,41 +8049,225 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
 static int __Pyx_InitCachedBuiltins(void) {
   __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
 }
 
-static int __Pyx_InitGlobals(void) {
-  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
+static int __Pyx_InitCachedConstants(void) {
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
 
-#if PY_MAJOR_VERSION < 3
-PyMODINIT_FUNC initTabProxies(void); /*proto*/
+  /* "TabProxies.pyx":77
+ *         self.data = <char*>malloc( s )
+ *         if self.data == NULL:
+ *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
+ *         self.nbytes = nbytes
+ *         memcpy( <char*>self.data, buffer, s )
+ */
+  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+
+  /* "TabProxies.pyx":119
+ *         self.fields = <char **>calloc( max_fields, sizeof(char *) )
+ *         if self.fields == NULL:
+ *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
+ * 
+ *         #################################
+ */
+  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+
+  /* "TabProxies.pyx":148
+ *         cdef int i = index
+ *         if i < 0: i += self.nfields
+ *         if i < 0: raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
+ *         i += self.offset
+ *         if i >= self.nfields:
+ */
+  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
+  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
+
+  /* "TabProxies.pyx":166
+ *         '''set item at idx index.'''
+ *         cdef int idx = index
+ *         if idx < 0: raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
+ *         if idx >= self.nfields:
+ *             raise IndexError( "list index out of range" )
+ */
+  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
+  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
+
+  /* "TabProxies.pyx":168
+ *         if idx < 0: raise IndexError( "list index out of range" )
+ *         if idx >= self.nfields:
+ *             raise IndexError( "list index out of range" )             # <<<<<<<<<<<<<<
+ * 
+ *         if isNew( self.fields[idx], self.data, self.nbytes ):
+ */
+  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
+  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+
+  /* "TabProxies.pyx":183
+ *         self.fields[idx] = <char*>malloc( (strlen( tmp ) + 1) * sizeof(char) )
+ *         if self.fields[idx] == NULL:
+ *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
+ *         strcpy( self.fields[idx], tmp )
+ * 
+ */
+  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+
+  /* "TabProxies.pyx":220
+ *             cpy = <char*>calloc( sizeof(char), self.nbytes+1 )
+ *             if cpy == NULL:
+ *                 raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
+ *             memcpy( cpy, self.data, self.nbytes+1)
+ *             for x from 0 <= x < self.nbytes:
+ */
+  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
+
+  /* "TabProxies.pyx":368
+ * 
+ *         # separate into fields
+ *         fields = [ x.strip() for x in attributes.split(";")[:-1]]             # <<<<<<<<<<<<<<
+ * 
+ *         result = {}
+ */
+  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
+  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
+
+  /* "TabProxies.pyx":374
+ *         for f in fields:
+ * 
+ *             d = [ x.strip() for x in f.split(" ")]             # <<<<<<<<<<<<<<
+ * 
+ *             n,v = d[0], d[1]
+ */
+  __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
+  PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+
+  /* "TabProxies.pyx":416
+ *         self.attributes = <char *>calloc( l + 1, sizeof(char) )
+ *         if self.attributes == NULL:
+ *             raise ValueError("out of memory" )             # <<<<<<<<<<<<<<
+ *         memcpy( self.attributes, p, l )
+ * 
+ */
+  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+
+  /* "TabProxies.pyx":454
+ *         '''return a list of attributes defined in this entry.'''
+ *         r = self.attributes
+ *         return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ]             # <<<<<<<<<<<<<<
+ * 
+ *     def __getitem__(self, key):
+ */
+  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
+  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_18));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
+  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
+  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_20));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
+
+  /* "TabProxies.pyx":543
+ * 
+ *         if self.nfields < 3:
+ *             raise ValueError( "bed format requires at least three columns" )             # <<<<<<<<<<<<<<
+ * 
+ *         # determines bed format
+ */
+  __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+  __Pyx_RefNannyFinishContext();
+  return 0;
+  __pyx_L1_error:;
+  __Pyx_RefNannyFinishContext();
+  return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initTabProxies(void); /*proto*/
 PyMODINIT_FUNC initTabProxies(void)
 #else
 PyMODINIT_FUNC PyInit_TabProxies(void); /*proto*/
@@ -7925,7 +8276,6 @@ PyMODINIT_FUNC PyInit_TabProxies(void)
 {
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
   #if CYTHON_REFNANNY
   void* __pyx_refnanny = NULL;
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -7969,46 +8319,40 @@ PyMODINIT_FUNC PyInit_TabProxies(void)
   }
   /*--- Builtin init code ---*/
   if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Constants init code ---*/
+  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Global init code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
   __pyx_vtabptr_10TabProxies_TupleProxy = &__pyx_vtable_10TabProxies_TupleProxy;
-  #if PY_MAJOR_VERSION >= 3
   __pyx_vtable_10TabProxies_TupleProxy.getMaxFields = (int (*)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t))__pyx_f_10TabProxies_10TupleProxy_getMaxFields;
   __pyx_vtable_10TabProxies_TupleProxy.take = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_take;
   __pyx_vtable_10TabProxies_TupleProxy.present = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_present;
   __pyx_vtable_10TabProxies_TupleProxy.copy = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_copy;
   __pyx_vtable_10TabProxies_TupleProxy.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_update;
-  #else
-  *(void(**)(void))&__pyx_vtable_10TabProxies_TupleProxy.getMaxFields = (void(*)(void))__pyx_f_10TabProxies_10TupleProxy_getMaxFields;
-  *(void(**)(void))&__pyx_vtable_10TabProxies_TupleProxy.take = (void(*)(void))__pyx_f_10TabProxies_10TupleProxy_take;
-  *(void(**)(void))&__pyx_vtable_10TabProxies_TupleProxy.present = (void(*)(void))__pyx_f_10TabProxies_10TupleProxy_present;
-  *(void(**)(void))&__pyx_vtable_10TabProxies_TupleProxy.copy = (void(*)(void))__pyx_f_10TabProxies_10TupleProxy_copy;
-  *(void(**)(void))&__pyx_vtable_10TabProxies_TupleProxy.update = (void(*)(void))__pyx_f_10TabProxies_10TupleProxy_update;
-  #endif
   if (PyType_Ready(&__pyx_type_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_TupleProxy, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_10TabProxies_10TupleProxy___setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_10TabProxies_10TupleProxy___setitem__.doc = __pyx_doc_10TabProxies_10TupleProxy___setitem__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy___setitem__;
+      __pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__.doc = __pyx_doc_10TabProxies_10TupleProxy_5__setitem__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__;
     }
   }
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_TupleProxy, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_10TabProxies_10TupleProxy___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_10TabProxies_10TupleProxy___next__.doc = __pyx_doc_10TabProxies_10TupleProxy___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy___next__;
+      __pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__.doc = __pyx_doc_10TabProxies_10TupleProxy_8__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__;
     }
   }
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_TupleProxy, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_10TabProxies_10TupleProxy___str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_10TabProxies_10TupleProxy___str__.doc = __pyx_doc_10TabProxies_10TupleProxy___str__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy___str__;
+      __pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__.doc = __pyx_doc_10TabProxies_10TupleProxy_9__str__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_10TabProxies_TupleProxy.tp_dict, __pyx_vtabptr_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8016,89 +8360,76 @@ PyMODINIT_FUNC PyInit_TabProxies(void)
   __pyx_ptype_10TabProxies_TupleProxy = &__pyx_type_10TabProxies_TupleProxy;
   __pyx_vtabptr_10TabProxies_GTFProxy = &__pyx_vtable_10TabProxies_GTFProxy;
   __pyx_vtable_10TabProxies_GTFProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy;
-  #if PY_MAJOR_VERSION >= 3
   __pyx_vtable_10TabProxies_GTFProxy.__pyx_base.getMaxFields = (int (*)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t))__pyx_f_10TabProxies_8GTFProxy_getMaxFields;
   __pyx_vtable_10TabProxies_GTFProxy.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_8GTFProxy_update;
-  #else
-  *(void(**)(void))&__pyx_vtable_10TabProxies_GTFProxy.__pyx_base.getMaxFields = (void(*)(void))__pyx_f_10TabProxies_8GTFProxy_getMaxFields;
-  *(void(**)(void))&__pyx_vtable_10TabProxies_GTFProxy.__pyx_base.update = (void(*)(void))__pyx_f_10TabProxies_8GTFProxy_update;
-  #endif
   __pyx_type_10TabProxies_GTFProxy.tp_base = __pyx_ptype_10TabProxies_TupleProxy;
-  if (PyType_Ready(&__pyx_type_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_GTFProxy, "__getattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_GTFProxy, "__getattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_10TabProxies_8GTFProxy___getattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_10TabProxies_8GTFProxy___getattr__.doc = __pyx_doc_10TabProxies_8GTFProxy___getattr__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8GTFProxy___getattr__;
+      __pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__.doc = __pyx_doc_10TabProxies_8GTFProxy_8__getattr__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__;
     }
   }
-  if (__Pyx_SetVtable(__pyx_type_10TabProxies_GTFProxy.tp_dict, __pyx_vtabptr_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "GTFProxy", (PyObject *)&__pyx_type_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_10TabProxies_GTFProxy.tp_dict, __pyx_vtabptr_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "GTFProxy", (PyObject *)&__pyx_type_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_10TabProxies_GTFProxy = &__pyx_type_10TabProxies_GTFProxy;
   __pyx_vtabptr_10TabProxies_NamedTupleProxy = &__pyx_vtable_10TabProxies_NamedTupleProxy;
   __pyx_vtable_10TabProxies_NamedTupleProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy;
   __pyx_type_10TabProxies_NamedTupleProxy.tp_base = __pyx_ptype_10TabProxies_TupleProxy;
-  if (PyType_Ready(&__pyx_type_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_NamedTupleProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_NamedTupleProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
       __pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
       __pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__.doc = __pyx_doc_10TabProxies_15NamedTupleProxy___setattr__;
       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__;
     }
   }
-  if (__Pyx_SetVtable(__pyx_type_10TabProxies_NamedTupleProxy.tp_dict, __pyx_vtabptr_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "NamedTupleProxy", (PyObject *)&__pyx_type_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_10TabProxies_NamedTupleProxy.tp_dict, __pyx_vtabptr_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "NamedTupleProxy", (PyObject *)&__pyx_type_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_10TabProxies_NamedTupleProxy = &__pyx_type_10TabProxies_NamedTupleProxy;
   __pyx_vtabptr_10TabProxies_BedProxy = &__pyx_vtable_10TabProxies_BedProxy;
   __pyx_vtable_10TabProxies_BedProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
-  #if PY_MAJOR_VERSION >= 3
   __pyx_vtable_10TabProxies_BedProxy.__pyx_base.__pyx_base.getMaxFields = (int (*)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t))__pyx_f_10TabProxies_8BedProxy_getMaxFields;
   __pyx_vtable_10TabProxies_BedProxy.__pyx_base.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_8BedProxy_update;
-  #else
-  *(void(**)(void))&__pyx_vtable_10TabProxies_BedProxy.__pyx_base.__pyx_base.getMaxFields = (void(*)(void))__pyx_f_10TabProxies_8BedProxy_getMaxFields;
-  *(void(**)(void))&__pyx_vtable_10TabProxies_BedProxy.__pyx_base.__pyx_base.update = (void(*)(void))__pyx_f_10TabProxies_8BedProxy_update;
-  #endif
   __pyx_type_10TabProxies_BedProxy.tp_base = __pyx_ptype_10TabProxies_NamedTupleProxy;
-  if (PyType_Ready(&__pyx_type_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_BedProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_BedProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_10TabProxies_8BedProxy___setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_10TabProxies_8BedProxy___setattr__.doc = __pyx_doc_10TabProxies_8BedProxy___setattr__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8BedProxy___setattr__;
+      __pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__.doc = __pyx_doc_10TabProxies_8BedProxy_1__setattr__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__;
     }
   }
-  if (__Pyx_SetVtable(__pyx_type_10TabProxies_BedProxy.tp_dict, __pyx_vtabptr_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "BedProxy", (PyObject *)&__pyx_type_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_10TabProxies_BedProxy.tp_dict, __pyx_vtabptr_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "BedProxy", (PyObject *)&__pyx_type_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_10TabProxies_BedProxy = &__pyx_type_10TabProxies_BedProxy;
   __pyx_vtabptr_10TabProxies_VCFProxy = &__pyx_vtable_10TabProxies_VCFProxy;
   __pyx_vtable_10TabProxies_VCFProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
-  #if PY_MAJOR_VERSION >= 3
   __pyx_vtable_10TabProxies_VCFProxy.__pyx_base.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_8VCFProxy_update;
-  #else
-  *(void(**)(void))&__pyx_vtable_10TabProxies_VCFProxy.__pyx_base.__pyx_base.update = (void(*)(void))__pyx_f_10TabProxies_8VCFProxy_update;
-  #endif
   __pyx_type_10TabProxies_VCFProxy.tp_base = __pyx_ptype_10TabProxies_NamedTupleProxy;
-  if (PyType_Ready(&__pyx_type_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_VCFProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_VCFProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_10TabProxies_8VCFProxy___setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_10TabProxies_8VCFProxy___setattr__.doc = __pyx_doc_10TabProxies_8VCFProxy___setattr__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8VCFProxy___setattr__;
+      __pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__.doc = __pyx_doc_10TabProxies_8VCFProxy_2__setattr__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__;
     }
   }
-  if (__Pyx_SetVtable(__pyx_type_10TabProxies_VCFProxy.tp_dict, __pyx_vtabptr_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "VCFProxy", (PyObject *)&__pyx_type_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_10TabProxies_VCFProxy.tp_dict, __pyx_vtabptr_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "VCFProxy", (PyObject *)&__pyx_type_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_10TabProxies_VCFProxy = &__pyx_type_10TabProxies_VCFProxy;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":1
+  /* "TabProxies.pyx":1
  * import types             # <<<<<<<<<<<<<<
  * from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING
  * 
@@ -8108,578 +8439,458 @@ PyMODINIT_FUNC PyInit_TabProxies(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":490
+  /* "TabProxies.pyx":228
+ *             return result
+ * 
+ * def toDot( v ):             # <<<<<<<<<<<<<<
+ *     '''convert value to '.' if None'''
+ *     if v == None: return "."
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10TabProxies_toDot, NULL, __pyx_n_s__TabProxies); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__toDot, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "TabProxies.pyx":233
+ *     else: return str(v)
+ * 
+ * def quote( v ):             # <<<<<<<<<<<<<<
+ *     '''return a quoted attribute.'''
+ *     if type(v) in types.StringTypes:
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10TabProxies_1quote, NULL, __pyx_n_s__TabProxies); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__quote, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "TabProxies.pyx":495
  * cdef class NamedTupleProxy( TupleProxy ):
  * 
  *     map_key2field = {}             # <<<<<<<<<<<<<<
  * 
  *     def __setattr__(self, key, value ):
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   PyType_Modified(__pyx_ptype_10TabProxies_NamedTupleProxy);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":512
+  /* "TabProxies.pyx":517
  *     This class represents a GTF entry for fast read-access.
  *     '''
  *     map_key2field = {             # <<<<<<<<<<<<<<
  *         'contig' : (0, str),
  *         'start' : (1, int),
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":513
+  /* "TabProxies.pyx":518
  *     '''
  *     map_key2field = {
  *         'contig' : (0, str),             # <<<<<<<<<<<<<<
  *         'start' : (1, int),
  *         'end' : (2, int),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__contig), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__contig), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":514
+  /* "TabProxies.pyx":519
  *     map_key2field = {
  *         'contig' : (0, str),
  *         'start' : (1, int),             # <<<<<<<<<<<<<<
  *         'end' : (2, int),
  *         'name' : (3, str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__start), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__start), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":515
+  /* "TabProxies.pyx":520
  *         'contig' : (0, str),
  *         'start' : (1, int),
  *         'end' : (2, int),             # <<<<<<<<<<<<<<
  *         'name' : (3, str),
  *         'score' : (4, float),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_2);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
   __Pyx_GIVEREF(__pyx_int_2);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__end), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__end), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":516
+  /* "TabProxies.pyx":521
  *         'start' : (1, int),
  *         'end' : (2, int),
  *         'name' : (3, str),             # <<<<<<<<<<<<<<
  *         'score' : (4, float),
  *         'strand' : (5, str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_3);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
   __Pyx_GIVEREF(__pyx_int_3);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__name), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":517
+  /* "TabProxies.pyx":522
  *         'end' : (2, int),
  *         'name' : (3, str),
  *         'score' : (4, float),             # <<<<<<<<<<<<<<
  *         'strand' : (5, str),
  *         'thickStart' : (6,int ),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_4);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_4);
   __Pyx_GIVEREF(__pyx_int_4);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyFloat_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__score), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyFloat_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__score), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":518
+  /* "TabProxies.pyx":523
  *         'name' : (3, str),
  *         'score' : (4, float),
  *         'strand' : (5, str),             # <<<<<<<<<<<<<<
  *         'thickStart' : (6,int ),
  *         'thickEnd' : (7,int),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_5);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_5);
   __Pyx_GIVEREF(__pyx_int_5);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__strand), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__strand), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":519
+  /* "TabProxies.pyx":524
  *         'score' : (4, float),
  *         'strand' : (5, str),
  *         'thickStart' : (6,int ),             # <<<<<<<<<<<<<<
  *         'thickEnd' : (7,int),
  *         'itemRGB' : (8,str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_6);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_6);
   __Pyx_GIVEREF(__pyx_int_6);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__thickStart), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__thickStart), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":520
+  /* "TabProxies.pyx":525
  *         'strand' : (5, str),
  *         'thickStart' : (6,int ),
  *         'thickEnd' : (7,int),             # <<<<<<<<<<<<<<
  *         'itemRGB' : (8,str),
  *         'blockCount': (9,int),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_7);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_7);
   __Pyx_GIVEREF(__pyx_int_7);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__thickEnd), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__thickEnd), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":521
+  /* "TabProxies.pyx":526
  *         'thickStart' : (6,int ),
  *         'thickEnd' : (7,int),
  *         'itemRGB' : (8,str),             # <<<<<<<<<<<<<<
  *         'blockCount': (9,int),
  *         'blockSizes': (10,str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_8);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_8);
   __Pyx_GIVEREF(__pyx_int_8);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__itemRGB), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__itemRGB), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":522
+  /* "TabProxies.pyx":527
  *         'thickEnd' : (7,int),
  *         'itemRGB' : (8,str),
  *         'blockCount': (9,int),             # <<<<<<<<<<<<<<
  *         'blockSizes': (10,str),
  *         'blockStarts': (11,str), }
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_9);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_9);
   __Pyx_GIVEREF(__pyx_int_9);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockCount), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockCount), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":523
+  /* "TabProxies.pyx":528
  *         'itemRGB' : (8,str),
  *         'blockCount': (9,int),
  *         'blockSizes': (10,str),             # <<<<<<<<<<<<<<
  *         'blockStarts': (11,str), }
  * 
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_10);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_10);
   __Pyx_GIVEREF(__pyx_int_10);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockSizes), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockSizes), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":524
+  /* "TabProxies.pyx":529
  *         'blockCount': (9,int),
  *         'blockSizes': (10,str),
  *         'blockStarts': (11,str), }             # <<<<<<<<<<<<<<
  * 
  *     cdef int getMaxFields( self, size_t nbytes ):
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_11);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_11);
   __Pyx_GIVEREF(__pyx_int_11);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockStarts), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_BedProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockStarts), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_BedProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   PyType_Modified(__pyx_ptype_10TabProxies_BedProxy);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":578
+  /* "TabProxies.pyx":583
  *     The genotypes are accessed via index.
  *     '''
  *     map_key2field = {             # <<<<<<<<<<<<<<
  *         'contig' : (0, str),
  *         'pos' : (1, int),
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":579
+  /* "TabProxies.pyx":584
  *     '''
  *     map_key2field = {
  *         'contig' : (0, str),             # <<<<<<<<<<<<<<
  *         'pos' : (1, int),
  *         'id' : (2, str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__contig), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__contig), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":580
+  /* "TabProxies.pyx":585
  *     map_key2field = {
  *         'contig' : (0, str),
  *         'pos' : (1, int),             # <<<<<<<<<<<<<<
  *         'id' : (2, str),
  *         'ref' : (3, str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyInt_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyInt_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":581
+  /* "TabProxies.pyx":586
  *         'contig' : (0, str),
  *         'pos' : (1, int),
  *         'id' : (2, str),             # <<<<<<<<<<<<<<
  *         'ref' : (3, str),
  *         'alt' : (4, str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_2);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
   __Pyx_GIVEREF(__pyx_int_2);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__id), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":582
+  /* "TabProxies.pyx":587
  *         'pos' : (1, int),
  *         'id' : (2, str),
  *         'ref' : (3, str),             # <<<<<<<<<<<<<<
  *         'alt' : (4, str),
  *         'qual' : (5, str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_3);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
   __Pyx_GIVEREF(__pyx_int_3);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ref), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ref), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":583
+  /* "TabProxies.pyx":588
  *         'id' : (2, str),
  *         'ref' : (3, str),
  *         'alt' : (4, str),             # <<<<<<<<<<<<<<
  *         'qual' : (5, str),
  *         'filter' : (6,str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_4);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_4);
   __Pyx_GIVEREF(__pyx_int_4);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__alt), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__alt), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":584
+  /* "TabProxies.pyx":589
  *         'ref' : (3, str),
  *         'alt' : (4, str),
  *         'qual' : (5, str),             # <<<<<<<<<<<<<<
  *         'filter' : (6,str),
  *         'info' : (7,str),
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_5);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_5);
   __Pyx_GIVEREF(__pyx_int_5);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":585
+  /* "TabProxies.pyx":590
  *         'alt' : (4, str),
  *         'qual' : (5, str),
  *         'filter' : (6,str),             # <<<<<<<<<<<<<<
  *         'info' : (7,str),
  *         'format' : (8,str) }
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_6);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_6);
   __Pyx_GIVEREF(__pyx_int_6);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__filter), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__filter), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":586
+  /* "TabProxies.pyx":591
  *         'qual' : (5, str),
  *         'filter' : (6,str),
  *         'info' : (7,str),             # <<<<<<<<<<<<<<
  *         'format' : (8,str) }
  * 
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_7);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_7);
   __Pyx_GIVEREF(__pyx_int_7);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__info), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":587
+  /* "TabProxies.pyx":592
  *         'filter' : (6,str),
  *         'info' : (7,str),
  *         'format' : (8,str) }             # <<<<<<<<<<<<<<
  * 
  *     def __cinit__(self ):
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_8);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_8);
   __Pyx_GIVEREF(__pyx_int_8);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__format), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_VCFProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_VCFProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   PyType_Modified(__pyx_ptype_10TabProxies_VCFProxy);
 
-  /* "/ifs/devel/pysam/pysam/pysam/TabProxies.pyx":1
+  /* "TabProxies.pyx":1
  * import types             # <<<<<<<<<<<<<<
  * from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING
  * 
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TupleProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___setindex); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_28), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TupleProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____setitem__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_29), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TupleProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____next__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_30), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TupleProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____str__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_31), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__toDot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_32), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__quote); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_33), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GTFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asDict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_34), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GTFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fromDict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_35), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GTFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__invert); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_36), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GTFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__keys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_37), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GTFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____getattr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_38), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GTFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setAttribute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_39), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__NamedTupleProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____setattr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_40), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__BedProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____setattr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_41), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCFProxy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____setattr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_42), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/Cython-0.13-py2.7-linux-x86_64.egg/Cython/Includes/cpython/type.pxd":2
+  /* "cpython/type.pxd":2
  * 
  * cdef extern from "Python.h":             # <<<<<<<<<<<<<<
  *     # The C structure of the objects used to describe built-in types.
@@ -8689,7 +8900,6 @@ PyMODINIT_FUNC PyInit_TabProxies(void)
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   if (__pyx_m) {
     __Pyx_AddTraceback("init TabProxies");
     Py_DECREF(__pyx_m); __pyx_m = 0;
@@ -8715,6 +8925,143 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     return result;
 }
 
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+
+    tmp_type = tstate->curexc_type;
+    tmp_value = tstate->curexc_value;
+    tmp_tb = tstate->curexc_traceback;
+    tstate->curexc_type = type;
+    tstate->curexc_value = value;
+    tstate->curexc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+}
+
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->curexc_type;
+    *value = tstate->curexc_value;
+    *tb = tstate->curexc_traceback;
+
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+}
+
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    Py_XINCREF(type);
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    /* Next, replace a missing value with None */
+    if (value == NULL) {
+        value = Py_None;
+        Py_INCREF(value);
+    }
+    #if PY_VERSION_HEX < 0x02050000
+    if (!PyClass_Check(type))
+    #else
+    if (!PyType_Check(type))
+    #endif
+    {
+        /* Raising an instance.  The value should be a dummy. */
+        if (value != Py_None) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto raise_error;
+        }
+        /* Normalize to raise <class>, <instance> */
+        Py_DECREF(value);
+        value = type;
+        #if PY_VERSION_HEX < 0x02050000
+            if (PyInstance_Check(type)) {
+                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+                Py_INCREF(type);
+            }
+            else {
+                type = 0;
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception must be an old-style class or instance");
+                goto raise_error;
+            }
+        #else
+            type = (PyObject*) Py_TYPE(type);
+            Py_INCREF(type);
+            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception class must be a subclass of BaseException");
+                goto raise_error;
+            }
+        #endif
+    }
+
+    __Pyx_ErrRestore(type, value, tb);
+    return;
+raise_error:
+    Py_XDECREF(value);
+    Py_XDECREF(type);
+    Py_XDECREF(tb);
+    return;
+}
+
+#else /* Python 3+ */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    if (tb == Py_None) {
+        tb = 0;
+    } else if (tb && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto bad;
+    }
+    if (value == Py_None)
+        value = 0;
+
+    if (PyExceptionInstance_Check(type)) {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto bad;
+        }
+        value = type;
+        type = (PyObject*) Py_TYPE(value);
+    } else if (!PyExceptionClass_Check(type)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: exception class must be a subclass of BaseException");
+        goto bad;
+    }
+
+    PyErr_SetObject(type, value);
+
+    if (tb) {
+        PyThreadState *tstate = PyThreadState_GET();
+        PyObject* tmp_tb = tstate->curexc_traceback;
+        if (tb != tmp_tb) {
+            Py_INCREF(tb);
+            tstate->curexc_traceback = tb;
+            Py_XDECREF(tmp_tb);
+        }
+    }
+
+bad:
+    return;
+}
+#endif
+
 static void __Pyx_RaiseArgtupleInvalid(
     const char* func_name,
     int exact,
@@ -8779,6 +9126,48 @@ invalid_keyword:
     return 0;
 }
 
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
+    PyErr_Format(PyExc_ValueError,
+        #if PY_VERSION_HEX < 0x02050000
+                 "need more than %d value%s to unpack", (int)index,
+        #else
+                 "need more than %zd value%s to unpack", index,
+        #endif
+                 (index == 1) ? "" : "s");
+}
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+        #if PY_VERSION_HEX < 0x02050000
+            "too many values to unpack (expected %d)", (int)expected);
+        #else
+            "too many values to unpack (expected %zd)", expected);
+        #endif
+}
+
+static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
+    PyObject *item;
+    if (!(item = PyIter_Next(iter))) {
+        if (!PyErr_Occurred()) {
+            __Pyx_RaiseNeedMoreValuesError(index);
+        }
+    }
+    return item;
+}
+
+static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
+    PyObject *item;
+    if ((item = PyIter_Next(iter))) {
+        Py_DECREF(item);
+        __Pyx_RaiseTooManyValuesError(expected);
+        return -1;
+    }
+    else if (!PyErr_Occurred())
+        return 0;
+    else
+        return -1;
+}
+
 static void __Pyx_RaiseDoubleKeywordsError(
     const char* func_name,
     PyObject* kw_name)
@@ -8899,48 +9288,6 @@ bad:
     return (double)-1;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
-    PyErr_Format(PyExc_ValueError,
-        #if PY_VERSION_HEX < 0x02050000
-                 "need more than %d value%s to unpack", (int)index,
-        #else
-                 "need more than %zd value%s to unpack", index,
-        #endif
-                 (index == 1) ? "" : "s");
-}
-
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
-    PyErr_Format(PyExc_ValueError,
-        #if PY_VERSION_HEX < 0x02050000
-            "too many values to unpack (expected %d)", (int)expected);
-        #else
-            "too many values to unpack (expected %zd)", expected);
-        #endif
-}
-
-static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
-    PyObject *item;
-    if (!(item = PyIter_Next(iter))) {
-        if (!PyErr_Occurred()) {
-            __Pyx_RaiseNeedMoreValuesError(index);
-        }
-    }
-    return item;
-}
-
-static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
-    PyObject *item;
-    if ((item = PyIter_Next(iter))) {
-        Py_DECREF(item);
-        __Pyx_RaiseTooManyValuesError(expected);
-        return -1;
-    }
-    else if (!PyErr_Occurred())
-        return 0;
-    else
-        return -1;
-}
-
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
@@ -8998,143 +9345,6 @@ bad:
     return module;
 }
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-
-    tmp_type = tstate->curexc_type;
-    tmp_value = tstate->curexc_value;
-    tmp_tb = tstate->curexc_traceback;
-    tstate->curexc_type = type;
-    tstate->curexc_value = value;
-    tstate->curexc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-}
-
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->curexc_type;
-    *value = tstate->curexc_value;
-    *tb = tstate->curexc_traceback;
-
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-}
-
-
-#if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    Py_XINCREF(type);
-    Py_XINCREF(value);
-    Py_XINCREF(tb);
-    /* First, check the traceback argument, replacing None with NULL. */
-    if (tb == Py_None) {
-        Py_DECREF(tb);
-        tb = 0;
-    }
-    else if (tb != NULL && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto raise_error;
-    }
-    /* Next, replace a missing value with None */
-    if (value == NULL) {
-        value = Py_None;
-        Py_INCREF(value);
-    }
-    #if PY_VERSION_HEX < 0x02050000
-    if (!PyClass_Check(type))
-    #else
-    if (!PyType_Check(type))
-    #endif
-    {
-        /* Raising an instance.  The value should be a dummy. */
-        if (value != Py_None) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto raise_error;
-        }
-        /* Normalize to raise <class>, <instance> */
-        Py_DECREF(value);
-        value = type;
-        #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
-            Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
-        #endif
-    }
-
-    __Pyx_ErrRestore(type, value, tb);
-    return;
-raise_error:
-    Py_XDECREF(value);
-    Py_XDECREF(type);
-    Py_XDECREF(tb);
-    return;
-}
-
-#else /* Python 3+ */
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    if (tb == Py_None) {
-        tb = 0;
-    } else if (tb && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto bad;
-    }
-    if (value == Py_None)
-        value = 0;
-
-    if (PyExceptionInstance_Check(type)) {
-        if (value) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto bad;
-        }
-        value = type;
-        type = (PyObject*) Py_TYPE(value);
-    } else if (!PyExceptionClass_Check(type)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: exception class must be a subclass of BaseException");
-        goto bad;
-    }
-
-    PyErr_SetObject(type, value);
-
-    if (tb) {
-        PyThreadState *tstate = PyThreadState_GET();
-        PyObject* tmp_tb = tstate->curexc_traceback;
-        if (tb != tmp_tb) {
-            Py_INCREF(tb);
-            tstate->curexc_traceback = tb;
-            Py_XDECREF(tmp_tb);
-        }
-    }
-
-bad:
-    return;
-}
-#endif
-
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -9675,13 +9885,13 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     if (!result)
         goto bad;
     if (!PyType_Check(result)) {
-        PyErr_Format(PyExc_TypeError, 
+        PyErr_Format(PyExc_TypeError,
             "%s.%s is not a type object",
             module_name, class_name);
         goto bad;
     }
     if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
-        PyOS_snprintf(warning, sizeof(warning), 
+        PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
         #if PY_VERSION_HEX < 0x02050000
@@ -9691,7 +9901,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         #endif
     }
     else if (((PyTypeObject *)result)->tp_basicsize != size) {
-        PyErr_Format(PyExc_ValueError, 
+        PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
         goto bad;
index 32597af090b33ad5c474c0231b4e940c073818c7..cf11852644eccc583eb5e735961c3987be1f5652 100644 (file)
@@ -51,6 +51,7 @@ cdef class TupleProxy:
         cdef bint is_modified
 
     cdef int getMaxFields( self, size_t nbytes )
+#    cdef char * _getindex( self, int idx )
 
     cdef take( self, char * buffer, size_t nbytes )
     cdef present( self, char * buffer, size_t nbytes )
index 36295ebe12ccba9584b2b30be907fe848601f537..6e3a866d07c212b148cb7c4835a862ba85842ced 100644 (file)
@@ -141,16 +141,25 @@ cdef class TupleProxy:
 
         self.nfields = field
 
-    def __getitem__( self, key ):
-
-        cdef int i = key
+    def _getindex( self, int index ):
+        '''return item at idx index'''
+        cdef int i = index
         if i < 0: i += self.nfields
         if i < 0: raise IndexError( "list index out of range" )
         i += self.offset
         if i >= self.nfields:
-            raise IndexError( "list index out of range)
+            raise IndexError( "list index out of range %i >= %i" % (i, self.nfields ))
         return self.fields[i]
 
+    def __getitem__( self, key ):
+        if type(key) == int: return self._getindex( key )
+        # slice object
+        start, end, step = key.indices( self.nfields )
+        result = []
+        for index in range( start, end, step ):
+            result.append( self._getindex( index ) )
+        return result
+
     def _setindex( self, index, value ):
         '''set item at idx index.'''
         cdef int idx = index
@@ -279,7 +288,8 @@ cdef class GTFProxy( TupleProxy ):
 
         self.start = atoi( cstart ) - 1
         self.end = atoi( cend )
-                      
+        self.nfields = 9
+       
     property contig:
        '''contig of feature.'''
        def __get__( self ): return self.contig
@@ -443,8 +453,8 @@ cdef class GTFProxy( TupleProxy ):
         r = self.attributes
         return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ]
 
-    def __getitem__(self, item):
-        return self.__getattr__( item )
+    def __getitem__(self, key):
+        return self.__getattr__( key )
 
     def __getattr__(self, item ):
         """Generic lookup of attribute from GFF/GTF attributes 
@@ -463,18 +473,13 @@ cdef class GTFProxy( TupleProxy ):
 
         start += strlen(query) + 1
         # skip gaps before
-        while start[0] == " ": start += 1
+        while start[0] == ' ': start += 1
         if start[0] == '"':
             start += 1
             end = start
             while end[0] != '\0' and end[0] != '"': end += 1
-            l = end - start + 1
-            cpy = <char*>calloc( l, sizeof(char ) )
-            if cpy == NULL: raise ValueError("out of memory" )
-            memcpy( cpy, start, l )
-            cpy[l-1] = '\0'
-            result = cpy
-            free(cpy)
+            l = end - start
+            result = PyString_FromStringAndSize( start, l )
             return result
         else:
             return start
@@ -601,10 +606,15 @@ cdef class VCFProxy( NamedTupleProxy ):
         self.contig = self.fields[0]
         # vcf counts from 1 - correct here
         self.pos = atoi( self.fields[1] ) - 1
-
+                             
     def __len__(self):
         return max(0, self.nfields - 9)
 
+    property pos:
+       '''feature end (in 0-based open/closed coordinates).'''
+       def __get__( self ): 
+           return self.pos
+
     def __setattr__(self, key, value ):
         '''set attribute.'''
         if key == "pos": 
@@ -614,4 +624,4 @@ cdef class VCFProxy( NamedTupleProxy ):
         cdef int idx
         idx, f = self.map_key2field[key]
         TupleProxy._setindex(self, idx, str(value) )
-    
+
diff --git a/pysam/VCF.py b/pysam/VCF.py
deleted file mode 100644 (file)
index 115aa2b..0000000
+++ /dev/null
@@ -1,1088 +0,0 @@
-#
-# Code to read, write and edit VCF files
-#
-# VCF lines are encoded as a dictionary with these keys (note: all lowercase):
-# 'chrom':  string
-# 'pos':    integer
-# 'id':     string
-# 'ref':    string
-# 'alt':    list of strings
-# 'qual':   integer
-# 'filter': None (missing value), or list of keys (strings); empty list parsed as ["PASS"]
-# 'info':   dictionary of values (see below)
-# 'format': list of keys (strings)
-# sample keys: dictionary of values (see below)
-#
-# The sample keys are accessible through vcf.getsamples()
-#
-# A dictionary of values contains value keys (defined in ##INFO or ##FORMAT lines) which map
-# to a list, containign integers, floats, strings, or characters.  Missing values are replaced 
-# by a particular value, often -1 or .
-#
-# Genotypes are not stored as a string, but as a list of 1 or 3 elements (for haploid and diploid samples),
-# the first (and last) the integer representing an allele, and the second the separation character.
-# Note that there is just one genotype per sample, but for consistency the single element is stored in a list.
-#
-# Header lines other than ##INFO, ##FORMAT and ##FILTER are stored as (key, value) pairs and are accessible
-# through getheader()
-#
-# The VCF class can be instantiated with a 'regions' variable consisting of tuples (chrom,start,end) encoding
-# 0-based half-open segments.  Only variants with a position inside the segment will be parsed.  A regions
-# parser is available under parse_regions.
-#
-# When instantiated, a reference can be passed to the VCF class.  This may be any class that supports a
-# fetch(chrom, start, end) method.
-#
-#
-#
-# NOTE: the position that is returned to Python is 0-based, NOT 1-based as in the VCF file.
-#
-#
-#
-# TODO:
-#  only v4.0 writing is complete; alleles are not converted to v3.3 format
-#
-
-from collections import namedtuple, defaultdict
-from operator import itemgetter
-import sys, re, copy, bisect
-
-import pysam
-
-gtsRegEx = re.compile("[|/\\\\]")
-alleleRegEx = re.compile('^[ACGTN]+$')
-
-# Utility function.  Uses 0-based coordinates
-def get_sequence(chrom, start, end, fa):
-    # obtain sequence from .fa file, without truncation
-    if end<=start: return ""
-    if not fa: return "N"*(end-start)
-    if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper()
-    sequence = fa.fetch(chrom, start, end).upper()
-    if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))
-    return sequence
-
-# Utility function.  Parses a region string
-def parse_regions( string ):
-    result = []
-    for r in string.split(','):
-        elts = r.split(':')
-        chrom, start, end = elts[0], 0, 3000000000
-        if len(elts)==1: pass
-        elif len(elts)==2:
-            if len(elts[1])>0:
-                ielts = elts[1].split('-')
-                if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
-                try:    start, end = int(ielts[0])-1, int(ielts[1])
-                except: raise ValueError("Don't understand region string '%s'" % r)
-        else:
-            raise ValueError("Don't understand region string '%s'" % r)
-        result.append( (chrom,start,end) )
-    return result
-            
-
-FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue')
-
-###########################################################################################################
-# 
-# New class
-# 
-###########################################################################################################
-
-class VCFRecord:
-    '''vcf record.
-
-    initialized from data and vcf meta 
-    '''
-    
-    data = None
-    vcf = None
-
-    def __init__(self, data, vcf):
-        self.data, self.vcf = data, vcf
-
-        if len(data) != len(self.vcf._samples):
-            self.error(str(data),
-                       self.BAD_NUMBER_OF_COLUMNS, 
-                       "expected %s for %s samples (%s), got %s" % \
-                           (len(self.vcf._samples), 
-                            len(self.vcf._samples), 
-                            self.vcf._samples, 
-                            len(data)))
-        
-    property contig:
-    def contig( self ): return self.data[0]
-
-    property pos:
-    def __get__( self ): 
-            return self.data.pos
-        
-    property id:
-        def __get__( self ): return self.data[2]
-
-    property ref:
-        def __get__(self ): 
-            # note: gerton substitutes reference if it can be fixed.
-            return self.data[3].upper()
-
-    property alt:
-        def __get__(self):
-            # convert v3.3 to v4.0 alleles below
-            alt = self.data[4] 
-            if alt == ".": alt = []
-            else: alt = alt.upper().split(',')
-            return alt
-
-    property qual:
-        def __get__(self):
-            qual = self.data[5]
-            if qual == ".": qual = -1
-            else: 
-                try:    qual = float(qual)
-                except: self.error(line,self.QUAL_NOT_NUMERICAL)
-
-    property filter:
-        def __get__(self):
-            # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
-            if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []
-            else: filter = cols[6].split(';')
-
-            return filter
-
-    property info:
-        def __get__(self):
-            col = self.data[7]
-            # dictionary of keys, and list of values
-            info = {}
-            if col != ".":
-                for blurp in col.split(';'):
-                    elts = blurp.split('=')
-                    if len(elts) == 1: v = None
-                    elif len(elts) == 2: v = elts[1]
-                    else: self.error(str(self.data),self.ERROR_INFO_STRING)
-                    info[elts[0]] = self.parse_formatdata(elts[0], v, self.vcf._info, line)
-            return info
-
-    property format:
-         def __get__(self):
-             return self.data[8].split(':')
-
-    def __getitem__(self, key):
-        
-        # parse sample columns
-        values = self.data[self.vcf._sample2column[key]].split(':')
-        alt = self.alt
-        format = self.format
-
-        if len(values) > len(format):
-            self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
-
-        result = {}
-        for idx in range(len(format)):
-            expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)
-            if idx < len(values): value = values[idx]
-            else:
-                if expected == -1: value = "."
-                else: value = ",".join(["."]*expected)
-
-            result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, line)
-            if expected != -1 and len(result[format[idx]]) != expected:
-                self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS,
-                           "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))
-                if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]]))
-                result[format[idx]] = result[format[idx]][:expected]
-
-        return result
-    def __str__(self):
-        return str(self.data)
-
-class VCF:
-
-    # types
-    NT_UNKNOWN = 0
-    NT_NUMBER = 1
-    NT_ALLELES = 2
-    NT_NR_ALLELES = 3
-    NT_GENOTYPES = 4
-    NT_PHASED_GENOTYPES = 5
-
-    _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier",
-                1:"BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string",
-                2:"BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s",
-                3:"BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)",
-                4:"POS_NOT_NUMERICAL:Position column is not numerical",
-                5:"UNKNOWN_CHAR_IN_REF:Unknown character in reference field",
-                6:"V33_BAD_REF:Reference should be single-character in v3.3 VCF",
-                7:"V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF",
-                8:"POS_NOT_POSITIVE:Position field must be >0",
-                9:"QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'",
-               10:"ERROR_INFO_STRING:Error while parsing info field",
-               11:"ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)",
-               12:"ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s",
-               13:"ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string",
-               14:"FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header",
-               15:"FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header",
-               16:"BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)",
-               17:"BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)",
-               18:"BAD_GENOTYPE:Cannot parse genotype (%s)",
-               19:"V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)",
-               20:"MISSING_REF:Reference allele missing",
-               21:"V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)",
-               22:"V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets",
-               23:"FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes",
-               24:"V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields",
-               25:"HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs",
-               26:"WRONG_REF:Wrong reference %s",
-               27:"ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data",
-               28:"BAD_CHR_TAG:Error calculating chr tag for %s",
-               29:"ZERO_LENGTH_ALLELE:Found zero-length allele",
-               30:"MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base"
-                }
-
-    # tag-value pairs; tags are not unique; does not include fileformat, INFO, FILTER or FORMAT fields
-    _header = []
-
-    # version number; 33=v3.3; 40=v4.0
-    _version = 40
-
-    # info, filter and format data
-    _info = {}
-    _filter = {}
-    _format = {}
-
-    # header; and required columns
-    _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"]
-    _samples = []
-
-    # control behaviour
-    _ignored_errors = set([11])   # ERROR_UNKNOWN_KEY
-    _warn_errors = set([])
-    _leftalign = False
-
-    # reference sequence
-    _reference = None
-
-    # regions to include; None includes everything
-    _regions = None
-
-    # statefull stuff
-    _lineno = -1
-    _line = None
-    _lines = None
-
-    def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):
-        # make error identifiers accessible by name
-        for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
-        if _copy != None:
-            self._leftalign = _copy._leftalign
-            self._header = _copy._header[:]
-            self._version = _copy._version
-            self._info = copy.deepcopy(_copy._info)
-            self._filter = copy.deepcopy(_copy._filter)
-            self._format = copy.deepcopy(_copy._format)
-            self._samples = _copy._samples[:]
-            self._sample2column = copy.deepcopy(_copy._sample2column)
-            self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
-            self._warn_errors = copy.deepcopy(_copy._warn_errors)
-            self._reference = _copy._reference
-            self._regions = _copy._regions
-        if reference: self._reference = reference
-        if regions: self._regions = regions
-        if leftalign: self._leftalign = leftalign
-        self._lines = lines
-
-    def error(self,line,error,opt=None):
-        if error in self._ignored_errors: return
-        errorlabel, errorstring = self._errors[error].split(':')
-        if opt: errorstring = errorstring % opt
-        errwarn = ["Error","Warning"][error in self._warn_errors]
-        sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring))
-        if error in self._warn_errors: return
-        raise ValueError(errorstring)
-
-    def parse_format(self,line,format,filter=False):
-        if self._version == 40:
-            if not format.startswith('<'): 
-                self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
-                format = "<"+format
-            if not format.endswith('>'): 
-                self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
-                format += ">"
-            format = format[1:-1]
-        data = {'id':None,'number':None,'type':None,'descr':None}
-        idx = 0
-        while len(format.strip())>0:
-            elts = format.strip().split(',')
-            first, rest = elts[0], ','.join(elts[1:])
-            if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):
-                if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
-                if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-                first = ["ID=","Number=","Type=","Description="][idx] + first
-            if first.startswith('ID='):            data['id'] = first.split('=')[1]
-            elif first.startswith('Number='):      data['number'] = first.split('=')[1]
-            elif first.startswith('Type='):        data['type'] = first.split('=')[1]
-            elif first.startswith('Description='):
-                elts = format.split('"')
-                if len(elts)<3: 
-                    self.error(line,self.FORMAT_MISSING_QUOTES)
-                    elts = first.split('=') + [rest] 
-                data['descr'] = elts[1]
-                rest = '"'.join(elts[2:])
-                if rest.startswith(','): rest = rest[1:]
-            else:
-                self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-            format = rest
-            idx += 1
-            if filter and idx==1: idx=3  # skip number and type fields for FILTER format strings
-        if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        if not data['descr']: 
-            self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-            data['descr'] = '<none>'
-        if not data['type'] and not data['number']:
-            # fine, ##filter format
-            return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')
-        if not data['type'] in ["Integer","Float","Character","String","Flag"]:
-            self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        # I would like a missing-value field, but it isn't there
-        if data['type'] in ['Integer','Float']: data['missing'] = None    # Do NOT use arbitrary int/float as missing value
-        else:                                   data['missing'] = '.'
-        if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        try:
-            n = int(data['number'])
-            t = self.NT_NUMBER
-        except ValueError:
-            n = -1
-            if data['number'] == '.':                   t = self.NT_UNKNOWN
-            elif data['number'] == '#alleles':          t = self.NT_ALLELES
-            elif data['number'] == '#nonref_alleles':   t = self.NT_NR_ALLELES
-            elif data['number'] == '#genotypes':        t = self.NT_GENOTYPES
-            elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
-            else:
-                self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing'])
-    
-
-    def format_format( self, fmt, filter=False ):
-        values = [('ID',fmt.id)]
-        if fmt.number != None and not filter:
-            if fmt.numbertype == self.NT_UNKNOWN: nmb = "."
-            elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number)
-            elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles"
-            elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles"
-            elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes"
-            elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes"
-            else:
-                raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)
-            values.append( ('Number',nmb) )
-            values.append( ('Type', fmt.type) )
-        values.append( ('Description', '"' + fmt.description + '"') )
-        if self._version == 33:
-            format = ",".join(v for k,v in values)
-        else:
-            format = "<" + (",".join( "%s=%s" % (k,v) for (k,v) in values )) + ">"
-        return format
-
-    def get_expected(self, format, formatdict, alt):
-        fmt = formatdict[format]
-        if fmt.numbertype == self.NT_UNKNOWN: return -1
-        if fmt.numbertype == self.NT_NUMBER: return fmt.number
-        if fmt.numbertype == self.NT_ALLELES: return len(alt)+1
-        if fmt.numbertype == self.NT_NR_ALLELES: return len(alt)
-        if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2
-        if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1)
-        return 0
-
-
-    def _add_definition(self, formatdict, key, data, line ):
-        if key in formatdict: return
-        self.error(line,self.ERROR_UNKNOWN_KEY,key)
-        if data == None:
-            formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
-            return
-        if data == []: data = [""]             # unsure what type -- say string
-        if type(data[0]) == type(0.0):
-            formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)
-            return
-        if type(data[0]) == type(0):
-            formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)
-            return
-        formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".")
-
-
-    # todo: trim trailing missing values
-    def format_formatdata( self, data, format, key=True, value=True, separator=":" ):
-        output, sdata = [], []
-        if type(data) == type([]): # for FORMAT field, make data with dummy values
-            d = {}
-            for k in data: d[k] = []
-            data = d
-        # convert missing values; and silently add definitions if required
-        for k in data:
-            self._add_definition( format, k, data[k], "(output)" )
-            for idx,v in enumerate(data[k]):
-                if v == format[k].missingvalue: data[k][idx] = "."
-        # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string
-        for k in data: 
-            if k != 'GT': sdata.append( (k,data[k]) )
-        sdata.sort()
-        if 'GT' in data:
-            sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
-        for k,v in sdata:
-            if v == []: v = None
-            if key and value:
-                if v != None: output.append( k+"="+','.join(map(str,v)) )
-                else: output.append( k )
-            elif key: output.append(k)
-            elif value:
-                if v != None: output.append( ','.join(map(str,v)) )
-                else: output.append( "." )                    # should not happen
-        # snip off trailing missing data
-        while len(output) > 1:
-            last = output[-1].replace(',','').replace('.','')
-            if len(last)>0: break
-            output = output[:-1]
-        return separator.join(output)
-
-
-    def enter_default_format(self):
-        for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
-                  FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
-                  FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
-                  FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid
-                  FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]:
-            if f.id not in self._format:
-                self._format[f.id] = f
-
-    def parse_header( self, line ):
-        assert line.startswith('##')
-        elts = line[2:].split('=')
-        key = elts[0].strip()
-        value = '='.join(elts[1:]).strip()
-        if key == "fileformat":
-            if value == "VCFv3.3":
-                self._version = 33
-            elif value == "VCFv4.0":
-                self._version = 40
-            elif value == "VCFv4.1":
-                # AH - for testing
-                self._version = 40
-            else:
-                self.error(line,self.UNKNOWN_FORMAT_STRING)
-        elif key == "INFO":
-            f = self.parse_format(line, value)
-            self._info[ f.id ] = f
-        elif key == "FILTER":
-            f = self.parse_format(line, value, filter=True)
-            self._filter[ f.id ] = f
-        elif key == "FORMAT":
-            f = self.parse_format(line, value)
-            self._format[ f.id ] = f
-        else:
-            # keep other keys in the header field
-            self._header.append( (key,value) )
-
-
-    def write_header( self, stream ):
-        stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))
-        for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
-        for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]:
-            for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER"))))
-        
-
-    def parse_heading( self, line ):
-        assert line.startswith('#')
-        assert not line.startswith('##')
-        headings = line[1:].split('\t')
-        if len(headings)==1 and len(line[1:].split()) >= 9:
-            self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
-            headings = line[1:].split()
-
-        for i,s in enumerate(self._required):
-
-            if len(headings)<=i or headings[i] != s:
-
-                if len(headings) <= i: 
-                    err = "(%sth entry not found)" % (i+1)
-                else:
-                    err = "(found %s, expected %s)" % (headings[i],s)
-
-                #self.error(line,self.BADLY_FORMATTED_HEADING,err)
-
-                # allow FORMAT column to be absent
-                if len(headings) == 8:
-                    headings.append("FORMAT")
-                else:
-                    self.error(line,self.BADLY_FORMATTED_HEADING,err)
-
-        self._samples = headings[9:]
-        self._sample2column = dict( [(y,x) for x,y in enumerate( self._samples ) ] )
-                           
-    def write_heading( self, stream ):
-        stream.write("#" + "\t".join(self._required + self._samples) + "\n")
-
-    def convertGT(self, GTstring):
-        if GTstring == ".": return ["."]
-        try:
-            gts = gtsRegEx.split(GTstring)
-            if len(gts) == 1: return [int(gts[0])]
-            if len(gts) != 2: raise ValueError()
-            if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
-            return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
-        except ValueError:
-            self.error(self._line,self.BAD_GENOTYPE,GTstring)
-            return [".","|","."]
-
-
-    def convertGTback(self, GTdata):
-        return ''.join(map(str,GTdata))
-
-    def parse_formatdata( self, key, value, formatdict, line ):
-        # To do: check that the right number of values is present
-        f = formatdict.get(key,None)
-        if f == None:
-            self._add_definition(formatdict, key, value, line )
-            f = formatdict[key]
-        if f.type == "Flag":
-            if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
-            return []
-        values = value.split(',')
-        # deal with trailing data in some early VCF files
-        if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
-            self.error(line,self.ERROR_TRAILING_DATA,values[-1])
-            values[-1] = values[-1].split(';')[0]
-        if f.type == "Integer": 
-            for idx,v in enumerate(values):
-                try:
-                    if v == ".": values[idx] = f.missingvalue
-                    else:        values[idx] = int(v)
-                except: 
-                    self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
-                    return [0] * len(values)
-            return values
-        elif f.type == "String":
-            self._line = line
-            if f.id == "GT": values = map( self.convertGT, values )
-            return values
-        elif f.type == "Character":
-            for v in values: 
-                if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
-            return values
-        elif f.type == "Float":
-            for idx,v in enumerate(values):
-                if v == ".": values[idx] = f.missingvalue
-            try: return map(float,values)
-            except:
-                self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
-                return [0.0] * len(values)
-        else:
-            # can't happen
-            self.error(line,self.ERROR_INFO_STRING)
-
-
-    def inregion(self, chrom, pos):
-        if not self._regions: return True
-        for r in self._regions:
-            if r[0] == chrom and r[1] <= pos < r[2]: return True
-        return False
-        
-
-    def parse_data( self, line, lineparse=False ):
-        cols = line.split('\t')
-        if len(cols) != len(self._samples)+9:
-            # gracefully deal with absent FORMAT column
-            if len(cols) == 8 and len(self._samples)==0:
-                cols.append("")
-            else:
-                self.error(line,
-                           self.BAD_NUMBER_OF_COLUMNS, 
-                           "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))
-
-        chrom = cols[0]
-
-        # get 0-based position
-        try:    pos = int(cols[1])-1
-        except: self.error(line,self.POS_NOT_NUMERICAL)
-        if pos < 0: self.error(line,self.POS_NOT_POSITIVE)
-
-        # implement filtering
-        if not self.inregion(chrom,pos): return None
-
-        # end of first-pass parse for sortedVCF
-        if lineparse: return chrom, pos, line
-        
-        id = cols[2]
-
-        ref = cols[3].upper()
-        if ref == ".":
-            self.error(line,self.MISSING_REF)
-            if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
-            else:                   ref = ""
-        else:
-            for c in ref:
-                if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF)
-            if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference)
-
-        # make sure reference is sane
-        if self._reference:
-            left = max(0,pos-100)
-            faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference)
-            faref = faref_leftflank[pos-left:]
-            if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
-            ref = faref
-
-        # convert v3.3 to v4.0 alleles below
-        if cols[4] == ".": alt = []
-        else: alt = cols[4].upper().split(',')
-
-        if cols[5] == ".": qual = -1
-        else: 
-            try:    qual = float(cols[5])
-            except: self.error(line,self.QUAL_NOT_NUMERICAL)
-
-        # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
-        if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []
-        else: filter = cols[6].split(';')
-
-        # dictionary of keys, and list of values
-        info = {}
-        if cols[7] != ".":
-            for blurp in cols[7].split(';'):
-                elts = blurp.split('=')
-                if len(elts) == 1: v = None
-                elif len(elts) == 2: v = elts[1]
-                else: self.error(line,self.ERROR_INFO_STRING)
-                info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line)
-
-        # Gracefully deal with absent FORMAT column
-        if cols[8] == "": format = []
-        else: format = cols[8].split(':')
-
-        # check: all filters are defined
-        for f in filter:
-            if f not in self._filter: self.error(line,self.FILTER_NOT_DEFINED, f)
-            
-        # check: format fields are defined
-        for f in format:
-            if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f)
-
-        # convert v3.3 alleles
-        if self._version == 33:
-            if len(ref) != 1: self.error(line,self.V33_BAD_REF)
-            newalts = []
-            have_deletions = False
-            for a in alt:
-                if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
-                elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
-                elif a.startswith('D'): # allow D<seq> and D<num>
-                    have_deletions = True
-                    try:
-                        l = int(a[1:])          # throws ValueError if sequence
-                        if len(ref) < l:        # add to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[l:]             # new deletion, deleting pos...pos+l
-                    except ValueError:
-                        s = a[1:]
-                        if len(ref) < len(s):   # add Ns to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
-                            if not s.endswith(addns) and addns != 'N'*len(addns):
-                                self.error(line,self.V33_UNMATCHED_DELETION,
-                                           "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[len(s):]        # new deletion, deleting from pos
-                else:
-                    self.error(line,self.V33_BAD_ALLELE)
-                newalts.append(a)
-            alt = newalts
-            # deletion alleles exist, add dummy 1st reference allele, and account for leading base
-            if have_deletions:
-                if pos == 0:
-                    # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
-                    addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
-                    ref += addn
-                    alt = [allele+addn for allele in alt]
-                else:
-                    addn = get_sequence(chrom,pos-1,pos,self._reference)
-                    ref = addn + ref
-                    alt = [addn + allele for allele in alt]
-                    pos -= 1
-        else:
-            # format v4.0 -- just check for nucleotides
-            for allele in alt:
-                if not alleleRegEx.match(allele):
-                    self.error(line,self.V40_BAD_ALLELE,allele)
-
-        # check for leading nucleotide in indel calls
-        for allele in alt:
-            if len(allele) != len(ref):
-                if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
-                if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
-                    self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
-
-        # trim trailing bases in alleles
-        for i in range(1,min(len(ref),min(map(len,alt)))):
-            if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
-                break
-            ref, alt = ref[:-1], [allele[:-1] for allele in alt]
-
-        # left-align alleles, if a reference is available
-        if self._leftalign and self._reference:
-            while left < pos:
-                movable = True
-                for allele in alt:
-                    if len(allele) > len(ref):
-                        longest, shortest = allele, ref
-                    else:
-                        longest, shortest = ref, allele
-                    if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
-                        movable = False
-                    if longest[-1].upper() != longest[len(shortest)-1].upper():
-                        movable = False
-                if not movable:
-                    break
-                ref = ref[:-1]
-                alt = [allele[:-1] for allele in alt]
-                if min(len(allele) for allele in alt) == 0 or len(ref) == 0:
-                    ref = faref_leftflank[pos-left-1] + ref
-                    alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
-                    pos -= 1
-
-        # parse sample columns
-        samples = []
-        for sample in cols[9:]:
-            dict = {}
-            values = sample.split(':')
-            if len(values) > len(format):
-                self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
-            for idx in range(len(format)):
-                expected = self.get_expected(format[idx], self._format, alt)
-                if idx < len(values): value = values[idx]
-                else:
-                    if expected == -1: value = "."
-                    else: value = ",".join(["."]*expected)
-                dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)
-                if expected != -1 and len(dict[format[idx]]) != expected:
-                    self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
-                               "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
-                    if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))
-                    dict[format[idx]] = dict[format[idx]][:expected]
-            samples.append( dict )
-
-        # done
-        d = {'chrom':chrom,
-             'pos':pos,      # return 0-based position
-             'id':id,
-             'ref':ref,
-             'alt':alt,
-             'qual':qual,
-             'filter':filter,
-             'info':info,
-             'format':format}
-        for key,value in zip(self._samples,samples):
-            d[key] = value
-        
-        return d
-
-
-    def write_data(self, stream, data):
-        required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
-        for k in required:
-            if k not in data: raise ValueError("Required key %s not found in data" % str(k))
-        if data['alt'] == []: alt = "."
-        else: alt = ",".join(data['alt'])
-        if data['filter'] == None: filter = "."
-        elif data['filter'] == []: 
-            if self._version == 33: filter = "0"
-            else: filter = "PASS"
-        else: filter = ';'.join(data['filter'])
-        if data['qual'] == -1: qual = "."
-        else: qual = str(data['qual'])
-
-        output = [data['chrom'], 
-                  str(data['pos']+1),   # change to 1-based position
-                  data['id'],
-                  data['ref'],
-                  alt,
-                  qual,
-                  filter,
-                  self.format_formatdata( data['info'], self._info, separator=";" ),
-                  self.format_formatdata( data['format'], self._format, value=False ) ]
-        
-        for s in self._samples:
-            output.append( self.format_formatdata( data[s], self._format, key=False ) )
-        
-        stream.write( "\t".join(output) + "\n" )
-
-    def _parse_header(self, stream):
-        self._lineno = 0
-        for line in stream:
-            self._lineno += 1
-            if line.startswith('##'):
-                self.parse_header( line.strip() )
-            elif line.startswith('#'):
-                self.parse_heading( line.strip() )
-                self.enter_default_format()
-            else:
-                break
-        return line
-
-    def _parse(self, line, stream):
-        if len(line.strip()) > 0:
-            d = self.parse_data( line.strip() )
-            if d: yield d
-        for line in stream:
-            self._lineno += 1
-            if self._lines and self._lineno > self._lines: raise StopIteration
-            d = self.parse_data( line.strip() )
-            if d: yield d
-
-    ######################################################################################################
-    #
-    # API follows
-    #
-    ######################################################################################################
-
-    def getsamples(self):
-        """ List of samples in VCF file """
-        return self._samples
-
-    def setsamples(self,samples):
-        """ List of samples in VCF file """
-        self._samples = samples
-
-    def getheader(self):
-        """ List of header key-value pairs (strings) """
-        return self._header
-
-    def setheader(self,header):
-        """ List of header key-value pairs (strings) """
-        self._header = header
-
-    def getinfo(self):
-        """ Dictionary of ##INFO tags, as VCF.FORMAT values """
-        return self._info
-
-    def setinfo(self,info):
-        """ Dictionary of ##INFO tags, as VCF.FORMAT values """
-        self._info = info
-
-    def getformat(self):
-        """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
-        return self._format
-
-    def setformat(self,format):
-        """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
-        self._format = format
-
-    def getfilter(self):
-        """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
-        return self._filter
-
-    def setfilter(self,filter):
-        """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
-        self._filter = filter
-
-    def setversion(self, version):
-        if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files")
-        self._version = version
-
-    def setregions(self, regions):
-        self._regions = regions
-
-    def setreference(self, ref):
-        """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """
-        self._reference = ref
-
-    def ignoreerror(self, errorstring):
-        try:             self._ignored_errors.add(self.__dict__[errorstring])
-        except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
-
-    def warnerror(self, errorstring):
-        try:             self._warn_errors.add(self.__dict__[errorstring])
-        except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
-
-    def parse(self, stream):
-        """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
-        last_line = self._parse_header(stream)
-        # now return a generator that does the actual work.  In this way the pre-processing is done
-        # before the first piece of data is yielded
-        return self._parse(last_line, stream)
-
-    def write(self, stream, datagenerator):
-        """ Writes a VCF file to a stream, using a data generator (or list) """
-        self.write_header(stream)
-        self.write_heading(stream)
-        for data in datagenerator: self.write_data(stream,data)
-
-    def writeheader(self, stream):
-        """ Writes a VCF header """
-        self.write_header(stream)
-        self.write_heading(stream)
-
-    def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2):
-        """ Utility function: compares two calls for equality """
-        # a variant should always be assigned to a unique position, one base before
-        # the leftmost position of the alignment gap.  If this rule is implemented
-        # correctly, the two positions must be equal for the calls to be identical.
-        if pos1 != pos2: return False
-        # from both calls, trim rightmost bases when identical.  Do this safely, i.e.
-        # only when the reference bases are not Ns
-        while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:
-            ref1 = ref1[:-1]
-            alt1 = alt1[:-1]
-        while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
-            ref2 = ref2[:-1]
-            alt2 = alt2[:-1]
-        # now, the alternative alleles must be identical
-        return alt1 == alt2
-
-###########################################################################################################
-###########################################################################################################
-## API functions added by Andreas
-###########################################################################################################
-
-    def connect( self, filename ):
-        '''connect to tabix file.'''
-        self.tabixfile = pysam.Tabixfile( filename )
-        self._parse_header(self.tabixfile.header)
-        
-    def fetch(self,
-              reference = None,
-              start = None, 
-              end = None, 
-              region = None ):
-        """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
-
-        iter = self.tabixfile.fetch( reference, start, end, region, parser = pysam.asVCF() )
-        for x in iter:
-            yield VCFRecord( x, self )
-
-    def validate( self, record ):
-        '''validate vcf record.
-
-        returns a validated record.
-        '''
-
-        chrom, pos = record.chrom, record.pos
-
-        # check reference
-        ref = record.ref
-        if ref == ".":
-            self.error(str(record),self.MISSING_REF)
-            if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
-            else:                   ref = ""
-        else:
-            for c in ref:
-                if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF)
-                if "N" in ref: ref = get_sequence(chrom,
-                                                  pos,
-                                                  pos+len(ref),
-                                                  self._reference)
-
-        # make sure reference is sane
-        if self._reference:
-            left = max(0,self.pos-100)
-            faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)
-            faref = faref_leftflank[pos-left:]
-            if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
-            ref = faref
-            
-        # check: format fields are defined
-        for f in record.format:
-            if f not in self._format: self.error(str(record),self.FORMAT_NOT_DEFINED, f)
-            
-        # check: all filters are defined
-        for f in record.filter:
-            if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f)
-
-        # convert v3.3 alleles
-        if self._version == 33:
-            if len(ref) != 1: self.error(line,self.V33_BAD_REF)
-            newalts = []
-            have_deletions = False
-            for a in alt:
-                if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
-                elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
-                elif a.startswith('D'): # allow D<seq> and D<num>
-                    have_deletions = True
-                    try:
-                        l = int(a[1:])          # throws ValueError if sequence
-                        if len(ref) < l:        # add to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[l:]             # new deletion, deleting pos...pos+l
-                    except ValueError:
-                        s = a[1:]
-                        if len(ref) < len(s):   # add Ns to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
-                            if not s.endswith(addns) and addns != 'N'*len(addns):
-                                self.error(line,self.V33_UNMATCHED_DELETION,
-                                           "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[len(s):]        # new deletion, deleting from pos
-                else:
-                    self.error(line,self.V33_BAD_ALLELE)
-                newalts.append(a)
-            alt = newalts
-            # deletion alleles exist, add dummy 1st reference allele, and account for leading base
-            if have_deletions:
-                if pos == 0:
-                    # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
-                    addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
-                    ref += addn
-                    alt = [allele+addn for allele in alt]
-                else:
-                    addn = get_sequence(chrom,pos-1,pos,self._reference)
-                    ref = addn + ref
-                    alt = [addn + allele for allele in alt]
-                    pos -= 1
-        else:
-            # format v4.0 -- just check for nucleotides
-            for allele in alt:
-                if not alleleRegEx.match(allele):
-                    self.error(line,self.V40_BAD_ALLELE,allele)
-                    
-
-        # check for leading nucleotide in indel calls
-        for allele in alt:
-            if len(allele) != len(ref):
-                if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
-                if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
-                    self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
-
-        # trim trailing bases in alleles
-        for i in range(1,min(len(ref),min(map(len,alt)))):
-            if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
-                break
-            ref, alt = ref[:-1], [allele[:-1] for allele in alt]
-
-        # left-align alleles, if a reference is available
-        if self._leftalign and self._reference:
-            while left < pos:
-                movable = True
-                for allele in alt:
-                    if len(allele) > len(ref):
-                        longest, shortest = allele, ref
-                    else:
-                        longest, shortest = ref, allele
-                    if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
-                        movable = False
-                    if longest[-1].upper() != longest[len(shortest)-1].upper():
-                        movable = False
-                if not movable:
-                    break
-                ref = ref[:-1]
-                alt = [allele[:-1] for allele in alt]
-                if min(len(allele) for allele in alt) == 0 or len(ref) == 0:
-                    ref = faref_leftflank[pos-left-1] + ref
-                    alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
-                    pos -= 1
-
-
-
-
index ec0439f17290876217c610355072aa4f4d074efa..8454f8e4b0739581a463484d1799ba2b2a43a1ad 100644 (file)
@@ -86,19 +86,31 @@ class SamtoolsDispatcher(object):
 #
 # import is a python reserved word.
 SAMTOOLS_DISPATCH = { 
+    # samtools 'documented' commands
     "view" : ( "view", None ),
     "sort" : ( "sort", None),
-    "samimport": ( "import", None),
-    "pileup" : ( "pileup", ( (("-c",), Pileup.iterate ), ), ),
+    "mpileup" : ( "mpileup", None),
+    "depth" : ("depth", None),
     "faidx" : ("faidx", None),
     "tview" : ("tview", None),
     "index" : ("index", None),
+    "idxstats" : ("idxstats", None),
     "fixmate" : ("fixmate", None),
-    "glfview" : ("glfview", None),
     "flagstat" : ("flagstat", None),
     "calmd" : ("calmd", None),
     "merge" : ("merge", None),  
-    "rmdup" : ("rmdup", None) }
+    "rmdup" : ("rmdup", None),
+    "reheader" : ("reheader", None),
+    "cat" : ("cat", None),
+    "targetcut" : ("targetcut", None),
+    "phase" : ("phase", None),
+    # others
+    "samimport": ( "import", None),
+    "bam2fq" : ("bam2fq", None),
+    # obsolete
+    # "pileup" : ( "pileup", ( (("-c",), Pileup.iterate ), ), ),
+
+ }
 
 # instantiate samtools commands as python functions
 for key, options in SAMTOOLS_DISPATCH.iteritems():
index 6e18ed67e74be88d34b093dda8deb09205244cda..ca5fb4ea00c05ad980ef6a497207aa035c50d2ec 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13 on Tue Jun  7 17:24:36 2011 */
+/* Generated by Cython 0.14.1 on Fri Nov 25 19:51:23 2011 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
   #define PyBytes_Repr                 PyString_Repr
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
 #endif
-
 #ifndef PySet_CheckExact
-#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
+  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
 
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
   #define PyInt_Check(op)              PyLong_Check(op)
   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
 #endif
 
 #if PY_MAJOR_VERSION >= 3
-  #define PyBoolObject PyLongObject
+  #define PyBoolObject                 PyLongObject
 #endif
 
 
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
 #endif
 
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
 #include "stdint.h"
 #include "bam.h"
 #include "sam.h"
-#include "glf.h"
-#include "bam_maqcns.h"
 #include "faidx.h"
 #include "pysam_util.h"
 #include "pythread.h"
 
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
 /* inline attribute */
 #ifndef CYTHON_INLINE
   #if defined(__GNUC__)
   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
     #define CYTHON_INLINE inline
   #else
-    #define CYTHON_INLINE 
+    #define CYTHON_INLINE
   #endif
 #endif
 
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
 #   else
 #     define CYTHON_UNUSED
 #   endif
 # elif defined(__ICC) || defined(__INTEL_COMPILER)
-#   define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
-#   define CYTHON_UNUSED 
+#   define CYTHON_UNUSED
 # endif
 #endif
 
@@ -262,7 +289,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
 #ifdef __GNUC__
 /* Test for GCC > 2.95 */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
 #define likely(x)   __builtin_expect(!!(x), 1)
 #define unlikely(x) __builtin_expect(!!(x), 0)
 #else /* __GNUC__ > 2 ... */
@@ -288,11 +315,12 @@ static const char *__pyx_f[] = {
   "csamtools.pyx",
   "csamtools.pxd",
   "bool.pxd",
+  "complex.pxd",
 };
 
 /* Type declarations */
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":388
+/* "csamtools.pyx":388
  *      counter[0] += 1;
  * 
  * ctypedef struct MateData:             # <<<<<<<<<<<<<<
@@ -306,7 +334,7 @@ typedef struct {
   uint32_t flag;
 } __pyx_t_9csamtools_MateData;
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1478
+/* "csamtools.pyx":1537
  * ##-------------------------------------------------------------------
  * ##-------------------------------------------------------------------
  * ctypedef struct __iterdata:             # <<<<<<<<<<<<<<
@@ -323,7 +351,7 @@ typedef struct {
   int seq_len;
 } __pyx_t_9csamtools___iterdata;
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1655
+/* "csamtools.pyx":1717
  *         bam_plp_set_mask( self.pileup_iter, self.mask )
  * 
  *     cdef setupIteratorData( self,             # <<<<<<<<<<<<<<
@@ -336,99 +364,7 @@ struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData {
   int reopen;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3192
- *         bam_maqindel_ret_destroy(self._r)
- * 
- * cdef class IndelCallerBase:             # <<<<<<<<<<<<<<
- *     '''Base class for SNP callers.
- * 
- */
-
-struct __pyx_obj_9csamtools_IndelCallerBase {
-  PyObject_HEAD
-  bam_maqindel_opt_t *options;
-  struct __pyx_obj_9csamtools_IteratorColumn *iter;
-  int cap_mapQ;
-  int max_depth;
-};
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3330
- *         return self._call()
- * 
- * cdef class IteratorIndelCalls( IndelCallerBase ):             # <<<<<<<<<<<<<<
- *     """*(IteratorColumn iterator)*
- * 
- */
-
-struct __pyx_obj_9csamtools_IteratorIndelCalls {
-  struct __pyx_obj_9csamtools_IndelCallerBase __pyx_base;
-};
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":244
- * ## Public methods
- * ######################################################################
- * cdef class Fastafile:             # <<<<<<<<<<<<<<
- *     '''*(filename)*
- * 
- */
-
-struct __pyx_obj_9csamtools_Fastafile {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtab;
-  char *_filename;
-  faidx_t *fastafile;
-};
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3103
- *         return call
- * 
- * cdef class IndelCall:             # <<<<<<<<<<<<<<
- *     '''the results of an indel call.'''
- *     cdef int _tid
- */
-
-struct __pyx_obj_9csamtools_IndelCall {
-  PyObject_HEAD
-  int _tid;
-  int _pos;
-  int _coverage;
-  int _rms_mapping_quality;
-  bam_maqindel_ret_t *_r;
-};
-
-/* "pysam/csamtools.pxd":388
- *     cdef bam1_t * _delegate
- * 
- * cdef class Samfile:             # <<<<<<<<<<<<<<
- *     cdef char * _filename
- *     # pointer to samfile
- */
-
-struct __pyx_obj_9csamtools_Samfile {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtab;
-  char *_filename;
-  samfile_t *samfile;
-  bam_index_t *index;
-  int isbam;
-  int isremote;
-  bam1_t *b;
-  char *mode;
-};
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3287
- *         return call
- * 
- * cdef class IndelCaller( IndelCallerBase ):             # <<<<<<<<<<<<<<
- *     '''*(IteratorColumn iterator_column )*
- * 
- */
-
-struct __pyx_obj_9csamtools_IndelCaller {
-  struct __pyx_obj_9csamtools_IndelCallerBase __pyx_base;
-};
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":91
+/* "csamtools.pyx":91
  *      return dest
  * 
  * cdef class PileupRead             # <<<<<<<<<<<<<<
@@ -447,103 +383,66 @@ struct __pyx_obj_9csamtools_PileupRead {
   uint32_t _is_tail;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2816
- *     return retval, out_stderr, out_stdout
- * 
- * cdef class SNPCall:             # <<<<<<<<<<<<<<
- *     '''the results of a SNP call.'''
- *     cdef int _tid
- */
-
-struct __pyx_obj_9csamtools_SNPCall {
-  PyObject_HEAD
-  int _tid;
-  int _pos;
-  char _reference_base;
-  char _genotype;
-  int _consensus_quality;
-  int _snp_quality;
-  int _rms_mapping_quality;
-  int _coverage;
-};
-
-/* "pysam/csamtools.pxd":383
+/* "csamtools.pxd":423
+ *     cdef char * _getrname( self, int tid )
  * 
- * # need to declare all C fields and methods here
- * cdef class AlignedRead:             # <<<<<<<<<<<<<<
+ * cdef class IteratorRow:             # <<<<<<<<<<<<<<
+ *     pass
  * 
- *     # object that this AlignedRead represents
  */
 
-struct __pyx_obj_9csamtools_AlignedRead {
+struct __pyx_obj_9csamtools_IteratorRow {
   PyObject_HEAD
-  bam1_t *_delegate;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1542
- *     return ret
- * 
- * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
- *     '''abstract base class for iterators over columns.
+/* "csamtools.pyx":1415
+ *         if self.owns_samfile: samclose( self.fp )
  * 
+ * cdef class IteratorRowAllRefs(IteratorRow):             # <<<<<<<<<<<<<<
+ *     """iterates over all mapped reads by chaining iterators over each reference
+ *     """
  */
 
-struct __pyx_obj_9csamtools_IteratorColumn {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtab;
-  struct __pyx_obj_9csamtools_IteratorRowRegion *iter;
-  int tid;
-  int pos;
-  int n_plp;
-  int mask;
-  const bam_pileup1_t * plp;
-  bam_plp_t pileup_iter;
-  __pyx_t_9csamtools___iterdata iterdata;
+struct __pyx_obj_9csamtools_IteratorRowAllRefs {
+  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
   struct __pyx_obj_9csamtools_Samfile *samfile;
-  struct __pyx_obj_9csamtools_Fastafile *fastafile;
-  PyObject *stepper;
+  int tid;
+  struct __pyx_obj_9csamtools_IteratorRowRegion *rowiter;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1712
- *             self.iterdata.seq = NULL
+/* "csamtools.pxd":426
+ *     pass
  * 
- * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
- *     '''iterates over a region only.
- *     '''
+ * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
+ *     cdef bam1_t * b
+ *     cdef samfile_t * fp
  */
 
-struct __pyx_obj_9csamtools_IteratorColumnRegion {
-  struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
+struct __pyx_obj_9csamtools_IteratorRowAll {
+  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
+  struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtab;
+  bam1_t *b;
+  samfile_t *fp;
+  int owns_samfile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1187
- * ##-------------------------------------------------------------------
- * ##-------------------------------------------------------------------
- * cdef class IteratorRow:             # <<<<<<<<<<<<<<
- *     '''abstract base class for iterators over mapped reads.
+/* "csamtools.pyx":82
+ *     return dest
  * 
+ * cdef class PileupProxy             # <<<<<<<<<<<<<<
+ * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
+ *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
  */
 
-struct __pyx_obj_9csamtools_IteratorRow {
+struct __pyx_obj_9csamtools_PileupProxy {
   PyObject_HEAD
-};
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1356
- *         if self.owns_samfile: samclose( self.fp )
- * 
- * cdef class IteratorRowAllRefs(IteratorRow):             # <<<<<<<<<<<<<<
- *     """iterates over all mapped reads by chaining iterators over each reference
- *     """
- */
-
-struct __pyx_obj_9csamtools_IteratorRowAllRefs {
-  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
-  struct __pyx_obj_9csamtools_Samfile *samfile;
+  bam_pileup1_t *plp;
   int tid;
-  struct __pyx_obj_9csamtools_IteratorRowRegion *rowiter;
+  int pos;
+  int n_pu;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1206
+/* "csamtools.pyx":1265
  *     pass
  * 
  * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
@@ -562,19 +461,22 @@ struct __pyx_obj_9csamtools_IteratorRowRegion {
   int owns_samfile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1741
- *                                      self.n_plp )
+/* "csamtools.pyx":244
+ * ## Public methods
+ * ######################################################################
+ * cdef class Fastafile:             # <<<<<<<<<<<<<<
+ *     '''*(filename)*
  * 
- * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
- *     """iterates over all columns by chaining iterators over each reference
- *     """
  */
 
-struct __pyx_obj_9csamtools_IteratorColumnAllRefs {
-  struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
+struct __pyx_obj_9csamtools_Fastafile {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtab;
+  char *_filename;
+  faidx_t *fastafile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1402
+/* "csamtools.pyx":1461
  *                 raise StopIteration
  * 
  * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
@@ -592,62 +494,86 @@ struct __pyx_obj_9csamtools_IteratorRowSelection {
   int owns_samfile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2873
- * 
+/* "csamtools.pyx":1601
+ *     return ret
  * 
- * cdef class SNPCallerBase:             # <<<<<<<<<<<<<<
- *     '''Base class for SNP callers.
+ * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
+ *     '''abstract base class for iterators over columns.
  * 
  */
 
-struct __pyx_obj_9csamtools_SNPCallerBase {
+struct __pyx_obj_9csamtools_IteratorColumn {
   PyObject_HEAD
-  struct __pyx_vtabstruct_9csamtools_SNPCallerBase *__pyx_vtab;
-  bam_maqcns_t *c;
-  struct __pyx_obj_9csamtools_IteratorColumn *iter;
+  struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtab;
+  struct __pyx_obj_9csamtools_IteratorRowRegion *iter;
+  int tid;
+  int pos;
+  int n_plp;
+  int mask;
+  const bam_pileup1_t * plp;
+  bam_plp_t pileup_iter;
+  __pyx_t_9csamtools___iterdata iterdata;
+  struct __pyx_obj_9csamtools_Samfile *samfile;
+  struct __pyx_obj_9csamtools_Fastafile *fastafile;
+  PyObject *stepper;
+  int max_depth;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3021
- *         return call
- * 
- * cdef class SNPCaller( SNPCallerBase ):             # <<<<<<<<<<<<<<
- *     '''*(IteratorColumn iterator_column )*
+/* "csamtools.pyx":1806
+ *                                      self.n_plp )
  * 
+ * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
+ *     """iterates over all columns by chaining iterators over each reference
+ *     """
  */
 
-struct __pyx_obj_9csamtools_SNPCaller {
-  struct __pyx_obj_9csamtools_SNPCallerBase __pyx_base;
+struct __pyx_obj_9csamtools_IteratorColumnAllRefs {
+  struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2946
- *         sys.stdout.flush()
- * 
- * cdef class IteratorSNPCalls( SNPCallerBase ):             # <<<<<<<<<<<<<<
- *     """*(IteratorColumn iterator)*
+/* "csamtools.pxd":394
+ *     cdef bam1_t * _delegate
  * 
+ * cdef class Samfile:             # <<<<<<<<<<<<<<
+ *     cdef char * _filename
+ *     # pointer to samfile
  */
 
-struct __pyx_obj_9csamtools_IteratorSNPCalls {
-  struct __pyx_obj_9csamtools_SNPCallerBase __pyx_base;
+struct __pyx_obj_9csamtools_Samfile {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtab;
+  char *_filename;
+  samfile_t *samfile;
+  bam_index_t *index;
+  int isbam;
+  int isstream;
+  int isremote;
+  bam1_t *b;
+  char *mode;
+  int64_t start_offset;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1292
- *         if self.owns_samfile: samclose( self.fp )
- * 
- * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
- *     """*(Samfile samfile, int reopen = True)*
+/* "csamtools.pyx":2902
+ *     return retval, out_stderr, out_stdout
  * 
+ * cdef class SNPCall:             # <<<<<<<<<<<<<<
+ *     '''the results of a SNP call.'''
+ *     cdef int _tid
  */
 
-struct __pyx_obj_9csamtools_IteratorRowAll {
-  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
-  struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtab;
-  bam1_t *b;
-  samfile_t *fp;
-  int owns_samfile;
+struct __pyx_obj_9csamtools_SNPCall {
+  PyObject_HEAD
+  int _tid;
+  int _pos;
+  char _reference_base;
+  char _genotype;
+  int _consensus_quality;
+  int _snp_quality;
+  int _rms_mapping_quality;
+  int _coverage;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3370
+/* "csamtools.pyx":3456
  * 
  * 
  * cdef class IndexedReads:             # <<<<<<<<<<<<<<
@@ -663,24 +589,33 @@ struct __pyx_obj_9csamtools_IndexedReads {
   int owns_samfile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":82
- *     return dest
+/* "csamtools.pyx":1777
+ *             self.iterdata.seq = NULL
  * 
- * cdef class PileupProxy             # <<<<<<<<<<<<<<
- * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
- *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
+ * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
+ *     '''iterates over a region only.
+ *     '''
  */
 
-struct __pyx_obj_9csamtools_PileupProxy {
-  PyObject_HEAD
-  bam_pileup1_t *plp;
-  int tid;
-  int pos;
-  int n_pu;
+struct __pyx_obj_9csamtools_IteratorColumnRegion {
+  struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
+};
+
+/* "csamtools.pxd":389
+ * 
+ * # need to declare all C fields and methods here
+ * cdef class AlignedRead:             # <<<<<<<<<<<<<<
+ * 
+ *     # object that this AlignedRead represents
+ */
+
+struct __pyx_obj_9csamtools_AlignedRead {
+  PyObject_HEAD
+  bam1_t *_delegate;
 };
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1542
+/* "csamtools.pyx":1601
  *     return ret
  * 
  * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
@@ -698,7 +633,7 @@ struct __pyx_vtabstruct_9csamtools_IteratorColumn {
 static struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtabptr_9csamtools_IteratorColumn;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1712
+/* "csamtools.pyx":1777
  *             self.iterdata.seq = NULL
  * 
  * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
@@ -712,35 +647,7 @@ struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion {
 static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *__pyx_vtabptr_9csamtools_IteratorColumnRegion;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2873
- * 
- * 
- * cdef class SNPCallerBase:             # <<<<<<<<<<<<<<
- *     '''Base class for SNP callers.
- * 
- */
-
-struct __pyx_vtabstruct_9csamtools_SNPCallerBase {
-  PyObject *(*__dump)(struct __pyx_obj_9csamtools_SNPCallerBase *, glf1_t *, uint32_t, int);
-};
-static struct __pyx_vtabstruct_9csamtools_SNPCallerBase *__pyx_vtabptr_9csamtools_SNPCallerBase;
-
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3021
- *         return call
- * 
- * cdef class SNPCaller( SNPCallerBase ):             # <<<<<<<<<<<<<<
- *     '''*(IteratorColumn iterator_column )*
- * 
- */
-
-struct __pyx_vtabstruct_9csamtools_SNPCaller {
-  struct __pyx_vtabstruct_9csamtools_SNPCallerBase __pyx_base;
-};
-static struct __pyx_vtabstruct_9csamtools_SNPCaller *__pyx_vtabptr_9csamtools_SNPCaller;
-
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1206
+/* "csamtools.pyx":1265
  *     pass
  * 
  * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
@@ -755,7 +662,7 @@ struct __pyx_vtabstruct_9csamtools_IteratorRowRegion {
 static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtabptr_9csamtools_IteratorRowRegion;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1402
+/* "csamtools.pyx":1461
  *                 raise StopIteration
  * 
  * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
@@ -770,7 +677,7 @@ struct __pyx_vtabstruct_9csamtools_IteratorRowSelection {
 static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtabptr_9csamtools_IteratorRowSelection;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1741
+/* "csamtools.pyx":1806
  *                                      self.n_plp )
  * 
  * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
@@ -784,12 +691,12 @@ struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs {
 static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":415
+/* "csamtools.pyx":415
  * 
  * 
  * cdef class Samfile:             # <<<<<<<<<<<<<<
- *     '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None)*
- * 
+ *     '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,
+ *          add_sq_text = False )*
  */
 
 struct __pyx_vtabstruct_9csamtools_Samfile {
@@ -802,7 +709,7 @@ struct __pyx_vtabstruct_9csamtools_Samfile {
 static struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtabptr_9csamtools_Samfile;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":244
+/* "csamtools.pyx":244
  * ## Public methods
  * ######################################################################
  * cdef class Fastafile:             # <<<<<<<<<<<<<<
@@ -816,7 +723,7 @@ struct __pyx_vtabstruct_9csamtools_Fastafile {
 static struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtabptr_9csamtools_Fastafile;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1292
+/* "csamtools.pyx":1351
  *         if self.owns_samfile: samclose( self.fp )
  * 
  * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
@@ -830,20 +737,6 @@ struct __pyx_vtabstruct_9csamtools_IteratorRowAll {
 };
 static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtools_IteratorRowAll;
 
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2946
- *         sys.stdout.flush()
- * 
- * cdef class IteratorSNPCalls( SNPCallerBase ):             # <<<<<<<<<<<<<<
- *     """*(IteratorColumn iterator)*
- * 
- */
-
-struct __pyx_vtabstruct_9csamtools_IteratorSNPCalls {
-  struct __pyx_vtabstruct_9csamtools_SNPCallerBase __pyx_base;
-};
-static struct __pyx_vtabstruct_9csamtools_IteratorSNPCalls *__pyx_vtabptr_9csamtools_IteratorSNPCalls;
-
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
@@ -917,7 +810,7 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
   #define __Pyx_TraceDeclarations                                  \
   static PyCodeObject *__pyx_frame_code = NULL;                      \
   CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;           \
-  int __Pyx_use_tracing = 0;                                                         
+  int __Pyx_use_tracing = 0;
 
   #define __Pyx_TraceCall(funcname, srcfile, firstlineno)                            \
   if (unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)) {      \
@@ -947,9 +840,9 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 #else
 
   #define __Pyx_TraceDeclarations
-  #define __Pyx_TraceCall(funcname, srcfile, firstlineno) 
-  #define __Pyx_TraceException() 
-  #define __Pyx_TraceReturn(result) 
+  #define __Pyx_TraceCall(funcname, srcfile, firstlineno)
+  #define __Pyx_TraceException()
+  #define __Pyx_TraceReturn(result)
 
 #endif /* CYTHON_PROFILE */
 
@@ -970,16 +863,18 @@ static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
     const char* function_name, int kw_allowed); /*proto*/
 
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
 static void __Pyx_RaiseDoubleKeywordsError(
     const char* func_name, PyObject* kw_name); /*proto*/
 
-static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
-    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
-
 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
@@ -1065,8 +960,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
     return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
 }
 
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
-
 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     if (likely(PyList_CheckExact(L))) {
         if (PyList_Append(L, x) < 0) return NULL;
@@ -1085,7 +978,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
 
 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
 
-
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
@@ -1166,11 +1058,26 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *modname); /*proto*/
 
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+#define __pyx_binding_PyCFunctionType_USED 1
+
+typedef struct {
+    PyCFunctionObject func;
+} __pyx_binding_PyCFunctionType_object;
+
+static PyTypeObject __pyx_binding_PyCFunctionType_type;
+static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
+
+static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
+#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)
+
+static int __pyx_binding_PyCFunctionType_init(void); /* proto */
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
 
 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *);
 
@@ -1184,14 +1091,6 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t);
 
-static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
-#if PY_MAJOR_VERSION >= 3
-static PyObject* __pyx_print = 0;
-static PyObject* __pyx_print_kwargs = 0;
-#endif
-
-static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
-
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t);
 
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
@@ -1278,8 +1177,11 @@ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
 
 /* 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 */
@@ -1317,25 +1219,18 @@ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_file = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_AlignedRead = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_Samfile = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRow = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAll = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_PileupProxy = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_PileupRead = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_Fastafile = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IteratorRow = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowRegion = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAll = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAllRefs = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowSelection = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumn = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnRegion = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnAllRefs = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_SNPCall = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_SNPCallerBase = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IteratorSNPCalls = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_SNPCaller = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IndelCall = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IndelCallerBase = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IndelCaller = 0;
-static PyTypeObject *__pyx_ptype_9csamtools_IteratorIndelCalls = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IndexedReads = 0;
 static char *__pyx_v_9csamtools_bam_nt16_rev_table;
 static int __pyx_v_9csamtools_max_pos;
@@ -1354,7 +1249,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *); /*proto*/
 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *, uint32_t, uint32_t); /*proto*/
 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *, uint32_t, uint32_t); /*proto*/
 #define __Pyx_MODULE_NAME "csamtools"
-int __pyx_module_is_main_csamtools = 0;
+static int __pyx_module_is_main_csamtools = 0;
 
 /* Implementation of csamtools */
 static PyObject *__pyx_builtin_open;
@@ -1364,106 +1259,65 @@ static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_IOError;
 static PyObject *__pyx_builtin_OverflowError;
 static PyObject *__pyx_builtin_NotImplementedError;
+static PyObject *__pyx_builtin_OSError;
+static PyObject *__pyx_builtin_AttributeError;
 static PyObject *__pyx_builtin_KeyError;
 static PyObject *__pyx_builtin_StopIteration;
 static PyObject *__pyx_builtin_cmp;
 static PyObject *__pyx_builtin_chr;
 static PyObject *__pyx_builtin_TypeError;
-static PyObject *__pyx_builtin_range;
 static char __pyx_k_1[] = "\t";
 static char __pyx_k_2[] = "\n";
 static char __pyx_k_3[] = "calling len() on closed file";
-static char __pyx_k_4[] = "could not open file `%s`";
-static char __pyx_k_5[] = "I/O operation on closed file";
-static char __pyx_k_6[] = "no sequence/region supplied.";
-static char __pyx_k_7[] = "invalid region: start (%i) > end (%i)";
-static char __pyx_k_8[] = "";
-static char __pyx_k_9[] = "start out of range (%i)";
-static char __pyx_k_10[] = "end out of range (%i)";
-static char __pyx_k_11[] = "%s:%i-%i";
-static char __pyx_k_12[] = "invalid file opening mode `%s`";
-static char __pyx_k_13[] = "http:";
-static char __pyx_k_14[] = "ftp:";
-static char __pyx_k_15[] = "either supply options `template`, `header` or  both `referencenames` and `referencelengths` for writing";
-static char __pyx_k_16[] = "unequal names and lengths of reference sequences";
-static char __pyx_k_17[] = "-";
-static char __pyx_k_18[] = "file `%s` not found";
-static char __pyx_k_19[] = "could not open file (mode='%s') - is it SAM/BAM format?";
-static char __pyx_k_20[] = "file does not have valid header (mode='%s') - is it SAM/BAM format?";
-static char __pyx_k_21[] = "file header is empty (mode='%s') - is it SAM/BAM format?";
-static char __pyx_k_22[] = ".bai";
-static char __pyx_k_23[] = "error while opening index `%s` ";
-static char __pyx_k_24[] = "tid %i out of range 0<=tid<%i";
-static char __pyx_k_25[] = "[:-]";
-static char __pyx_k_26[] = "invalid reference `%s`";
-static char __pyx_k_27[] = "invalid coordinates: start (%i) > end (%i)";
-static char __pyx_k_28[] = "seek only available in bam files";
-static char __pyx_k_30[] = "fetch called on bamfile without index";
-static char __pyx_k_31[] = "callback functionality requires a region/reference";
-static char __pyx_k_32[] = "no index available for fetch";
-static char __pyx_k_33[] = "fetch called for samfile without header";
-static char __pyx_k_34[] = "fetch for a region is not available for sam files";
-static char __pyx_k_35[] = "callback not implemented yet";
-static char __pyx_k_36[] = "read %s: is unpaired";
-static char __pyx_k_37[] = "mate %s: is unmapped";
-static char __pyx_k_38[] = "mate not found";
-static char __pyx_k_40[] = "counting functionality requires a region/reference";
-static char __pyx_k_41[] = "count for a region is not available for sam files";
-static char __pyx_k_42[] = "no index available for pileup";
-static char __pyx_k_43[] = "pileup of samfiles not implemented yet";
-static char __pyx_k_44[] = "@";
-static char __pyx_k_45[] = "header line without '@': '%s'";
-static char __pyx_k_46[] = "header line with invalid type '%s': '%s'";
-static char __pyx_k_47[] = ":";
-static char __pyx_k_48[] = "unknown field code '%s' in record '%s'";
-static char __pyx_k_49[] = "multiple '%s' lines are not permitted";
-static char __pyx_k_50[] = "@%s";
-static char __pyx_k_51[] = "%s:%s";
-static char __pyx_k_52[] = "invalid type for record %s: %s, expected %s";
-static char __pyx_k_53[] = "incomplete sequence information in '%s'";
-static char __pyx_k_54[] = "no index available for iteration";
-static char __pyx_k_55[] = "can only use this iterator on bam files";
-static char __pyx_k_56[] = "reference sequence for '%s' (tid=%i) not found";
-static char __pyx_k_57[] = "unknown stepper option `%s` in IteratorColumn";
-static char __pyx_k_59[] = "error during iteration";
-static char __pyx_k_60[] = "Invalid clipping in CIGAR string";
-static char __pyx_k_61[] = "quality and sequence mismatch: %i != %i";
-static char __pyx_k_62[] = "%c";
-static char __pyx_k_63[] = "create_string_buffer";
-static char __pyx_k_64[] = "<cccf";
-static char __pyx_k_65[] = "<cccb";
-static char __pyx_k_66[] = "<ccch";
-static char __pyx_k_67[] = "integer %i out of range of BAM/SAM specification";
-static char __pyx_k_68[] = "<ccci";
-static char __pyx_k_69[] = "<cccB";
-static char __pyx_k_70[] = "<cccH";
-static char __pyx_k_71[] = "<cccI";
-static char __pyx_k_72[] = "<cccc";
-static char __pyx_k_73[] = "<ccc%is";
-static char __pyx_k_74[] = "tags field too large";
-static char __pyx_k_75[] = "tag '%s' not present";
-static char __pyx_k_76[] = "Contig index";
-static char __pyx_k_77[] = "Mapped position on contig";
-static char __pyx_k_78[] = "Contig index for mate pair";
-static char __pyx_k_79[] = "Position of mate pair";
-static char __pyx_k_80[] = "Insert size";
-static char __pyx_k_81[] = "Binary flag";
-static char __pyx_k_82[] = "Count of cigar entries";
-static char __pyx_k_83[] = "Cigar entries";
-static char __pyx_k_84[] = "Mapping quality";
-static char __pyx_k_85[] = "Bam index bin number";
-static char __pyx_k_86[] = "Length of query name";
-static char __pyx_k_87[] = "Query name";
-static char __pyx_k_88[] = "Length of query sequence";
-static char __pyx_k_89[] = "Query sequence";
-static char __pyx_k_90[] = "Quality scores";
-static char __pyx_k_91[] = "Length of auxilary data";
-static char __pyx_k_92[] = "Maximum data length";
-static char __pyx_k_93[] = "Current data length";
-static char __pyx_k_94[] = "%-30s %-10s= %s";
-static char __pyx_k_95[] = "(";
-static char __pyx_k_96[] = ")";
-static char __pyx_k_97[] = "This class cannot be instantiated from Python";
+static char __pyx_k_5[] = "could not open file `%s`";
+static char __pyx_k_6[] = "I/O operation on closed file";
+static char __pyx_k_9[] = "no sequence/region supplied.";
+static char __pyx_k_11[] = "invalid region: start (%i) > end (%i)";
+static char __pyx_k_12[] = "";
+static char __pyx_k_13[] = "start out of range (%i)";
+static char __pyx_k_14[] = "end out of range (%i)";
+static char __pyx_k_15[] = "%s:%i-%i";
+static char __pyx_k_17[] = "invalid file opening mode `%s`";
+static char __pyx_k_18[] = "-";
+static char __pyx_k_19[] = "http:";
+static char __pyx_k_20[] = "ftp:";
+static char __pyx_k_21[] = "either supply options `template`, `header` or  both `referencenames` and `referencelengths` for writing";
+static char __pyx_k_22[] = "unequal names and lengths of reference sequences";
+static char __pyx_k_23[] = "@SQ\tSN:%s\tLN:%s\n";
+static char __pyx_k_24[] = "file `%s` not found";
+static char __pyx_k_25[] = "could not open file (mode='%s') - is it SAM/BAM format?";
+static char __pyx_k_26[] = "file does not have valid header (mode='%s') - is it SAM/BAM format?";
+static char __pyx_k_27[] = ".bai";
+static char __pyx_k_28[] = "error while opening index `%s` ";
+static char __pyx_k_31[] = "tid %i out of range 0<=tid<%i";
+static char __pyx_k_33[] = "[:-]";
+static char __pyx_k_35[] = "invalid reference `%s`";
+static char __pyx_k_36[] = "invalid coordinates: start (%i) > end (%i)";
+static char __pyx_k_38[] = "seek only available in bam files";
+static char __pyx_k_40[] = "seek no available in streams";
+static char __pyx_k_46[] = "fetch called on bamfile without index";
+static char __pyx_k_48[] = "callback functionality requires a region/reference";
+static char __pyx_k_50[] = "no index available for fetch";
+static char __pyx_k_52[] = "fetching by region is not available for sam files";
+static char __pyx_k_54[] = "fetch called for samfile without header";
+static char __pyx_k_56[] = "callback not implemented yet";
+static char __pyx_k_58[] = "read %s: is unpaired";
+static char __pyx_k_59[] = "mate %s: is unmapped";
+static char __pyx_k_60[] = "mate not found";
+static char __pyx_k_65[] = "counting functionality requires a region/reference";
+static char __pyx_k_68[] = "count for a region is not available for sam files";
+static char __pyx_k_71[] = "no index available for pileup";
+static char __pyx_k_74[] = "pileup of samfiles not implemented yet";
+static char __pyx_k_81[] = "Samfile.mapped only available in bam files";
+static char __pyx_k_84[] = "Samfile.unmapped only available in bam files";
+static char __pyx_k_89[] = "@";
+static char __pyx_k_91[] = "header line without '@': '%s'";
+static char __pyx_k_93[] = "header line with invalid type '%s': '%s'";
+static char __pyx_k_94[] = ":";
+static char __pyx_k_96[] = "unknown field code '%s' in record '%s'";
+static char __pyx_k_97[] = "multiple '%s' lines are not permitted";
+static char __pyx_k_98[] = "@%s";
+static char __pyx_k_99[] = "%s:%s";
 static char __pyx_k__A[] = "A";
 static char __pyx_k__C[] = "C";
 static char __pyx_k__D[] = "D";
@@ -1481,127 +1335,123 @@ static char __pyx_k__r[] = "r";
 static char __pyx_k__s[] = "s";
 static char __pyx_k__w[] = "w";
 static char __pyx_k__x[] = "x";
-static char __pyx_k_100[] = "No such file or directory: '%s'";
-static char __pyx_k_101[] = "-o";
-static char __pyx_k_102[] = "option -o is forbidden in samtools view";
-static char __pyx_k_103[] = "_rms_mapping_quality";
-static char __pyx_k_104[] = "--> read %i %s %i";
-static char __pyx_k_105[] = "pos=%i, cns=%i, q_r = %f, depth=%i, n=%i, rb=%i, cns-cq=%i %i %i %i";
-static char __pyx_k_106[] = "-------------------------------------\n";
-static char __pyx_k_107[] = "IteratorSNPCalls requires an pileup iterator with reference sequence";
-static char __pyx_k_108[] = "position %i out of bounds on reference sequence (len=%i)";
-static char __pyx_k_109[] = "no reads in region - no call";
-static char __pyx_k_110[] = "%s/%s";
-static char __pyx_k_111[] = "IndelCallerBase requires an pileup iterator with reference sequence";
-static char __pyx_k_112[] = "can only IndexReads on bam files";
-static char __pyx_k_113[] = "read %s not found";
-static char __pyx_k_114[] = "the query name (None if not present)";
-static char __pyx_k_115[] = "the :term:`cigar` alignment (None if not present).\n        ";
-static char __pyx_k_116[] = "read sequence bases, including :term:`soft clipped` bases (None if not present)";
-static char __pyx_k_117[] = "read sequence base qualities, including :term:`soft clipped` bases (None if not present)";
-static char __pyx_k_118[] = "aligned portion of the read and excludes any flanking bases that were :term:`soft clipped` (None if not present)\n\n        SAM/BAM files may included extra flanking bases sequences that were\n        not part of the alignment.  These bases may be the result of the\n        Smith-Waterman or other algorithms, which may not require alignments\n        that begin at the first residue or end at the last.  In addition,\n        extra sequencing adapters, multiplex identifiers, and low-quality bases that\n        were not considered for alignment may have been retained.";
-static char __pyx_k_119[] = "aligned query sequence quality values (None if not present)";
-static char __pyx_k_120[] = "start index of the aligned query portion of the sequence (0-based, inclusive)";
-static char __pyx_k_121[] = "end index of the aligned query portion of the sequence (0-based, exclusive)";
-static char __pyx_k_122[] = "Length of the aligned query sequence";
-static char __pyx_k_123[] = "the tags in the AUX field.\n\n        This property permits convenience access to \n        the tags. Changes it the returned list will\n        not update the tags automatically. Instead,\n        the following is required for adding a \n        new tag::\n\n            read.tags = read.tags + [(\"RG\",0)]\n\n        ";
-static char __pyx_k_124[] = "properties flag";
-static char __pyx_k_125[] = "\n        :term:`target` ID\n\n        DEPRECATED from pysam-0.4 - use tid in the future.\n        The rname field caused a lot of confusion as it returns\n        the :term:`target` ID instead of the reference sequence\n        name.\n\n        .. note::\n\n            This field contains the index of the reference sequence \n            in the sequence dictionary. To obtain the name\n            of the reference sequence, use :meth:`pysam.Samfile.getrname()`\n            \n        ";
-static char __pyx_k_126[] = "\n        :term:`target` ID\n\n        .. note::\n\n            This field contains the index of the reference sequence \n            in the sequence dictionary. To obtain the name\n            of the reference sequence, use :meth:`pysam.Samfile.getrname()`\n            \n        ";
-static char __pyx_k_127[] = "0-based leftmost coordinate";
-static char __pyx_k_128[] = "properties bin";
-static char __pyx_k_129[] = "length of the read (read only). Returns 0 if not given.";
-static char __pyx_k_130[] = "aligned end position of the read (read only).  Returns\n        None if not available.";
-static char __pyx_k_131[] = "aligned length of the read (read only).  Returns None if\n        not available.";
-static char __pyx_k_132[] = "mapping quality";
-static char __pyx_k_133[] = "the :term:`reference` id of the mate ";
-static char __pyx_k_134[] = "the position of the mate";
-static char __pyx_k_135[] = "the insert size";
-static char __pyx_k_136[] = "true if read is paired in sequencing";
-static char __pyx_k_137[] = "true if read is mapped in a proper pair";
-static char __pyx_k_138[] = "true if read itself is unmapped";
-static char __pyx_k_139[] = "true if the mate is unmapped";
-static char __pyx_k_140[] = "true if read is mapped to reverse strand";
-static char __pyx_k_141[] = "true is read is mapped to reverse strand";
-static char __pyx_k_142[] = "true if this is read1";
-static char __pyx_k_143[] = "true if this is read2";
-static char __pyx_k_144[] = "true if not primary alignment";
-static char __pyx_k_145[] = "true if QC failure";
-static char __pyx_k_146[] = "true if optical or PCR duplicate";
-static char __pyx_k_147[] = "a list of reference positions that this read aligns to.";
-static char __pyx_k_148[] = "number of :term:`filename` associated with this object.";
-static char __pyx_k_149[] = "number of :term:`reference` sequences in the file.";
-static char __pyx_k_150[] = "tuple with the names of :term:`reference` sequences.";
-static char __pyx_k_151[] = "tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as \n        :attr:`pysam.Samfile.references`\n        ";
-static char __pyx_k_152[] = "full contents of the :term:`sam file` header as a string.";
-static char __pyx_k_153[] = "header information within the :term:`sam file`. The records and fields are returned as \n        a two-level dictionary.\n        ";
-static char __pyx_k_154[] = "the chromosome ID as is defined in the header";
-static char __pyx_k_155[] = "number of reads mapping to this column.";
-static char __pyx_k_156[] = "list of reads (:class:`pysam.PileupRead`) aligned to this column";
-static char __pyx_k_157[] = "a :class:`pysam.AlignedRead` object of the aligned read";
-static char __pyx_k_158[] = "position of the read base at the pileup site, 0-based";
-static char __pyx_k_159[] = "indel length; 0 for no indel, positive for ins and negative for del";
-static char __pyx_k_160[] = "1 iff the base on the padded read is a deletion";
-static char __pyx_k_161[] = "current sequence length.";
-static char __pyx_k_162[] = "nucleotide position of SNP.";
-static char __pyx_k_163[] = "reference base at pos. ``N`` if no reference sequence supplied.";
-static char __pyx_k_164[] = "the genotype called.";
-static char __pyx_k_165[] = "the genotype quality (Phred-scaled).";
-static char __pyx_k_166[] = "the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.";
-static char __pyx_k_167[] = "the root mean square (rms) of the mapping quality of all reads involved in the call.";
-static char __pyx_k_168[] = "coverage or read depth - the number of reads involved in the call.";
-static char __pyx_k_169[] = "sequence of first allele.";
-static char __pyx_k_170[] = "sequence of second allele.";
-static char __pyx_k_171[] = "reads supporting first allele.";
-static char __pyx_k_172[] = "=ACMGRSVTWYHKDBN";
-static char __pyx_k_173[] = "A pileup column. A pileup column contains  \n    all the reads that map to a certain target base.\n\n    tid      \n        chromosome ID as is defined in the header      \n    pos      \n        the target base coordinate (0-based)    \n    n \n        number of reads mapping to this column  \n    pileups  \n        list of reads (:class:`pysam.PileupRead`) aligned to this column    \n    ";
-static char __pyx_k_174[] = "\n    stderr is captured. \n    ";
-static char __pyx_k_175[] = "does nothing. stderr can't be redirected on windows";
-static char __pyx_k_176[] = "http://mail.python.org/pipermail/python-list/2000-June/038406.html";
-static char __pyx_k_177[] = "Fastafile._isOpen (line 265)";
-static char __pyx_k_178[] = "Fastafile._open (line 275)";
-static char __pyx_k_179[] = "Fastafile.fetch (line 306)";
-static char __pyx_k_180[] = "Samfile._isOpen (line 464)";
-static char __pyx_k_181[] = "Samfile._hasIndex (line 468)";
-static char __pyx_k_182[] = "Samfile._open (line 472)";
-static char __pyx_k_183[] = "Samfile.gettid (line 612)";
-static char __pyx_k_184[] = "Samfile.getrname (line 621)";
-static char __pyx_k_185[] = "Samfile._parseRegion (line 637)";
-static char __pyx_k_186[] = "Samfile.seek (line 691)";
-static char __pyx_k_187[] = "Samfile.tell (line 702)";
-static char __pyx_k_188[] = "Samfile.fetch (line 713)";
-static char __pyx_k_189[] = "Samfile.mate (line 782)";
-static char __pyx_k_190[] = "Samfile.count (line 825)";
-static char __pyx_k_191[] = "Samfile.pileup (line 869)";
-static char __pyx_k_192[] = "Samfile.close (line 953)";
-static char __pyx_k_193[] = "Samfile.write (line 969)";
-static char __pyx_k_194[] = "Samfile._buildLine (line 1078)";
-static char __pyx_k_195[] = "Samfile.__next__ (line 1173)";
-static char __pyx_k_196[] = "IteratorRowRegion.__next__ (line 1281)";
-static char __pyx_k_197[] = "IteratorRowAll.__next__ (line 1340)";
-static char __pyx_k_198[] = "IteratorRowAllRefs.__next__ (line 1375)";
-static char __pyx_k_199[] = "IteratorRowSelection.__next__ (line 1459)";
-static char __pyx_k_200[] = "IteratorRowSelection";
-static char __pyx_k_201[] = "IteratorColumn.addReference (line 1634)";
-static char __pyx_k_202[] = "IteratorColumn.hasReference (line 1642)";
-static char __pyx_k_203[] = "IteratorColumnRegion.__next__ (line 1724)";
-static char __pyx_k_204[] = "IteratorColumnRegion";
-static char __pyx_k_205[] = "IteratorColumnAllRefs.__next__ (line 1755)";
-static char __pyx_k_206[] = "IteratorColumnAllRefs";
-static char __pyx_k_207[] = "AlignedRead.__str__ (line 1903)";
-static char __pyx_k_208[] = "AlignedRead.compare (line 1928)";
-static char __pyx_k_209[] = "AlignedRead.overlap (line 2512)";
-static char __pyx_k_210[] = "AlignedRead.opt (line 2541)";
-static char __pyx_k_211[] = "AlignedRead.fancy_str (line 2563)";
-static char __pyx_k_212[] = "Outs.setdevice (line 2705)";
-static char __pyx_k_213[] = "Outs.setfile (line 2710)";
-static char __pyx_k_214[] = "Outs.restore (line 2723)";
-static char __pyx_k_215[] = "_samtools_dispatch (line 2734)";
-static char __pyx_k_216[] = "IteratorSNPCalls.__next__ (line 2969)";
-static char __pyx_k_217[] = "SNPCaller.call (line 3041)";
-static char __pyx_k_218[] = "IndelCaller.call (line 3306)";
-static char __pyx_k_219[] = "IteratorIndelCalls.__next__ (line 3353)";
-static char __pyx_k_220[] = "IndexedReads.build (line 3406)";
+static char __pyx_k_100[] = "invalid type for record %s: %s, expected %s";
+static char __pyx_k_101[] = "incomplete sequence information in '%s'";
+static char __pyx_k_103[] = "can not iterate over samfile without header";
+static char __pyx_k_106[] = "no index available for iteration";
+static char __pyx_k_112[] = "can only use this iterator on bam files";
+static char __pyx_k_113[] = "reference sequence for '%s' (tid=%i) not found";
+static char __pyx_k_114[] = "unknown stepper option `%s` in IteratorColumn";
+static char __pyx_k_116[] = "error during iteration";
+static char __pyx_k_119[] = "Invalid clipping in CIGAR string";
+static char __pyx_k_120[] = "quality and sequence mismatch: %i != %i";
+static char __pyx_k_121[] = "%c";
+static char __pyx_k_122[] = "create_string_buffer";
+static char __pyx_k_123[] = "<cccf";
+static char __pyx_k_124[] = "<cccb";
+static char __pyx_k_125[] = "<ccch";
+static char __pyx_k_126[] = "integer %i out of range of BAM/SAM specification";
+static char __pyx_k_127[] = "<ccci";
+static char __pyx_k_128[] = "<cccB";
+static char __pyx_k_129[] = "<cccH";
+static char __pyx_k_130[] = "<cccI";
+static char __pyx_k_131[] = "<cccc";
+static char __pyx_k_132[] = "<ccc%is";
+static char __pyx_k_133[] = "tags field too large";
+static char __pyx_k_135[] = "tag '%s' not present";
+static char __pyx_k_136[] = "Contig index";
+static char __pyx_k_137[] = "Mapped position on contig";
+static char __pyx_k_138[] = "Contig index for mate pair";
+static char __pyx_k_139[] = "Position of mate pair";
+static char __pyx_k_140[] = "Insert size";
+static char __pyx_k_141[] = "Binary flag";
+static char __pyx_k_142[] = "Count of cigar entries";
+static char __pyx_k_143[] = "Cigar entries";
+static char __pyx_k_144[] = "Mapping quality";
+static char __pyx_k_145[] = "Bam index bin number";
+static char __pyx_k_146[] = "Length of query name";
+static char __pyx_k_147[] = "Query name";
+static char __pyx_k_148[] = "Length of query sequence";
+static char __pyx_k_149[] = "Query sequence";
+static char __pyx_k_150[] = "Quality scores";
+static char __pyx_k_151[] = "Length of auxilary data";
+static char __pyx_k_152[] = "Maximum data length";
+static char __pyx_k_153[] = "Current data length";
+static char __pyx_k_154[] = "%-30s %-10s= %s";
+static char __pyx_k_155[] = "(";
+static char __pyx_k_156[] = ")";
+static char __pyx_k_157[] = "This class cannot be instantiated from Python";
+static char __pyx_k_162[] = "No such file or directory: '%s'";
+static char __pyx_k_163[] = "-o";
+static char __pyx_k_164[] = "option -o is forbidden in samtools view";
+static char __pyx_k_166[] = "_rms_mapping_quality";
+static char __pyx_k_167[] = "can only IndexReads on bam files";
+static char __pyx_k_168[] = "read %s not found";
+static char __pyx_k_169[] = "the query name (None if not present)";
+static char __pyx_k_170[] = "the :term:`cigar` alignment (None if not present).\n        ";
+static char __pyx_k_171[] = "read sequence bases, including :term:`soft clipped` bases (None if not present)";
+static char __pyx_k_172[] = "read sequence base qualities, including :term:`soft clipped` bases (None if not present)";
+static char __pyx_k_173[] = "aligned portion of the read and excludes any flanking bases that were :term:`soft clipped` (None if not present)\n\n        SAM/BAM files may included extra flanking bases sequences that were\n        not part of the alignment.  These bases may be the result of the\n        Smith-Waterman or other algorithms, which may not require alignments\n        that begin at the first residue or end at the last.  In addition,\n        extra sequencing adapters, multiplex identifiers, and low-quality bases that\n        were not considered for alignment may have been retained.";
+static char __pyx_k_174[] = "aligned query sequence quality values (None if not present)";
+static char __pyx_k_175[] = "start index of the aligned query portion of the sequence (0-based, inclusive)";
+static char __pyx_k_176[] = "end index of the aligned query portion of the sequence (0-based, exclusive)";
+static char __pyx_k_177[] = "Length of the aligned query sequence";
+static char __pyx_k_178[] = "the tags in the AUX field.\n\n        This property permits convenience access to \n        the tags. Changes it the returned list will\n        not update the tags automatically. Instead,\n        the following is required for adding a \n        new tag::\n\n            read.tags = read.tags + [(\"RG\",0)]\n\n\n        This method will happily write the same tag\n        multiple times.\n        ";
+static char __pyx_k_179[] = "properties flag";
+static char __pyx_k_180[] = "\n        :term:`target` ID\n\n        DEPRECATED from pysam-0.4 - use tid in the future.\n        The rname field caused a lot of confusion as it returns\n        the :term:`target` ID instead of the reference sequence\n        name.\n\n        .. note::\n\n            This field contains the index of the reference sequence \n            in the sequence dictionary. To obtain the name\n            of the reference sequence, use :meth:`pysam.Samfile.getrname()`\n            \n        ";
+static char __pyx_k_181[] = "\n        :term:`target` ID\n\n        .. note::\n\n            This field contains the index of the reference sequence \n            in the sequence dictionary. To obtain the name\n            of the reference sequence, use :meth:`pysam.Samfile.getrname()`\n            \n        ";
+static char __pyx_k_182[] = "0-based leftmost coordinate";
+static char __pyx_k_183[] = "properties bin";
+static char __pyx_k_184[] = "length of the read (read only). Returns 0 if not given.";
+static char __pyx_k_185[] = "aligned end position of the read on the reference genome.  Returns\n        None if not available.";
+static char __pyx_k_186[] = "aligned length of the read on the reference genome.  Returns None if\n        not available.";
+static char __pyx_k_187[] = "mapping quality";
+static char __pyx_k_188[] = "the :term:`reference` id of the mate \n        deprecated, use RNEXT instead.\n        ";
+static char __pyx_k_189[] = "the :term:`reference` id of the mate ";
+static char __pyx_k_190[] = "the position of the mate\n        deprecated, use PNEXT instead.";
+static char __pyx_k_191[] = "the position of the mate";
+static char __pyx_k_192[] = "the insert size\n        deprecated: use tlen instead";
+static char __pyx_k_193[] = "the insert size";
+static char __pyx_k_194[] = "true if read is paired in sequencing";
+static char __pyx_k_195[] = "true if read is mapped in a proper pair";
+static char __pyx_k_196[] = "true if read itself is unmapped";
+static char __pyx_k_197[] = "true if the mate is unmapped";
+static char __pyx_k_198[] = "true if read is mapped to reverse strand";
+static char __pyx_k_199[] = "true is read is mapped to reverse strand";
+static char __pyx_k_200[] = "true if this is read1";
+static char __pyx_k_201[] = "true if this is read2";
+static char __pyx_k_202[] = "true if not primary alignment";
+static char __pyx_k_203[] = "true if QC failure";
+static char __pyx_k_204[] = "true if optical or PCR duplicate";
+static char __pyx_k_205[] = "a list of reference positions that this read aligns to.";
+static char __pyx_k_206[] = "number of :term:`filename` associated with this object.";
+static char __pyx_k_207[] = "number of :term:`reference` sequences in the file.";
+static char __pyx_k_208[] = "tuple with the names of :term:`reference` sequences.";
+static char __pyx_k_209[] = "tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as \n        :attr:`pysam.Samfile.references`\n        ";
+static char __pyx_k_210[] = "total number of mapped reads in file.\n        ";
+static char __pyx_k_211[] = "total number of unmapped reads in file.\n        ";
+static char __pyx_k_212[] = "full contents of the :term:`sam file` header as a string.";
+static char __pyx_k_213[] = "header information within the :term:`sam file`. The records and fields are returned as \n        a two-level dictionary.\n        ";
+static char __pyx_k_214[] = "the chromosome ID as is defined in the header";
+static char __pyx_k_215[] = "number of reads mapping to this column.";
+static char __pyx_k_216[] = "list of reads (:class:`pysam.PileupRead`) aligned to this column";
+static char __pyx_k_217[] = "a :class:`pysam.AlignedRead` object of the aligned read";
+static char __pyx_k_218[] = "position of the read base at the pileup site, 0-based";
+static char __pyx_k_219[] = "indel length; 0 for no indel, positive for ins and negative for del";
+static char __pyx_k_220[] = "1 iff the base on the padded read is a deletion";
+static char __pyx_k_221[] = "current sequence length.";
+static char __pyx_k_222[] = "nucleotide position of SNP.";
+static char __pyx_k_223[] = "reference base at pos. ``N`` if no reference sequence supplied.";
+static char __pyx_k_224[] = "the genotype called.";
+static char __pyx_k_225[] = "the genotype quality (Phred-scaled).";
+static char __pyx_k_226[] = "the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.";
+static char __pyx_k_227[] = "the root mean square (rms) of the mapping quality of all reads involved in the call.";
+static char __pyx_k_228[] = "coverage or read depth - the number of reads involved in the call.";
+static char __pyx_k_229[] = "=ACMGRSVTWYHKDBN";
+static char __pyx_k_230[] = "A pileup column. A pileup column contains  \n    all the reads that map to a certain target base.\n\n    tid      \n        chromosome ID as is defined in the header      \n    pos      \n        the target base coordinate (0-based)    \n    n \n        number of reads mapping to this column  \n    pileups  \n        list of reads (:class:`pysam.PileupRead`) aligned to this column    \n    ";
+static char __pyx_k_231[] = "\n    stderr is captured. \n    ";
+static char __pyx_k_232[] = "does nothing. stderr can't be redirected on windows";
+static char __pyx_k_238[] = "http://mail.python.org/pipermail/python-list/2000-June/038406.html";
 static char __pyx_k__AS[] = "AS";
 static char __pyx_k__CL[] = "CL";
 static char __pyx_k__CN[] = "CN";
@@ -1627,11 +1477,11 @@ static char __pyx_k__SP[] = "SP";
 static char __pyx_k__SQ[] = "SQ";
 static char __pyx_k__UR[] = "UR";
 static char __pyx_k__VN[] = "VN";
-static char __pyx_k___r[] = "_r";
 static char __pyx_k__fd[] = "fd";
 static char __pyx_k__fp[] = "fp";
 static char __pyx_k__id[] = "id";
 static char __pyx_k__os[] = "os";
+static char __pyx_k__rU[] = "rU";
 static char __pyx_k__rb[] = "rb";
 static char __pyx_k__re[] = "re";
 static char __pyx_k__wb[] = "wb";
@@ -1645,10 +1495,8 @@ static char __pyx_k__cmp[] = "cmp";
 static char __pyx_k__dup[] = "dup";
 static char __pyx_k__end[] = "end";
 static char __pyx_k__map[] = "map";
-static char __pyx_k__opt[] = "opt";
 static char __pyx_k__plp[] = "plp";
 static char __pyx_k__pos[] = "pos";
-static char __pyx_k__q_r[] = "q_r";
 static char __pyx_k__raw[] = "raw";
 static char __pyx_k__seq[] = "seq";
 static char __pyx_k__sys[] = "sys";
@@ -1658,9 +1506,6 @@ static char __pyx_k__Outs[] = "Outs";
 static char __pyx_k___pos[] = "_pos";
 static char __pyx_k___tid[] = "_tid";
 static char __pyx_k__args[] = "args";
-static char __pyx_k__call[] = "call";
-static char __pyx_k__cnt1[] = "cnt1";
-static char __pyx_k__cnt2[] = "cnt2";
 static char __pyx_k__core[] = "core";
 static char __pyx_k__data[] = "data";
 static char __pyx_k__dup2[] = "dup2";
@@ -1687,19 +1532,14 @@ static char __pyx_k__rlen[] = "rlen";
 static char __pyx_k__seek[] = "seek";
 static char __pyx_k__self[] = "self";
 static char __pyx_k__tags[] = "tags";
-static char __pyx_k__tell[] = "tell";
 static char __pyx_k__text[] = "text";
 static char __pyx_k__view[] = "view";
-static char __pyx_k___call[] = "_call";
 static char __pyx_k___open[] = "_open";
 static char __pyx_k___qpos[] = "_qpos";
 static char __pyx_k__bqual[] = "bqual";
-static char __pyx_k__build[] = "build";
 static char __pyx_k__cigar[] = "cigar";
 static char __pyx_k__close[] = "close";
 static char __pyx_k__cnext[] = "cnext";
-static char __pyx_k__count[] = "count";
-static char __pyx_k__fetch[] = "fetch";
 static char __pyx_k__flush[] = "flush";
 static char __pyx_k__indel[] = "indel";
 static char __pyx_k__index[] = "index";
@@ -1707,33 +1547,25 @@ static char __pyx_k__isbam[] = "isbam";
 static char __pyx_k__isize[] = "isize";
 static char __pyx_k__l_aux[] = "l_aux";
 static char __pyx_k__level[] = "level";
-static char __pyx_k__n_hap[] = "n_hap";
 static char __pyx_k__n_plp[] = "n_plp";
-static char __pyx_k__q_cns[] = "q_cns";
-static char __pyx_k__q_ref[] = "q_ref";
 static char __pyx_k__qname[] = "qname";
-static char __pyx_k__range[] = "range";
-static char __pyx_k__reset[] = "reset";
 static char __pyx_k__rname[] = "rname";
 static char __pyx_k__setfd[] = "setfd";
 static char __pyx_k__split[] = "split";
 static char __pyx_k__start[] = "start";
 static char __pyx_k__strip[] = "strip";
-static char __pyx_k__theta[] = "theta";
 static char __pyx_k__types[] = "types";
 static char __pyx_k__where[] = "where";
 static char __pyx_k__write[] = "write";
 static char __pyx_k___indel[] = "_indel";
 static char __pyx_k___level[] = "_level";
+static char __pyx_k__append[] = "append";
 static char __pyx_k__ctypes[] = "ctypes";
-static char __pyx_k__errmod[] = "errmod";
 static char __pyx_k__exists[] = "exists";
 static char __pyx_k__fields[] = "fields";
 static char __pyx_k__fileno[] = "fileno";
 static char __pyx_k__gettid[] = "gettid";
 static char __pyx_k__header[] = "header";
-static char __pyx_k__indel1[] = "indel1";
-static char __pyx_k__indel2[] = "indel2";
 static char __pyx_k__is_del[] = "is_del";
 static char __pyx_k__l_qseq[] = "l_qseq";
 static char __pyx_k__l_text[] = "l_text";
@@ -1741,7 +1573,6 @@ static char __pyx_k__m_data[] = "m_data";
 static char __pyx_k__method[] = "method";
 static char __pyx_k__object[] = "object";
 static char __pyx_k__offset[] = "offset";
-static char __pyx_k__pileup[] = "pileup";
 static char __pyx_k__record[] = "record";
 static char __pyx_k__region[] = "region";
 static char __pyx_k__remove[] = "remove";
@@ -1754,6 +1585,7 @@ static char __pyx_k__struct[] = "struct";
 static char __pyx_k__system[] = "system";
 static char __pyx_k__IOError[] = "IOError";
 static char __pyx_k__IntType[] = "IntType";
+static char __pyx_k__OSError[] = "OSError";
 static char __pyx_k__O_CREAT[] = "O_CREAT";
 static char __pyx_k__Samfile[] = "Samfile";
 static char __pyx_k__Windows[] = "Windows";
@@ -1762,7 +1594,6 @@ static char __pyx_k____del__[] = "__del__";
 static char __pyx_k____str__[] = "__str__";
 static char __pyx_k___isOpen[] = "_isOpen";
 static char __pyx_k___is_del[] = "_is_del";
-static char __pyx_k__compare[] = "compare";
 static char __pyx_k__devnull[] = "devnull";
 static char __pyx_k__is_head[] = "is_head";
 static char __pyx_k__is_tail[] = "is_tail";
@@ -1770,11 +1601,7 @@ static char __pyx_k__isupper[] = "isupper";
 static char __pyx_k__l_qname[] = "l_qname";
 static char __pyx_k__mkstemp[] = "mkstemp";
 static char __pyx_k__n_cigar[] = "n_cigar";
-static char __pyx_k__options[] = "options";
-static char __pyx_k__overlap[] = "overlap";
 static char __pyx_k__pileups[] = "pileups";
-static char __pyx_k__q_indel[] = "q_indel";
-static char __pyx_k__r_indel[] = "r_indel";
 static char __pyx_k__release[] = "release";
 static char __pyx_k__restore[] = "restore";
 static char __pyx_k__rowiter[] = "rowiter";
@@ -1789,23 +1616,19 @@ static char __pyx_k__O_WRONLY[] = "O_WRONLY";
 static char __pyx_k____dict__[] = "__dict__";
 static char __pyx_k____init__[] = "__init__";
 static char __pyx_k____main__[] = "__main__";
-static char __pyx_k____next__[] = "__next__";
 static char __pyx_k____test__[] = "__test__";
 static char __pyx_k___is_head[] = "_is_head";
 static char __pyx_k___is_tail[] = "_is_tail";
 static char __pyx_k___logfile[] = "_logfile";
 static char __pyx_k__calcsize[] = "calcsize";
 static char __pyx_k__callback[] = "callback";
-static char __pyx_k__cap_mapQ[] = "cap_mapQ";
-static char __pyx_k__cnt_anti[] = "cnt_anti";
 static char __pyx_k__coverage[] = "coverage";
 static char __pyx_k__data_len[] = "data_len";
 static char __pyx_k__exc_type[] = "exc_type";
 static char __pyx_k__filename[] = "filename";
 static char __pyx_k__genotype[] = "genotype";
-static char __pyx_k__getrname[] = "getrname";
-static char __pyx_k__het_rate[] = "het_rate";
 static char __pyx_k__isremote[] = "isremote";
+static char __pyx_k__isstream[] = "isstream";
 static char __pyx_k__iterdata[] = "iterdata";
 static char __pyx_k__nextiter[] = "nextiter";
 static char __pyx_k__platform[] = "platform";
@@ -1816,7 +1639,6 @@ static char __pyx_k__tempfile[] = "tempfile";
 static char __pyx_k__template[] = "template";
 static char __pyx_k__Fastafile[] = "Fastafile";
 static char __pyx_k__FloatType[] = "FloatType";
-static char __pyx_k__SNPCaller[] = "SNPCaller";
 static char __pyx_k__TypeError[] = "TypeError";
 static char __pyx_k___coverage[] = "_coverage";
 static char __pyx_k___delegate[] = "_delegate";
@@ -1824,12 +1646,11 @@ static char __pyx_k___filename[] = "_filename";
 static char __pyx_k___genotype[] = "_genotype";
 static char __pyx_k___hasIndex[] = "_hasIndex";
 static char __pyx_k__alignment[] = "alignment";
+static char __pyx_k__csamtools[] = "csamtools";
 static char __pyx_k__exc_value[] = "exc_value";
-static char __pyx_k__fancy_str[] = "fancy_str";
 static char __pyx_k__fastafile[] = "fastafile";
 static char __pyx_k__itertools[] = "itertools";
 static char __pyx_k__max_depth[] = "max_depth";
-static char __pyx_k__min_baseQ[] = "min_baseQ";
 static char __pyx_k__n_targets[] = "n_targets";
 static char __pyx_k__pack_into[] = "pack_into";
 static char __pyx_k__positions[] = "positions";
@@ -1842,21 +1663,18 @@ static char __pyx_k__PileupRead[] = "PileupRead";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k___alignment[] = "_alignment";
 static char __pyx_k___buildLine[] = "_buildLine";
-static char __pyx_k__reads_diff[] = "reads_diff";
 static char __pyx_k__startswith[] = "startswith";
 static char __pyx_k__target_len[] = "target_len";
 static char __pyx_k__AlignedRead[] = "AlignedRead";
-static char __pyx_k__IndelCaller[] = "IndelCaller";
 static char __pyx_k__IteratorRow[] = "IteratorRow";
 static char __pyx_k__PileupProxy[] = "PileupProxy";
 static char __pyx_k__StderrStore[] = "StderrStore";
+static char __pyx_k__add_sq_text[] = "add_sq_text";
 static char __pyx_k__collections[] = "collections";
 static char __pyx_k__current_pos[] = "current_pos";
 static char __pyx_k__defaultdict[] = "defaultdict";
-static char __pyx_k__getSequence[] = "getSequence";
 static char __pyx_k__nreferences[] = "nreferences";
 static char __pyx_k__pileup_iter[] = "pileup_iter";
-static char __pyx_k__reads_first[] = "reads_first";
 static char __pyx_k__snp_quality[] = "snp_quality";
 static char __pyx_k__stderr_save[] = "stderr_save";
 static char __pyx_k__target_name[] = "target_name";
@@ -1865,34 +1683,24 @@ static char __pyx_k__PileupColumn[] = "PileupColumn";
 static char __pyx_k___buildHeader[] = "_buildHeader";
 static char __pyx_k___parseRegion[] = "_parseRegion";
 static char __pyx_k___snp_quality[] = "_snp_quality";
-static char __pyx_k__addReference[] = "addReference";
 static char __pyx_k__catch_stderr[] = "catch_stderr";
 static char __pyx_k__catch_stdout[] = "catch_stdout";
-static char __pyx_k__first_allele[] = "first_allele";
-static char __pyx_k__hasReference[] = "hasReference";
-static char __pyx_k__n_haplotypes[] = "n_haplotypes";
 static char __pyx_k__owns_samfile[] = "owns_samfile";
-static char __pyx_k__reads_second[] = "reads_second";
+static char __pyx_k__start_offset[] = "start_offset";
 static char __pyx_k__OverflowError[] = "OverflowError";
 static char __pyx_k__StopIteration[] = "StopIteration";
 static char __pyx_k__VALID_HEADERS[] = "VALID_HEADERS";
-static char __pyx_k__second_allele[] = "second_allele";
+static char __pyx_k__AttributeError[] = "AttributeError";
 static char __pyx_k__IteratorColumn[] = "IteratorColumn";
-static char __pyx_k__IteratorRowAll[] = "IteratorRowAll";
 static char __pyx_k__readAndRelease[] = "readAndRelease";
 static char __pyx_k__reference_base[] = "reference_base";
 static char __pyx_k__referencenames[] = "referencenames";
 static char __pyx_k___reference_base[] = "_reference_base";
-static char __pyx_k__iterator_column[] = "iterator_column";
 static char __pyx_k__mapping_quality[] = "mapping_quality";
-static char __pyx_k__IteratorSNPCalls[] = "IteratorSNPCalls";
 static char __pyx_k____getattribute__[] = "__getattribute__";
 static char __pyx_k__referencelengths[] = "referencelengths";
-static char __pyx_k__IteratorRowRegion[] = "IteratorRowRegion";
 static char __pyx_k__consensus_quality[] = "consensus_quality";
 static char __pyx_k__setupIteratorData[] = "setupIteratorData";
-static char __pyx_k__IteratorIndelCalls[] = "IteratorIndelCalls";
-static char __pyx_k__IteratorRowAllRefs[] = "IteratorRowAllRefs";
 static char __pyx_k__StderrStoreWindows[] = "StderrStoreWindows";
 static char __pyx_k__VALID_HEADER_ORDER[] = "VALID_HEADER_ORDER";
 static char __pyx_k__VALID_HEADER_TYPES[] = "VALID_HEADER_TYPES";
@@ -1901,159 +1709,113 @@ static char __pyx_k___samtools_dispatch[] = "_samtools_dispatch";
 static char __pyx_k__NotImplementedError[] = "NotImplementedError";
 static char __pyx_k__VALID_HEADER_FIELDS[] = "VALID_HEADER_FIELDS";
 static PyObject *__pyx_kp_s_1;
-static PyObject *__pyx_kp_s_10;
 static PyObject *__pyx_kp_s_100;
 static PyObject *__pyx_kp_s_101;
-static PyObject *__pyx_kp_s_102;
-static PyObject *__pyx_n_s_103;
-static PyObject *__pyx_kp_s_104;
-static PyObject *__pyx_kp_s_105;
-static PyObject *__pyx_kp_s_107;
-static PyObject *__pyx_kp_s_108;
-static PyObject *__pyx_kp_s_109;
+static PyObject *__pyx_kp_s_103;
+static PyObject *__pyx_kp_s_106;
 static PyObject *__pyx_kp_s_11;
-static PyObject *__pyx_kp_s_110;
-static PyObject *__pyx_kp_s_111;
 static PyObject *__pyx_kp_s_112;
 static PyObject *__pyx_kp_s_113;
+static PyObject *__pyx_kp_s_114;
+static PyObject *__pyx_kp_s_116;
 static PyObject *__pyx_kp_s_12;
+static PyObject *__pyx_kp_s_120;
+static PyObject *__pyx_kp_s_121;
+static PyObject *__pyx_n_s_122;
+static PyObject *__pyx_kp_s_123;
+static PyObject *__pyx_kp_s_124;
+static PyObject *__pyx_kp_s_125;
+static PyObject *__pyx_kp_s_126;
+static PyObject *__pyx_kp_s_127;
+static PyObject *__pyx_kp_s_128;
+static PyObject *__pyx_kp_s_129;
+static PyObject *__pyx_kp_s_13;
+static PyObject *__pyx_kp_s_130;
+static PyObject *__pyx_kp_s_131;
+static PyObject *__pyx_kp_s_132;
+static PyObject *__pyx_kp_s_133;
+static PyObject *__pyx_kp_s_135;
+static PyObject *__pyx_kp_s_136;
+static PyObject *__pyx_kp_s_137;
+static PyObject *__pyx_kp_s_138;
+static PyObject *__pyx_kp_s_139;
+static PyObject *__pyx_kp_s_14;
+static PyObject *__pyx_kp_s_140;
+static PyObject *__pyx_kp_s_141;
+static PyObject *__pyx_kp_s_142;
+static PyObject *__pyx_kp_s_143;
+static PyObject *__pyx_kp_s_144;
+static PyObject *__pyx_kp_s_145;
+static PyObject *__pyx_kp_s_146;
+static PyObject *__pyx_kp_s_147;
+static PyObject *__pyx_kp_s_148;
+static PyObject *__pyx_kp_s_149;
 static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_kp_s_16;
-static PyObject *__pyx_kp_s_173;
-static PyObject *__pyx_kp_s_174;
-static PyObject *__pyx_kp_s_175;
-static PyObject *__pyx_kp_s_176;
-static PyObject *__pyx_kp_u_177;
-static PyObject *__pyx_kp_u_178;
-static PyObject *__pyx_kp_u_179;
-static PyObject *__pyx_kp_s_18;
-static PyObject *__pyx_kp_u_180;
-static PyObject *__pyx_kp_u_181;
-static PyObject *__pyx_kp_u_182;
-static PyObject *__pyx_kp_u_183;
-static PyObject *__pyx_kp_u_184;
-static PyObject *__pyx_kp_u_185;
-static PyObject *__pyx_kp_u_186;
-static PyObject *__pyx_kp_u_187;
-static PyObject *__pyx_kp_u_188;
-static PyObject *__pyx_kp_u_189;
-static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_u_190;
-static PyObject *__pyx_kp_u_191;
-static PyObject *__pyx_kp_u_192;
-static PyObject *__pyx_kp_u_193;
-static PyObject *__pyx_kp_u_194;
-static PyObject *__pyx_kp_u_195;
-static PyObject *__pyx_kp_u_196;
-static PyObject *__pyx_kp_u_197;
-static PyObject *__pyx_kp_u_198;
-static PyObject *__pyx_kp_u_199;
+static PyObject *__pyx_kp_s_150;
+static PyObject *__pyx_kp_s_151;
+static PyObject *__pyx_kp_s_152;
+static PyObject *__pyx_kp_s_153;
+static PyObject *__pyx_kp_s_154;
+static PyObject *__pyx_kp_s_155;
+static PyObject *__pyx_kp_s_156;
+static PyObject *__pyx_kp_s_157;
+static PyObject *__pyx_kp_s_162;
+static PyObject *__pyx_kp_s_163;
+static PyObject *__pyx_kp_s_164;
+static PyObject *__pyx_n_s_166;
+static PyObject *__pyx_kp_s_167;
+static PyObject *__pyx_kp_s_168;
+static PyObject *__pyx_kp_s_17;
 static PyObject *__pyx_kp_s_2;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_n_s_200;
-static PyObject *__pyx_kp_u_201;
-static PyObject *__pyx_kp_u_202;
-static PyObject *__pyx_kp_u_203;
-static PyObject *__pyx_n_s_204;
-static PyObject *__pyx_kp_u_205;
-static PyObject *__pyx_n_s_206;
-static PyObject *__pyx_kp_u_207;
-static PyObject *__pyx_kp_u_208;
-static PyObject *__pyx_kp_u_209;
 static PyObject *__pyx_kp_s_21;
-static PyObject *__pyx_kp_u_210;
-static PyObject *__pyx_kp_u_211;
-static PyObject *__pyx_kp_u_212;
-static PyObject *__pyx_kp_u_213;
-static PyObject *__pyx_kp_u_214;
-static PyObject *__pyx_kp_u_215;
-static PyObject *__pyx_kp_u_216;
-static PyObject *__pyx_kp_u_217;
-static PyObject *__pyx_kp_u_218;
-static PyObject *__pyx_kp_u_219;
 static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_u_220;
 static PyObject *__pyx_kp_s_23;
+static PyObject *__pyx_kp_s_230;
+static PyObject *__pyx_kp_s_231;
+static PyObject *__pyx_kp_s_232;
+static PyObject *__pyx_kp_s_238;
 static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_kp_s_25;
 static PyObject *__pyx_kp_s_26;
 static PyObject *__pyx_kp_s_27;
 static PyObject *__pyx_kp_s_28;
 static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_s_30;
 static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_32;
 static PyObject *__pyx_kp_s_33;
-static PyObject *__pyx_kp_s_34;
 static PyObject *__pyx_kp_s_35;
 static PyObject *__pyx_kp_s_36;
-static PyObject *__pyx_kp_s_37;
 static PyObject *__pyx_kp_s_38;
-static PyObject *__pyx_kp_s_4;
 static PyObject *__pyx_kp_s_40;
-static PyObject *__pyx_kp_s_41;
-static PyObject *__pyx_kp_s_42;
-static PyObject *__pyx_kp_s_43;
-static PyObject *__pyx_kp_s_44;
-static PyObject *__pyx_kp_s_45;
 static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_47;
 static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_49;
 static PyObject *__pyx_kp_s_5;
 static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_51;
 static PyObject *__pyx_kp_s_52;
-static PyObject *__pyx_kp_s_53;
 static PyObject *__pyx_kp_s_54;
-static PyObject *__pyx_kp_s_55;
 static PyObject *__pyx_kp_s_56;
-static PyObject *__pyx_kp_s_57;
+static PyObject *__pyx_kp_s_58;
 static PyObject *__pyx_kp_s_59;
 static PyObject *__pyx_kp_s_6;
-static PyObject *__pyx_kp_s_61;
-static PyObject *__pyx_kp_s_62;
-static PyObject *__pyx_n_s_63;
-static PyObject *__pyx_kp_s_64;
+static PyObject *__pyx_kp_s_60;
 static PyObject *__pyx_kp_s_65;
-static PyObject *__pyx_kp_s_66;
-static PyObject *__pyx_kp_s_67;
 static PyObject *__pyx_kp_s_68;
-static PyObject *__pyx_kp_s_69;
-static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_kp_s_70;
 static PyObject *__pyx_kp_s_71;
-static PyObject *__pyx_kp_s_72;
-static PyObject *__pyx_kp_s_73;
 static PyObject *__pyx_kp_s_74;
-static PyObject *__pyx_kp_s_75;
-static PyObject *__pyx_kp_s_76;
-static PyObject *__pyx_kp_s_77;
-static PyObject *__pyx_kp_s_78;
-static PyObject *__pyx_kp_s_79;
-static PyObject *__pyx_kp_s_8;
-static PyObject *__pyx_kp_s_80;
 static PyObject *__pyx_kp_s_81;
-static PyObject *__pyx_kp_s_82;
-static PyObject *__pyx_kp_s_83;
 static PyObject *__pyx_kp_s_84;
-static PyObject *__pyx_kp_s_85;
-static PyObject *__pyx_kp_s_86;
-static PyObject *__pyx_kp_s_87;
-static PyObject *__pyx_kp_s_88;
 static PyObject *__pyx_kp_s_89;
 static PyObject *__pyx_kp_s_9;
-static PyObject *__pyx_kp_s_90;
 static PyObject *__pyx_kp_s_91;
-static PyObject *__pyx_kp_s_92;
 static PyObject *__pyx_kp_s_93;
 static PyObject *__pyx_kp_s_94;
-static PyObject *__pyx_kp_s_95;
 static PyObject *__pyx_kp_s_96;
 static PyObject *__pyx_kp_s_97;
+static PyObject *__pyx_kp_s_98;
+static PyObject *__pyx_kp_s_99;
 static PyObject *__pyx_n_s__A;
 static PyObject *__pyx_n_s__AS;
 static PyObject *__pyx_n_s__AlignedRead;
+static PyObject *__pyx_n_s__AttributeError;
 static PyObject *__pyx_n_s__C;
 static PyObject *__pyx_n_s__CL;
 static PyObject *__pyx_n_s__CN;
@@ -2070,21 +1832,16 @@ static PyObject *__pyx_n_s__HD;
 static PyObject *__pyx_n_s__I;
 static PyObject *__pyx_n_s__ID;
 static PyObject *__pyx_n_s__IOError;
-static PyObject *__pyx_n_s__IndelCaller;
 static PyObject *__pyx_n_s__IndexedReads;
 static PyObject *__pyx_n_s__IntType;
 static PyObject *__pyx_n_s__IteratorColumn;
-static PyObject *__pyx_n_s__IteratorIndelCalls;
 static PyObject *__pyx_n_s__IteratorRow;
-static PyObject *__pyx_n_s__IteratorRowAll;
-static PyObject *__pyx_n_s__IteratorRowAllRefs;
-static PyObject *__pyx_n_s__IteratorRowRegion;
-static PyObject *__pyx_n_s__IteratorSNPCalls;
 static PyObject *__pyx_n_s__KeyError;
 static PyObject *__pyx_n_s__LB;
 static PyObject *__pyx_n_s__LN;
 static PyObject *__pyx_n_s__M5;
 static PyObject *__pyx_n_s__NotImplementedError;
+static PyObject *__pyx_n_s__OSError;
 static PyObject *__pyx_n_s__O_CREAT;
 static PyObject *__pyx_n_s__O_WRONLY;
 static PyObject *__pyx_n_s__Outs;
@@ -2101,7 +1858,6 @@ static PyObject *__pyx_n_s__RG;
 static PyObject *__pyx_n_s__S;
 static PyObject *__pyx_n_s__SM;
 static PyObject *__pyx_n_s__SN;
-static PyObject *__pyx_n_s__SNPCaller;
 static PyObject *__pyx_n_s__SO;
 static PyObject *__pyx_n_s__SP;
 static PyObject *__pyx_n_s__SQ;
@@ -2125,13 +1881,11 @@ static PyObject *__pyx_n_s____dict__;
 static PyObject *__pyx_n_s____getattribute__;
 static PyObject *__pyx_n_s____init__;
 static PyObject *__pyx_n_s____main__;
-static PyObject *__pyx_n_s____next__;
 static PyObject *__pyx_n_s____str__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s___alignment;
 static PyObject *__pyx_n_s___buildHeader;
 static PyObject *__pyx_n_s___buildLine;
-static PyObject *__pyx_n_s___call;
 static PyObject *__pyx_n_s___consensus_quality;
 static PyObject *__pyx_n_s___coverage;
 static PyObject *__pyx_n_s___delegate;
@@ -2149,26 +1903,23 @@ static PyObject *__pyx_n_s___open;
 static PyObject *__pyx_n_s___parseRegion;
 static PyObject *__pyx_n_s___pos;
 static PyObject *__pyx_n_s___qpos;
-static PyObject *__pyx_n_s___r;
 static PyObject *__pyx_n_s___reference_base;
 static PyObject *__pyx_n_s___samtools_dispatch;
 static PyObject *__pyx_n_s___snp_quality;
 static PyObject *__pyx_n_s___tid;
-static PyObject *__pyx_n_s__addReference;
+static PyObject *__pyx_n_s__add_sq_text;
 static PyObject *__pyx_n_s__alignment;
 static PyObject *__pyx_n_s__all;
+static PyObject *__pyx_n_s__append;
 static PyObject *__pyx_n_s__args;
 static PyObject *__pyx_n_s__b;
 static PyObject *__pyx_n_s__bam;
 static PyObject *__pyx_n_s__beg;
 static PyObject *__pyx_n_s__bin;
 static PyObject *__pyx_n_s__bqual;
-static PyObject *__pyx_n_s__build;
 static PyObject *__pyx_n_s__c;
 static PyObject *__pyx_n_s__calcsize;
-static PyObject *__pyx_n_s__call;
 static PyObject *__pyx_n_s__callback;
-static PyObject *__pyx_n_s__cap_mapQ;
 static PyObject *__pyx_n_s__catch_stderr;
 static PyObject *__pyx_n_s__catch_stdout;
 static PyObject *__pyx_n_s__chr;
@@ -2176,15 +1927,11 @@ static PyObject *__pyx_n_s__cigar;
 static PyObject *__pyx_n_s__close;
 static PyObject *__pyx_n_s__cmp;
 static PyObject *__pyx_n_s__cnext;
-static PyObject *__pyx_n_s__cnt1;
-static PyObject *__pyx_n_s__cnt2;
-static PyObject *__pyx_n_s__cnt_anti;
 static PyObject *__pyx_n_s__collections;
-static PyObject *__pyx_n_s__compare;
 static PyObject *__pyx_n_s__consensus_quality;
 static PyObject *__pyx_n_s__core;
-static PyObject *__pyx_n_s__count;
 static PyObject *__pyx_n_s__coverage;
+static PyObject *__pyx_n_s__csamtools;
 static PyObject *__pyx_n_s__ctypes;
 static PyObject *__pyx_n_s__current_pos;
 static PyObject *__pyx_n_s__d;
@@ -2195,35 +1942,25 @@ static PyObject *__pyx_n_s__devnull;
 static PyObject *__pyx_n_s__dup;
 static PyObject *__pyx_n_s__dup2;
 static PyObject *__pyx_n_s__end;
-static PyObject *__pyx_n_s__errmod;
 static PyObject *__pyx_n_s__exc_type;
 static PyObject *__pyx_n_s__exc_value;
 static PyObject *__pyx_n_s__exists;
 static PyObject *__pyx_n_s__f;
-static PyObject *__pyx_n_s__fancy_str;
 static PyObject *__pyx_n_s__fastafile;
 static PyObject *__pyx_n_s__fd;
-static PyObject *__pyx_n_s__fetch;
 static PyObject *__pyx_n_s__fields;
 static PyObject *__pyx_n_s__filename;
 static PyObject *__pyx_n_s__fileno;
-static PyObject *__pyx_n_s__first_allele;
 static PyObject *__pyx_n_s__flag;
 static PyObject *__pyx_n_s__flush;
 static PyObject *__pyx_n_s__fp;
 static PyObject *__pyx_n_s__genotype;
-static PyObject *__pyx_n_s__getSequence;
-static PyObject *__pyx_n_s__getrname;
 static PyObject *__pyx_n_s__gettid;
-static PyObject *__pyx_n_s__hasReference;
 static PyObject *__pyx_n_s__hash;
 static PyObject *__pyx_n_s__header;
-static PyObject *__pyx_n_s__het_rate;
 static PyObject *__pyx_n_s__i;
 static PyObject *__pyx_n_s__id;
 static PyObject *__pyx_n_s__indel;
-static PyObject *__pyx_n_s__indel1;
-static PyObject *__pyx_n_s__indel2;
 static PyObject *__pyx_n_s__index;
 static PyObject *__pyx_n_s__is_del;
 static PyObject *__pyx_n_s__is_head;
@@ -2231,9 +1968,9 @@ static PyObject *__pyx_n_s__is_tail;
 static PyObject *__pyx_n_s__isbam;
 static PyObject *__pyx_n_s__isize;
 static PyObject *__pyx_n_s__isremote;
+static PyObject *__pyx_n_s__isstream;
 static PyObject *__pyx_n_s__isupper;
 static PyObject *__pyx_n_s__iter;
-static PyObject *__pyx_n_s__iterator_column;
 static PyObject *__pyx_n_s__iterdata;
 static PyObject *__pyx_n_s__itertools;
 static PyObject *__pyx_n_s__join;
@@ -2250,7 +1987,6 @@ static PyObject *__pyx_n_s__mask;
 static PyObject *__pyx_n_s__mate;
 static PyObject *__pyx_n_s__max_depth;
 static PyObject *__pyx_n_s__method;
-static PyObject *__pyx_n_s__min_baseQ;
 static PyObject *__pyx_n_s__mkstemp;
 static PyObject *__pyx_n_s__mode;
 static PyObject *__pyx_n_s__mpos;
@@ -2258,8 +1994,6 @@ static PyObject *__pyx_n_s__mrnm;
 static PyObject *__pyx_n_s__mtid;
 static PyObject *__pyx_n_s__n;
 static PyObject *__pyx_n_s__n_cigar;
-static PyObject *__pyx_n_s__n_hap;
-static PyObject *__pyx_n_s__n_haplotypes;
 static PyObject *__pyx_n_s__n_plp;
 static PyObject *__pyx_n_s__n_pu;
 static PyObject *__pyx_n_s__n_targets;
@@ -2269,14 +2003,10 @@ static PyObject *__pyx_n_s__nreferences;
 static PyObject *__pyx_n_s__object;
 static PyObject *__pyx_n_s__offset;
 static PyObject *__pyx_n_s__open;
-static PyObject *__pyx_n_s__opt;
-static PyObject *__pyx_n_s__options;
 static PyObject *__pyx_n_s__os;
-static PyObject *__pyx_n_s__overlap;
 static PyObject *__pyx_n_s__owns_samfile;
 static PyObject *__pyx_n_s__pack_into;
 static PyObject *__pyx_n_s__path;
-static PyObject *__pyx_n_s__pileup;
 static PyObject *__pyx_n_s__pileup_iter;
 static PyObject *__pyx_n_s__pileups;
 static PyObject *__pyx_n_s__platform;
@@ -2284,25 +2014,17 @@ static PyObject *__pyx_n_s__plp;
 static PyObject *__pyx_n_s__port;
 static PyObject *__pyx_n_s__pos;
 static PyObject *__pyx_n_s__positions;
-static PyObject *__pyx_n_s__q_cns;
-static PyObject *__pyx_n_s__q_indel;
-static PyObject *__pyx_n_s__q_r;
-static PyObject *__pyx_n_s__q_ref;
 static PyObject *__pyx_n_s__qname;
 static PyObject *__pyx_n_s__qpos;
 static PyObject *__pyx_n_s__qseq;
 static PyObject *__pyx_n_s__qual;
 static PyObject *__pyx_n_s__r;
-static PyObject *__pyx_n_s__r_indel;
-static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__rU;
 static PyObject *__pyx_n_s__raw;
 static PyObject *__pyx_n_s__rb;
 static PyObject *__pyx_n_s__re;
 static PyObject *__pyx_n_s__readAndRelease;
 static PyObject *__pyx_n_s__readlines;
-static PyObject *__pyx_n_s__reads_diff;
-static PyObject *__pyx_n_s__reads_first;
-static PyObject *__pyx_n_s__reads_second;
 static PyObject *__pyx_n_s__record;
 static PyObject *__pyx_n_s__reference;
 static PyObject *__pyx_n_s__reference_base;
@@ -2312,7 +2034,6 @@ static PyObject *__pyx_n_s__region;
 static PyObject *__pyx_n_s__release;
 static PyObject *__pyx_n_s__remove;
 static PyObject *__pyx_n_s__reopen;
-static PyObject *__pyx_n_s__reset;
 static PyObject *__pyx_n_s__restore;
 static PyObject *__pyx_n_s__retval;
 static PyObject *__pyx_n_s__rg2lib;
@@ -2322,7 +2043,6 @@ static PyObject *__pyx_n_s__rowiter;
 static PyObject *__pyx_n_s__s;
 static PyObject *__pyx_n_s__samfile;
 static PyObject *__pyx_n_s__samtools;
-static PyObject *__pyx_n_s__second_allele;
 static PyObject *__pyx_n_s__seek;
 static PyObject *__pyx_n_s__self;
 static PyObject *__pyx_n_s__seq;
@@ -2334,6 +2054,7 @@ static PyObject *__pyx_n_s__setupIteratorData;
 static PyObject *__pyx_n_s__snp_quality;
 static PyObject *__pyx_n_s__split;
 static PyObject *__pyx_n_s__start;
+static PyObject *__pyx_n_s__start_offset;
 static PyObject *__pyx_n_s__startswith;
 static PyObject *__pyx_n_s__stderr;
 static PyObject *__pyx_n_s__stderr_f;
@@ -2349,11 +2070,9 @@ static PyObject *__pyx_n_s__system;
 static PyObject *__pyx_n_s__tags;
 static PyObject *__pyx_n_s__target_len;
 static PyObject *__pyx_n_s__target_name;
-static PyObject *__pyx_n_s__tell;
 static PyObject *__pyx_n_s__tempfile;
 static PyObject *__pyx_n_s__template;
 static PyObject *__pyx_n_s__text;
-static PyObject *__pyx_n_s__theta;
 static PyObject *__pyx_n_s__tid;
 static PyObject *__pyx_n_s__traceback;
 static PyObject *__pyx_n_s__types;
@@ -2371,11 +2090,8 @@ static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_2;
 static PyObject *__pyx_int_4;
 static PyObject *__pyx_int_8;
-static PyObject *__pyx_int_13;
 static PyObject *__pyx_int_16;
 static PyObject *__pyx_int_32;
-static PyObject *__pyx_int_40;
-static PyObject *__pyx_int_60;
 static PyObject *__pyx_int_64;
 static PyObject *__pyx_int_128;
 static PyObject *__pyx_int_255;
@@ -2384,18 +2100,83 @@ static PyObject *__pyx_int_512;
 static PyObject *__pyx_int_neg_127;
 static PyObject *__pyx_int_0660;
 static PyObject *__pyx_int_1024;
+static PyObject *__pyx_int_8000;
 static PyObject *__pyx_int_65535;
 static PyObject *__pyx_int_neg_32767;
 static PyObject *__pyx_int_536870912;
 static PyObject *__pyx_int_4294967295;
 static PyObject *__pyx_int_neg_2147483648;
-static PyObject *__pyx_k_29;
-static PyObject *__pyx_k_39;
-static int __pyx_k_58;
-static PyObject *__pyx_k_98;
-static PyObject *__pyx_k_99;
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":76
+static PyObject *__pyx_k_16;
+static PyObject *__pyx_k_44;
+static PyObject *__pyx_k_62;
+static int __pyx_k_115;
+static PyObject *__pyx_k_160;
+static PyObject *__pyx_k_161;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_7;
+static PyObject *__pyx_k_tuple_8;
+static PyObject *__pyx_k_tuple_10;
+static PyObject *__pyx_k_tuple_29;
+static PyObject *__pyx_k_tuple_30;
+static PyObject *__pyx_k_tuple_32;
+static PyObject *__pyx_k_tuple_34;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_39;
+static PyObject *__pyx_k_tuple_41;
+static PyObject *__pyx_k_tuple_42;
+static PyObject *__pyx_k_tuple_43;
+static PyObject *__pyx_k_tuple_45;
+static PyObject *__pyx_k_tuple_47;
+static PyObject *__pyx_k_tuple_49;
+static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_53;
+static PyObject *__pyx_k_tuple_55;
+static PyObject *__pyx_k_tuple_57;
+static PyObject *__pyx_k_tuple_61;
+static PyObject *__pyx_k_tuple_63;
+static PyObject *__pyx_k_tuple_64;
+static PyObject *__pyx_k_tuple_66;
+static PyObject *__pyx_k_tuple_67;
+static PyObject *__pyx_k_tuple_69;
+static PyObject *__pyx_k_tuple_70;
+static PyObject *__pyx_k_tuple_72;
+static PyObject *__pyx_k_tuple_73;
+static PyObject *__pyx_k_tuple_75;
+static PyObject *__pyx_k_tuple_76;
+static PyObject *__pyx_k_tuple_77;
+static PyObject *__pyx_k_tuple_78;
+static PyObject *__pyx_k_tuple_79;
+static PyObject *__pyx_k_tuple_80;
+static PyObject *__pyx_k_tuple_82;
+static PyObject *__pyx_k_tuple_83;
+static PyObject *__pyx_k_tuple_85;
+static PyObject *__pyx_k_tuple_86;
+static PyObject *__pyx_k_tuple_87;
+static PyObject *__pyx_k_tuple_88;
+static PyObject *__pyx_k_tuple_90;
+static PyObject *__pyx_k_tuple_92;
+static PyObject *__pyx_k_tuple_95;
+static PyObject *__pyx_k_tuple_102;
+static PyObject *__pyx_k_tuple_104;
+static PyObject *__pyx_k_tuple_105;
+static PyObject *__pyx_k_tuple_107;
+static PyObject *__pyx_k_tuple_108;
+static PyObject *__pyx_k_tuple_109;
+static PyObject *__pyx_k_tuple_110;
+static PyObject *__pyx_k_tuple_111;
+static PyObject *__pyx_k_tuple_117;
+static PyObject *__pyx_k_tuple_118;
+static PyObject *__pyx_k_tuple_134;
+static PyObject *__pyx_k_tuple_158;
+static PyObject *__pyx_k_tuple_159;
+static PyObject *__pyx_k_tuple_165;
+static PyObject *__pyx_k_tuple_233;
+static PyObject *__pyx_k_tuple_234;
+static PyObject *__pyx_k_tuple_235;
+static PyObject *__pyx_k_tuple_236;
+static PyObject *__pyx_k_tuple_237;
+
+/* "csamtools.pyx":76
  * #####################################################################
  * cdef class AlignedRead
  * cdef makeAlignedRead(bam1_t * src):             # <<<<<<<<<<<<<<
@@ -2411,7 +2192,7 @@ static  PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
   __Pyx_RefNannySetupContext("makeAlignedRead");
   __Pyx_TraceCall("makeAlignedRead", __pyx_f[0], 76);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":78
+  /* "csamtools.pyx":78
  * cdef makeAlignedRead(bam1_t * src):
  *     '''enter src into AlignedRead.'''
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)             # <<<<<<<<<<<<<<
@@ -2424,7 +2205,7 @@ static  PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
   __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":79
+  /* "csamtools.pyx":79
  *     '''enter src into AlignedRead.'''
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *     dest._delegate = bam_dup1(src)             # <<<<<<<<<<<<<<
@@ -2433,7 +2214,7 @@ static  PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
  */
   __pyx_v_dest->_delegate = bam_dup1(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":80
+  /* "csamtools.pyx":80
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *     dest._delegate = bam_dup1(src)
  *     return dest             # <<<<<<<<<<<<<<
@@ -2459,7 +2240,7 @@ static  PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":83
+/* "csamtools.pyx":83
  * 
  * cdef class PileupProxy
  * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):             # <<<<<<<<<<<<<<
@@ -2475,7 +2256,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
   __Pyx_RefNannySetupContext("makePileupProxy");
   __Pyx_TraceCall("makePileupProxy", __pyx_f[0], 83);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":84
+  /* "csamtools.pyx":84
  * cdef class PileupProxy
  * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
  *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)             # <<<<<<<<<<<<<<
@@ -2488,7 +2269,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
   __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":85
+  /* "csamtools.pyx":85
  * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
  *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
  *      dest.plp = plp             # <<<<<<<<<<<<<<
@@ -2497,7 +2278,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
  */
   __pyx_v_dest->plp = __pyx_v_plp;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":86
+  /* "csamtools.pyx":86
  *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
  *      dest.plp = plp
  *      dest.tid = tid             # <<<<<<<<<<<<<<
@@ -2506,7 +2287,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
  */
   __pyx_v_dest->tid = __pyx_v_tid;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":87
+  /* "csamtools.pyx":87
  *      dest.plp = plp
  *      dest.tid = tid
  *      dest.pos = pos             # <<<<<<<<<<<<<<
@@ -2515,7 +2296,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
  */
   __pyx_v_dest->pos = __pyx_v_pos;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":88
+  /* "csamtools.pyx":88
  *      dest.tid = tid
  *      dest.pos = pos
  *      dest.n = n             # <<<<<<<<<<<<<<
@@ -2527,7 +2308,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
   if (PyObject_SetAttr(((PyObject *)__pyx_v_dest), __pyx_n_s__n, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":89
+  /* "csamtools.pyx":89
  *      dest.pos = pos
  *      dest.n = n
  *      return dest             # <<<<<<<<<<<<<<
@@ -2553,7 +2334,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":92
+/* "csamtools.pyx":92
  * 
  * cdef class PileupRead
  * cdef makePileupRead( bam_pileup1_t * src ):             # <<<<<<<<<<<<<<
@@ -2569,7 +2350,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
   __Pyx_RefNannySetupContext("makePileupRead");
   __Pyx_TraceCall("makePileupRead", __pyx_f[0], 92);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":94
+  /* "csamtools.pyx":94
  * cdef makePileupRead( bam_pileup1_t * src ):
  *     '''fill a  PileupRead object from a bam_pileup1_t * object.'''
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)             # <<<<<<<<<<<<<<
@@ -2582,7 +2363,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
   __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupRead *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":95
+  /* "csamtools.pyx":95
  *     '''fill a  PileupRead object from a bam_pileup1_t * object.'''
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)
  *     dest._alignment = makeAlignedRead( src.b )             # <<<<<<<<<<<<<<
@@ -2598,7 +2379,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
   __pyx_v_dest->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":96
+  /* "csamtools.pyx":96
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)
  *     dest._alignment = makeAlignedRead( src.b )
  *     dest._qpos = src.qpos             # <<<<<<<<<<<<<<
@@ -2607,7 +2388,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
  */
   __pyx_v_dest->_qpos = __pyx_v_src->qpos;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":97
+  /* "csamtools.pyx":97
  *     dest._alignment = makeAlignedRead( src.b )
  *     dest._qpos = src.qpos
  *     dest._indel = src.indel             # <<<<<<<<<<<<<<
@@ -2616,7 +2397,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
  */
   __pyx_v_dest->_indel = __pyx_v_src->indel;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":98
+  /* "csamtools.pyx":98
  *     dest._qpos = src.qpos
  *     dest._indel = src.indel
  *     dest._level = src.level             # <<<<<<<<<<<<<<
@@ -2625,7 +2406,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
  */
   __pyx_v_dest->_level = __pyx_v_src->level;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":99
+  /* "csamtools.pyx":99
  *     dest._indel = src.indel
  *     dest._level = src.level
  *     dest._is_del = src.is_del             # <<<<<<<<<<<<<<
@@ -2634,7 +2415,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
  */
   __pyx_v_dest->_is_del = __pyx_v_src->is_del;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":100
+  /* "csamtools.pyx":100
  *     dest._level = src.level
  *     dest._is_del = src.is_del
  *     dest._is_head = src.is_head             # <<<<<<<<<<<<<<
@@ -2643,7 +2424,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
  */
   __pyx_v_dest->_is_head = __pyx_v_src->is_head;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":101
+  /* "csamtools.pyx":101
  *     dest._is_del = src.is_del
  *     dest._is_head = src.is_head
  *     dest._is_tail = src.is_tail             # <<<<<<<<<<<<<<
@@ -2652,7 +2433,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
  */
   __pyx_v_dest->_is_tail = __pyx_v_src->is_tail;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":102
+  /* "csamtools.pyx":102
  *     dest._is_head = src.is_head
  *     dest._is_tail = src.is_tail
  *     return dest             # <<<<<<<<<<<<<<
@@ -2678,7 +2459,7 @@ static  PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":109
+/* "csamtools.pyx":109
  * ## Generic callbacks for inserting python callbacks.
  * #####################################################################
  * cdef int fetch_callback( bam1_t *alignment, void *f):             # <<<<<<<<<<<<<<
@@ -2696,7 +2477,7 @@ static  int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *_
   __Pyx_TraceCall("fetch_callback", __pyx_f[0], 109);
   __pyx_v_a = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":114
+  /* "csamtools.pyx":114
  *     calls function in *f* with a new :class:`AlignedRead` object as parameter.
  *     '''
  *     a = makeAlignedRead( alignment )             # <<<<<<<<<<<<<<
@@ -2709,7 +2490,7 @@ static  int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *_
   __pyx_v_a = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":115
+  /* "csamtools.pyx":115
  *     '''
  *     a = makeAlignedRead( alignment )
  *     (<object>f)(a)             # <<<<<<<<<<<<<<
@@ -2717,13 +2498,13 @@ static  int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *_
  * class PileupColumn(object):
  */
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_a);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a);
   __Pyx_GIVEREF(__pyx_v_a);
-  __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_f), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_f), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = 0;
@@ -2740,7 +2521,7 @@ static  int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":130
+/* "csamtools.pyx":130
  *         list of reads (:class:`pysam.PileupRead`) aligned to this column
  *     '''
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -2763,7 +2544,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
   __Pyx_TraceCall("__str__", __pyx_f[0], 130);
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":131
+  /* "csamtools.pyx":131
  *     '''
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
@@ -2772,7 +2553,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
  */
   __Pyx_XDECREF(__pyx_r);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":132
+  /* "csamtools.pyx":132
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" + "\n".join( map(str, self.pileups) )             # <<<<<<<<<<<<<<
@@ -2782,7 +2563,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
   __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":131
+  /* "csamtools.pyx":131
  *     '''
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
@@ -2796,7 +2577,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
   __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
@@ -2807,30 +2588,30 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_builtin_map, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":132
+  /* "csamtools.pyx":132
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" + "\n".join( map(str, self.pileups) )             # <<<<<<<<<<<<<<
@@ -2842,25 +2623,25 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_builtin_map, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -2886,7 +2667,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":134
+/* "csamtools.pyx":134
  *             "\n" + "\n".join( map(str, self.pileups) )
  * 
  * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f):             # <<<<<<<<<<<<<<
@@ -2907,9 +2688,9 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   __Pyx_RefNannySetupContext("pileup_callback");
   __Pyx_TraceCall("pileup_callback", __pyx_f[0], 134);
   __pyx_v_p = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_pileups = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_pileups = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":151
+  /* "csamtools.pyx":151
  *     '''
  * 
  *     p = PileupColumn()             # <<<<<<<<<<<<<<
@@ -2925,7 +2706,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   __pyx_v_p = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":152
+  /* "csamtools.pyx":152
  * 
  *     p = PileupColumn()
  *     p.tid = tid             # <<<<<<<<<<<<<<
@@ -2937,7 +2718,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__tid, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":153
+  /* "csamtools.pyx":153
  *     p = PileupColumn()
  *     p.tid = tid
  *     p.pos = pos             # <<<<<<<<<<<<<<
@@ -2949,7 +2730,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pos, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":154
+  /* "csamtools.pyx":154
  *     p.tid = tid
  *     p.pos = pos
  *     p.n = n             # <<<<<<<<<<<<<<
@@ -2961,7 +2742,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__n, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":155
+  /* "csamtools.pyx":155
  *     p.pos = pos
  *     p.n = n
  *     pileups = []             # <<<<<<<<<<<<<<
@@ -2974,7 +2755,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   __pyx_v_pileups = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":158
+  /* "csamtools.pyx":158
  * 
  *     cdef int x
  *     for x from 0 <= x < n:             # <<<<<<<<<<<<<<
@@ -2984,7 +2765,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   __pyx_t_3 = __pyx_v_n;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":159
+    /* "csamtools.pyx":159
  *     cdef int x
  *     for x from 0 <= x < n:
  *         pileups.append( makePileupRead( &(pl[x]) ) )             # <<<<<<<<<<<<<<
@@ -2996,11 +2777,11 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
     }
     __pyx_t_2 = __pyx_f_9csamtools_makePileupRead((&(__pyx_v_pl[__pyx_v_x]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_pileups), __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":160
+  /* "csamtools.pyx":160
  *     for x from 0 <= x < n:
  *         pileups.append( makePileupRead( &(pl[x]) ) )
  *     p.pileups = pileups             # <<<<<<<<<<<<<<
@@ -3009,7 +2790,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
  */
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pileups, ((PyObject *)__pyx_v_pileups)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":162
+  /* "csamtools.pyx":162
  *     p.pileups = pileups
  * 
  *     (<object>f)(p)             # <<<<<<<<<<<<<<
@@ -3017,13 +2798,13 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
  * cdef int pileup_fetch_callback( bam1_t *b, void *data):
  */
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_p);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_p);
   __Pyx_GIVEREF(__pyx_v_p);
-  __pyx_t_1 = PyObject_Call(((PyObject *)__pyx_v_f), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)__pyx_v_f), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   __pyx_r = 0;
@@ -3041,7 +2822,7 @@ static  int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":164
+/* "csamtools.pyx":164
  *     (<object>f)(p)
  * 
  * cdef int pileup_fetch_callback( bam1_t *b, void *data):             # <<<<<<<<<<<<<<
@@ -3056,7 +2837,7 @@ static  int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__
   __Pyx_RefNannySetupContext("pileup_fetch_callback");
   __Pyx_TraceCall("pileup_fetch_callback", __pyx_f[0], 164);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":170
+  /* "csamtools.pyx":170
  *     '''
  *     cdef bam_plbuf_t * buf
  *     buf = <bam_plbuf_t*>data             # <<<<<<<<<<<<<<
@@ -3065,7 +2846,7 @@ static  int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__
  */
   __pyx_v_buf = ((bam_plbuf_t *)__pyx_v_data);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":171
+  /* "csamtools.pyx":171
  *     cdef bam_plbuf_t * buf
  *     buf = <bam_plbuf_t*>data
  *     bam_plbuf_push(b, buf)             # <<<<<<<<<<<<<<
@@ -3074,7 +2855,7 @@ static  int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__
  */
   bam_plbuf_push(__pyx_v_b, __pyx_v_buf);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":172
+  /* "csamtools.pyx":172
  *     buf = <bam_plbuf_t*>data
  *     bam_plbuf_push(b, buf)
  *     return 0             # <<<<<<<<<<<<<<
@@ -3091,7 +2872,7 @@ static  int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":178
+/* "csamtools.pyx":178
  *     stderr is captured.
  *     '''
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -3113,7 +2894,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
   __Pyx_TraceCall("__init__", __pyx_f[0], 178);
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":179
+  /* "csamtools.pyx":179
  *     '''
  *     def __init__(self):
  *         return             # <<<<<<<<<<<<<<
@@ -3124,7 +2905,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":180
+  /* "csamtools.pyx":180
  *     def __init__(self):
  *         return
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()             # <<<<<<<<<<<<<<
@@ -3164,7 +2945,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":181
+  /* "csamtools.pyx":181
  *         return
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
  *         self.stderr_save = Outs( sys.stderr.fileno() )             # <<<<<<<<<<<<<<
@@ -3185,18 +2966,18 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_save, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":182
+  /* "csamtools.pyx":182
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
  *         self.stderr_save = Outs( sys.stderr.fileno() )
  *         self.stderr_save.setfd( self.stderr_h )             # <<<<<<<<<<<<<<
@@ -3211,14 +2992,14 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -3237,7 +3018,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":184
+/* "csamtools.pyx":184
  *         self.stderr_save.setfd( self.stderr_h )
  * 
  *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
@@ -3245,10 +3026,10 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self
  *         self.stderr_save.restore()
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore_readAndRelease[] = "StderrStore.readAndRelease(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_readAndRelease)};
-static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore_1readAndRelease[] = "StderrStore.readAndRelease(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_1readAndRelease)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_v_lines;
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
@@ -3261,7 +3042,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
   __pyx_self = __pyx_self;
   __pyx_v_lines = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":185
+  /* "csamtools.pyx":185
  * 
  *     def readAndRelease( self ):
  *         return []             # <<<<<<<<<<<<<<
@@ -3275,7 +3056,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
   __pyx_t_1 = 0;
   goto __pyx_L0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":186
+  /* "csamtools.pyx":186
  *     def readAndRelease( self ):
  *         return []
  *         self.stderr_save.restore()             # <<<<<<<<<<<<<<
@@ -3292,7 +3073,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":187
+  /* "csamtools.pyx":187
  *         return []
  *         self.stderr_save.restore()
  *         lines = []             # <<<<<<<<<<<<<<
@@ -3305,7 +3086,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
   __pyx_v_lines = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":188
+  /* "csamtools.pyx":188
  *         self.stderr_save.restore()
  *         lines = []
  *         if os.path.exists(self.stderr_f):             # <<<<<<<<<<<<<<
@@ -3323,19 +3104,19 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":189
+    /* "csamtools.pyx":189
  *         lines = []
  *         if os.path.exists(self.stderr_f):
  *             lines = open( self.stderr_f, "r" ).readlines()             # <<<<<<<<<<<<<<
@@ -3345,16 +3126,16 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
     PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -3365,7 +3146,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
     __pyx_v_lines = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":190
+    /* "csamtools.pyx":190
  *         if os.path.exists(self.stderr_f):
  *             lines = open( self.stderr_f, "r" ).readlines()
  *             os.remove( self.stderr_f )             # <<<<<<<<<<<<<<
@@ -3380,20 +3161,20 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":191
+  /* "csamtools.pyx":191
  *             lines = open( self.stderr_f, "r" ).readlines()
  *             os.remove( self.stderr_f )
  *         return lines             # <<<<<<<<<<<<<<
@@ -3421,7 +3202,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":193
+/* "csamtools.pyx":193
  *         return lines
  * 
  *     def release(self):             # <<<<<<<<<<<<<<
@@ -3429,10 +3210,10 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_readAndRelease(PyObject *__py
  *         self.stderr_save.restore()
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore_release[] = "StderrStore.release(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_release)};
-static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore_2release[] = "StderrStore.release(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_2release)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -3443,7 +3224,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
   __Pyx_TraceCall("release", __pyx_f[0], 193);
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":194
+  /* "csamtools.pyx":194
  * 
  *     def release(self):
  *         return             # <<<<<<<<<<<<<<
@@ -3454,7 +3235,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":195
+  /* "csamtools.pyx":195
  *     def release(self):
  *         return
  *         self.stderr_save.restore()             # <<<<<<<<<<<<<<
@@ -3471,7 +3252,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":196
+  /* "csamtools.pyx":196
  *         return
  *         self.stderr_save.restore()
  *         if os.path.exists(self.stderr_f):             # <<<<<<<<<<<<<<
@@ -3489,19 +3270,19 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":197
+    /* "csamtools.pyx":197
  *         self.stderr_save.restore()
  *         if os.path.exists(self.stderr_f):
  *             os.remove( self.stderr_f )             # <<<<<<<<<<<<<<
@@ -3516,14 +3297,14 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     goto __pyx_L5;
   }
@@ -3544,7 +3325,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":199
+/* "csamtools.pyx":199
  *             os.remove( self.stderr_f )
  * 
  *     def __del__(self):             # <<<<<<<<<<<<<<
@@ -3552,10 +3333,10 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_release(PyObject *__pyx_self,
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore___del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore___del__[] = "StderrStore.__del__(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore___del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore___del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore___del__)};
-static PyObject *__pyx_pf_9csamtools_11StderrStore___del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore_3__del__[] = "StderrStore.__del__(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_3__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_3__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_3__del__)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -3564,7 +3345,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___del__(PyObject *__pyx_self,
   __Pyx_TraceCall("__del__", __pyx_f[0], 199);
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":200
+  /* "csamtools.pyx":200
  * 
  *     def __del__(self):
  *         self.release()             # <<<<<<<<<<<<<<
@@ -3592,7 +3373,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___del__(PyObject *__pyx_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":204
+/* "csamtools.pyx":204
  * class StderrStoreWindows():
  *     '''does nothing. stderr can't be redirected on windows'''
  *     def __init__(self): pass             # <<<<<<<<<<<<<<
@@ -3617,7 +3398,7 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":205
+/* "csamtools.pyx":205
  *     '''does nothing. stderr can't be redirected on windows'''
  *     def __init__(self): pass
  *     def readAndRelease(self): return []             # <<<<<<<<<<<<<<
@@ -3625,10 +3406,10 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18StderrStoreWindows_readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
-static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_readAndRelease)};
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
+static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease)};
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
@@ -3655,7 +3436,7 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_readAndRelease(PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":206
+/* "csamtools.pyx":206
  *     def __init__(self): pass
  *     def readAndRelease(self): return []
  *     def release(self): pass             # <<<<<<<<<<<<<<
@@ -3663,10 +3444,10 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_readAndRelease(PyObjec
  * if platform.system()=='Windows':
  */
 
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18StderrStoreWindows_release[] = "StderrStoreWindows.release(self)";
-static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_release)};
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18StderrStoreWindows_2release[] = "StderrStoreWindows.release(self)";
+static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_2release)};
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("release");
@@ -3680,7 +3461,7 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_release(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":260
+/* "csamtools.pyx":260
  *     cdef faidx_t * fastafile
  * 
  *     def __cinit__(self, *args, **kwargs ):             # <<<<<<<<<<<<<<
@@ -3706,7 +3487,7 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyOb
   __Pyx_INCREF(__pyx_args);
   __pyx_v_args = __pyx_args;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":261
+  /* "csamtools.pyx":261
  * 
  *     def __cinit__(self, *args, **kwargs ):
  *         self.fastafile = NULL             # <<<<<<<<<<<<<<
@@ -3715,7 +3496,7 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyOb
  */
   ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":262
+  /* "csamtools.pyx":262
  *     def __cinit__(self, *args, **kwargs ):
  *         self.fastafile = NULL
  *         self._filename = NULL             # <<<<<<<<<<<<<<
@@ -3724,7 +3505,7 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyOb
  */
   ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":263
+  /* "csamtools.pyx":263
  *         self.fastafile = NULL
  *         self._filename = NULL
  *         self._open( *args, **kwargs )             # <<<<<<<<<<<<<<
@@ -3757,7 +3538,7 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":265
+/* "csamtools.pyx":265
  *         self._open( *args, **kwargs )
  * 
  *     def _isOpen( self ):             # <<<<<<<<<<<<<<
@@ -3765,16 +3546,16 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyOb
  *         return self.fastafile != NULL
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile__isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile__isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pf_9csamtools_9Fastafile__isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_1_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_isOpen");
   __Pyx_TraceCall("_isOpen", __pyx_f[0], 265);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":267
+  /* "csamtools.pyx":267
  *     def _isOpen( self ):
  *         '''return true if samfile has been opened.'''
  *         return self.fastafile != NULL             # <<<<<<<<<<<<<<
@@ -3801,7 +3582,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__isOpen(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":269
+/* "csamtools.pyx":269
  *         return self.fastafile != NULL
  * 
  *     def __len__(self):             # <<<<<<<<<<<<<<
@@ -3809,17 +3590,16 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__isOpen(PyObject *__pyx_v_self,
  *             raise ValueError( "calling len() on closed file" )
  */
 
-static Py_ssize_t __pyx_pf_9csamtools_9Fastafile___len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pf_9csamtools_9Fastafile___len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__len__");
   __Pyx_TraceCall("__len__", __pyx_f[0], 269);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":270
+  /* "csamtools.pyx":270
  * 
  *     def __len__(self):
  *         if self.fastafile == NULL:             # <<<<<<<<<<<<<<
@@ -3829,29 +3609,23 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile___len__(PyObject *__pyx_v_self)
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":271
+    /* "csamtools.pyx":271
  *     def __len__(self):
  *         if self.fastafile == NULL:
  *             raise ValueError( "calling len() on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         return faidx_fetch_nseq(self.fastafile)
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":273
+  /* "csamtools.pyx":273
  *             raise ValueError( "calling len() on closed file" )
  * 
  *         return faidx_fetch_nseq(self.fastafile)             # <<<<<<<<<<<<<<
@@ -3865,7 +3639,6 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile___len__(PyObject *__pyx_v_self)
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("csamtools.Fastafile.__len__");
   __pyx_r = -1;
   __pyx_L0:;
@@ -3874,7 +3647,7 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile___len__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":275
+/* "csamtools.pyx":275
  *         return faidx_fetch_nseq(self.fastafile)
  * 
  *     def _open( self,             # <<<<<<<<<<<<<<
@@ -3882,9 +3655,9 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile___len__(PyObject *__pyx_v_self)
  *         '''open an indexed fasta file.
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile__open[] = "Fastafile._open(self, char *filename)\nopen an indexed fasta file.\n\n        This method expects an indexed fasta file.\n        ";
-static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_3_open[] = "Fastafile._open(self, char *filename)\nopen an indexed fasta file.\n\n        This method expects an indexed fasta file.\n        ";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
   char *__pyx_v_filename;
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
@@ -3903,7 +3676,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":283
+  /* "csamtools.pyx":283
  * 
  *         # close a previously opened file
  *         if self.fastafile != NULL: self.close()             # <<<<<<<<<<<<<<
@@ -3922,7 +3695,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":284
+  /* "csamtools.pyx":284
  *         # close a previously opened file
  *         if self.fastafile != NULL: self.close()
  *         if self._filename != NULL: free(self._filename)             # <<<<<<<<<<<<<<
@@ -3936,7 +3709,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":285
+  /* "csamtools.pyx":285
  *         if self.fastafile != NULL: self.close()
  *         if self._filename != NULL: free(self._filename)
  *         self._filename = strdup(filename)             # <<<<<<<<<<<<<<
@@ -3945,7 +3718,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
  */
   ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":286
+  /* "csamtools.pyx":286
  *         if self._filename != NULL: free(self._filename)
  *         self._filename = strdup(filename)
  *         self.fastafile = fai_load( filename )             # <<<<<<<<<<<<<<
@@ -3954,7 +3727,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
  */
   ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = fai_load(__pyx_v_filename);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":288
+  /* "csamtools.pyx":288
  *         self.fastafile = fai_load( filename )
  * 
  *         if self.fastafile == NULL:             # <<<<<<<<<<<<<<
@@ -3964,7 +3737,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":289
+    /* "csamtools.pyx":289
  * 
  *         if self.fastafile == NULL:
  *             raise IOError("could not open file `%s`" % filename )             # <<<<<<<<<<<<<<
@@ -3973,17 +3746,17 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
  */
     __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4005,7 +3778,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":291
+/* "csamtools.pyx":291
  *             raise IOError("could not open file `%s`" % filename )
  * 
  *     def close( self ):             # <<<<<<<<<<<<<<
@@ -4013,16 +3786,16 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile__open(PyObject *__pyx_v_self, Py
  *             fai_destroy( self.fastafile )
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile_close[] = "Fastafile.close(self)";
-static PyObject *__pyx_pf_9csamtools_9Fastafile_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_4close[] = "Fastafile.close(self)";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("close");
   __Pyx_TraceCall("close", __pyx_f[0], 291);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":292
+  /* "csamtools.pyx":292
  * 
  *     def close( self ):
  *         if self.fastafile != NULL:             # <<<<<<<<<<<<<<
@@ -4032,7 +3805,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_close(PyObject *__pyx_v_self, CY
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":293
+    /* "csamtools.pyx":293
  *     def close( self ):
  *         if self.fastafile != NULL:
  *             fai_destroy( self.fastafile )             # <<<<<<<<<<<<<<
@@ -4041,7 +3814,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_close(PyObject *__pyx_v_self, CY
  */
     fai_destroy(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":294
+    /* "csamtools.pyx":294
  *         if self.fastafile != NULL:
  *             fai_destroy( self.fastafile )
  *             self.fastafile = NULL             # <<<<<<<<<<<<<<
@@ -4060,7 +3833,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_close(PyObject *__pyx_v_self, CY
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":296
+/* "csamtools.pyx":296
  *             self.fastafile = NULL
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -4068,8 +3841,8 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_close(PyObject *__pyx_v_self, CY
  *         if self._filename != NULL: free(self._filename)
  */
 
-static void __pyx_pf_9csamtools_9Fastafile___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_9Fastafile___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self) {
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
@@ -4077,7 +3850,7 @@ static void __pyx_pf_9csamtools_9Fastafile___dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 296);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":297
+  /* "csamtools.pyx":297
  * 
  *     def __dealloc__(self):
  *         self.close()             # <<<<<<<<<<<<<<
@@ -4091,7 +3864,7 @@ static void __pyx_pf_9csamtools_9Fastafile___dealloc__(PyObject *__pyx_v_self) {
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":298
+  /* "csamtools.pyx":298
  *     def __dealloc__(self):
  *         self.close()
  *         if self._filename != NULL: free(self._filename)             # <<<<<<<<<<<<<<
@@ -4115,7 +3888,7 @@ static void __pyx_pf_9csamtools_9Fastafile___dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":302
+/* "csamtools.pyx":302
  *     property filename:
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -4134,7 +3907,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__py
   __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 302);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":303
+  /* "csamtools.pyx":303
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -4150,22 +3923,16 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__py
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":304
+  /* "csamtools.pyx":304
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self._filename             # <<<<<<<<<<<<<<
@@ -4173,10 +3940,10 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__py
  *     def fetch( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_r = ((PyObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
+  __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -4193,7 +3960,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":306
+/* "csamtools.pyx":306
  *             return self._filename
  * 
  *     def fetch( self,             # <<<<<<<<<<<<<<
@@ -4201,9 +3968,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__py
  *                start = None,
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile_fetch[] = "Fastafile.fetch(self, reference=None, start=None, end=None, region=None)\n*(reference = None, start = None, end = None, region = None)*\n               \n        fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing. \n        \n        The region is specified by :term:`reference`, *start* and *end*. \n        \n        fetch returns an empty string if the region is out of range or addresses an unknown *reference*.\n\n        If *reference* is given and *start* is None, the sequence from the \n        first base is returned. Similarly, if *end* is None, the sequence \n        until the last base is returned.\n        \n        Alternatively, a samtools :term:`region` string can be supplied.\n        ";
-static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_6fetch[] = "Fastafile.fetch(self, reference=None, start=None, end=None, region=None)\n*(reference = None, start = None, end = None, region = None)*\n               \n        fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing. \n        \n        The region is specified by :term:`reference`, *start* and *end*. \n        \n        fetch returns an empty string if the region is out of range or addresses an unknown *reference*.\n\n        If *reference* is given and *start* is None, the sequence from the \n        first base is returned. Similarly, if *end* is None, the sequence \n        until the last base is returned.\n        \n        Alternatively, a samtools :term:`region` string can be supplied.\n        ";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -4225,7 +3992,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[4] = {0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":307
+    /* "csamtools.pyx":307
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -4234,7 +4001,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":308
+    /* "csamtools.pyx":308
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -4243,7 +4010,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":309
+    /* "csamtools.pyx":309
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -4252,7 +4019,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":310
+    /* "csamtools.pyx":310
  *                start = None,
  *                end = None,
  *                region = None):             # <<<<<<<<<<<<<<
@@ -4299,7 +4066,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     __pyx_v_region = values[3];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":307
+    /* "csamtools.pyx":307
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -4308,7 +4075,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":308
+    /* "csamtools.pyx":308
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -4317,7 +4084,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":309
+    /* "csamtools.pyx":309
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -4326,7 +4093,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":310
+    /* "csamtools.pyx":310
  *                start = None,
  *                end = None,
  *                region = None):             # <<<<<<<<<<<<<<
@@ -4356,7 +4123,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   __Pyx_INCREF(__pyx_v_region);
   __pyx_v_py_seq = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":327
+  /* "csamtools.pyx":327
  *         '''
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
@@ -4373,29 +4140,23 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":328
+    /* "csamtools.pyx":328
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         cdef int length
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":333
+  /* "csamtools.pyx":333
  *         cdef char * seq
  * 
  *         if not region:             # <<<<<<<<<<<<<<
@@ -4406,7 +4167,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":334
+    /* "csamtools.pyx":334
  * 
  *         if not region:
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )             # <<<<<<<<<<<<<<
@@ -4415,14 +4176,8 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     __pyx_t_3 = (__pyx_v_reference == Py_None);
     if (__pyx_t_3) {
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_6));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4430,7 +4185,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":335
+    /* "csamtools.pyx":335
  *         if not region:
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )
  *             if start is None: start = 0             # <<<<<<<<<<<<<<
@@ -4446,7 +4201,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":336
+    /* "csamtools.pyx":336
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )
  *             if start is None: start = 0
  *             if end is None: end = max_pos -1             # <<<<<<<<<<<<<<
@@ -4464,7 +4219,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     }
     __pyx_L10:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":338
+    /* "csamtools.pyx":338
  *             if end is None: end = max_pos -1
  * 
  *             if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )             # <<<<<<<<<<<<<<
@@ -4477,24 +4232,24 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_3) {
       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_start);
       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_start);
       __Pyx_GIVEREF(__pyx_v_start);
       __Pyx_INCREF(__pyx_v_end);
       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_end);
       __Pyx_GIVEREF(__pyx_v_end);
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_1, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4502,7 +4257,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     }
     __pyx_L11:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":339
+    /* "csamtools.pyx":339
  * 
  *             if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )
  *             if start == end: return ""             # <<<<<<<<<<<<<<
@@ -4515,14 +4270,14 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_3) {
       __Pyx_XDECREF(__pyx_r);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      __pyx_r = ((PyObject *)__pyx_kp_s_8);
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
+      __pyx_r = ((PyObject *)__pyx_kp_s_12);
       goto __pyx_L0;
       goto __pyx_L12;
     }
     __pyx_L12:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":341
+    /* "csamtools.pyx":341
  *             if start == end: return ""
  *             # valid ranges are from 0 to 2^29-1
  *             if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )             # <<<<<<<<<<<<<<
@@ -4543,16 +4298,16 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = (!__pyx_t_3);
     if (__pyx_t_4) {
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_1, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4560,7 +4315,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     }
     __pyx_L13:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":342
+    /* "csamtools.pyx":342
  *             # valid ranges are from 0 to 2^29-1
  *             if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
  *             if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end )             # <<<<<<<<<<<<<<
@@ -4581,16 +4336,16 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_1, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4598,7 +4353,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     }
     __pyx_L14:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":351
+    /* "csamtools.pyx":351
  *             #                       end-1,
  *             #                       &length)
  *             region = "%s:%i-%i" % (reference, start+1, end)             # <<<<<<<<<<<<<<
@@ -4608,7 +4363,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_reference);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
     __Pyx_GIVEREF(__pyx_v_reference);
@@ -4618,14 +4373,14 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
     __Pyx_GIVEREF(__pyx_v_end);
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_region);
     __pyx_v_region = ((PyObject *)__pyx_t_1);
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":353
+    /* "csamtools.pyx":353
  *             region = "%s:%i-%i" % (reference, start+1, end)
  *             seq = fai_fetch( self.fastafile,
  *                              region,             # <<<<<<<<<<<<<<
@@ -4634,7 +4389,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":354
+    /* "csamtools.pyx":354
  *             seq = fai_fetch( self.fastafile,
  *                              region,
  *                              &length )             # <<<<<<<<<<<<<<
@@ -4646,7 +4401,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":357
+    /* "csamtools.pyx":357
  *         else:
  *             # samtools adds a '\0' at the end
  *             seq = fai_fetch( self.fastafile, region, &length )             # <<<<<<<<<<<<<<
@@ -4658,7 +4413,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":360
+  /* "csamtools.pyx":360
  * 
  *         # copy to python
  *         if seq == NULL:             # <<<<<<<<<<<<<<
@@ -4668,7 +4423,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   __pyx_t_3 = (__pyx_v_seq == NULL);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":361
+    /* "csamtools.pyx":361
  *         # copy to python
  *         if seq == NULL:
  *             return ""             # <<<<<<<<<<<<<<
@@ -4676,14 +4431,14 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  *             try:
  */
     __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-    __pyx_r = ((PyObject *)__pyx_kp_s_8);
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
+    __pyx_r = ((PyObject *)__pyx_kp_s_12);
     goto __pyx_L0;
     goto __pyx_L15;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":363
+    /* "csamtools.pyx":363
  *             return ""
  *         else:
  *             try:             # <<<<<<<<<<<<<<
@@ -4692,7 +4447,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
  */
     /*try:*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":364
+      /* "csamtools.pyx":364
  *         else:
  *             try:
  *                 py_seq = PyString_FromStringAndSize(seq, length)             # <<<<<<<<<<<<<<
@@ -4706,7 +4461,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
       __pyx_t_1 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":366
+    /* "csamtools.pyx":366
  *                 py_seq = PyString_FromStringAndSize(seq, length)
  *             finally:
  *                 free(seq)             # <<<<<<<<<<<<<<
@@ -4743,7 +4498,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   }
   __pyx_L15:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":368
+  /* "csamtools.pyx":368
  *                 free(seq)
  * 
  *         return py_seq             # <<<<<<<<<<<<<<
@@ -4773,7 +4528,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_fetch(PyObject *__pyx_v_self, Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":370
+/* "csamtools.pyx":370
  *         return py_seq
  * 
  *     cdef char * _fetch( self, char * reference, int start, int end, int * length ):             # <<<<<<<<<<<<<<
@@ -4787,7 +4542,7 @@ static  char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_F
   __Pyx_RefNannySetupContext("_fetch");
   __Pyx_TraceCall("_fetch", __pyx_f[0], 370);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":377
+  /* "csamtools.pyx":377
  *                                start,
  *                                end-1,
  *                                length )             # <<<<<<<<<<<<<<
@@ -4804,7 +4559,7 @@ static  char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_F
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":382
+/* "csamtools.pyx":382
  * #------------------------------------------------------------------------
  * #------------------------------------------------------------------------
  * cdef int count_callback( bam1_t *alignment, void *f):             # <<<<<<<<<<<<<<
@@ -4815,11 +4570,12 @@ static  char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_F
 static  int __pyx_f_9csamtools_count_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
   int *__pyx_v_counter;
   int __pyx_r;
+  long __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("count_callback");
   __Pyx_TraceCall("count_callback", __pyx_f[0], 382);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":385
+  /* "csamtools.pyx":385
  *      '''callback for bam_fetch - count number of reads.
  *      '''
  *      cdef int* counter = (<int*>f)             # <<<<<<<<<<<<<<
@@ -4828,14 +4584,15 @@ static  int __pyx_f_9csamtools_count_callback(bam1_t *__pyx_v_alignment, void *_
  */
   __pyx_v_counter = ((int *)__pyx_v_f);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":386
+  /* "csamtools.pyx":386
  *      '''
  *      cdef int* counter = (<int*>f)
  *      counter[0] += 1;             # <<<<<<<<<<<<<<
  * 
  * ctypedef struct MateData:
  */
-  (__pyx_v_counter[0]) += 1;
+  __pyx_t_1 = 0;
+  (__pyx_v_counter[__pyx_t_1]) = ((__pyx_v_counter[__pyx_t_1]) + 1);
 
   __pyx_r = 0;
   __Pyx_TraceReturn(Py_None);
@@ -4843,7 +4600,7 @@ static  int __pyx_f_9csamtools_count_callback(bam1_t *__pyx_v_alignment, void *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":396
+/* "csamtools.pyx":396
  * #------------------------------------------------------------------------
  * #------------------------------------------------------------------------
  * cdef int mate_callback( bam1_t *alignment, void *f):             # <<<<<<<<<<<<<<
@@ -4861,7 +4618,7 @@ static  int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__
   __Pyx_RefNannySetupContext("mate_callback");
   __Pyx_TraceCall("mate_callback", __pyx_f[0], 396);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":399
+  /* "csamtools.pyx":399
  *      '''callback for bam_fetch = filter mate
  *      '''
  *      cdef MateData * d = (<MateData*>f)             # <<<<<<<<<<<<<<
@@ -4870,7 +4627,7 @@ static  int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__
  */
   __pyx_v_d = ((__pyx_t_9csamtools_MateData *)__pyx_v_f);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":404
+  /* "csamtools.pyx":404
  *      #        d.flag, alignment.core.flag, alignment.core.flag & d.flag)
  * 
  *      if d.mate == NULL:             # <<<<<<<<<<<<<<
@@ -4880,7 +4637,7 @@ static  int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__
   __pyx_t_1 = (__pyx_v_d->mate == NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":410
+    /* "csamtools.pyx":410
  *          # also, make sure that we get the other read by comparing
  *          # the flags
  *          if alignment.core.flag & d.flag != 0 and \             # <<<<<<<<<<<<<<
@@ -4890,7 +4647,7 @@ static  int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__
     __pyx_t_1 = ((__pyx_v_alignment->core.flag & __pyx_v_d->flag) != 0);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":411
+      /* "csamtools.pyx":411
  *          # the flags
  *          if alignment.core.flag & d.flag != 0 and \
  *                  strcmp( bam1_qname( alignment ), d.name ) == 0:             # <<<<<<<<<<<<<<
@@ -4904,7 +4661,7 @@ static  int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__
     }
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":412
+      /* "csamtools.pyx":412
  *          if alignment.core.flag & d.flag != 0 and \
  *                  strcmp( bam1_qname( alignment ), d.name ) == 0:
  *              d.mate = bam_dup1( alignment )             # <<<<<<<<<<<<<<
@@ -4925,7 +4682,7 @@ static  int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":455
+/* "csamtools.pyx":458
  *     '''
  * 
  *     def __cinit__(self, *args, **kwargs ):             # <<<<<<<<<<<<<<
@@ -4943,7 +4700,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObje
   PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 455);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 458);
   if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
   __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
   if (unlikely(!__pyx_v_kwargs)) return -1;
@@ -4951,7 +4708,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObje
   __Pyx_INCREF(__pyx_args);
   __pyx_v_args = __pyx_args;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":456
+  /* "csamtools.pyx":459
  * 
  *     def __cinit__(self, *args, **kwargs ):
  *         self.samfile = NULL             # <<<<<<<<<<<<<<
@@ -4960,42 +4717,51 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObje
  */
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":457
+  /* "csamtools.pyx":460
  *     def __cinit__(self, *args, **kwargs ):
  *         self.samfile = NULL
  *         self._filename = NULL             # <<<<<<<<<<<<<<
  *         self.isbam = False
- *         self._open( *args, **kwargs )
+ *         self.isstream = False
  */
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":458
+  /* "csamtools.pyx":461
  *         self.samfile = NULL
  *         self._filename = NULL
  *         self.isbam = False             # <<<<<<<<<<<<<<
+ *         self.isstream = False
  *         self._open( *args, **kwargs )
- * 
  */
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":459
+  /* "csamtools.pyx":462
  *         self._filename = NULL
  *         self.isbam = False
+ *         self.isstream = False             # <<<<<<<<<<<<<<
+ *         self._open( *args, **kwargs )
+ * 
+ */
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = 0;
+
+  /* "csamtools.pyx":463
+ *         self.isbam = False
+ *         self.isstream = False
  *         self._open( *args, **kwargs )             # <<<<<<<<<<<<<<
  * 
  *         # allocate memory for iterator
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":462
+  /* "csamtools.pyx":466
  * 
  *         # allocate memory for iterator
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))             # <<<<<<<<<<<<<<
@@ -5020,7 +4786,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":464
+/* "csamtools.pyx":468
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
  *     def _isOpen( self ):             # <<<<<<<<<<<<<<
@@ -5028,16 +4794,16 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObje
  *         return self.samfile != NULL
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile__isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile__isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pf_9csamtools_7Samfile__isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_1_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_isOpen");
-  __Pyx_TraceCall("_isOpen", __pyx_f[0], 464);
+  __Pyx_TraceCall("_isOpen", __pyx_f[0], 468);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":466
+  /* "csamtools.pyx":470
  *     def _isOpen( self ):
  *         '''return true if samfile has been opened.'''
  *         return self.samfile != NULL             # <<<<<<<<<<<<<<
@@ -5045,7 +4811,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__isOpen(PyObject *__pyx_v_self, CY
  *     def _hasIndex( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -5064,7 +4830,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__isOpen(PyObject *__pyx_v_self, CY
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":468
+/* "csamtools.pyx":472
  *         return self.samfile != NULL
  * 
  *     def _hasIndex( self ):             # <<<<<<<<<<<<<<
@@ -5072,16 +4838,16 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__isOpen(PyObject *__pyx_v_self, CY
  *         return self.index != NULL
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile__hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile__hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
-static PyObject *__pyx_pf_9csamtools_7Samfile__hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_2_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_hasIndex");
-  __Pyx_TraceCall("_hasIndex", __pyx_f[0], 468);
+  __Pyx_TraceCall("_hasIndex", __pyx_f[0], 472);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":470
+  /* "csamtools.pyx":474
  *     def _hasIndex( self ):
  *         '''return true if samfile has an existing (and opened) index.'''
  *         return self.index != NULL             # <<<<<<<<<<<<<<
@@ -5089,7 +4855,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__hasIndex(PyObject *__pyx_v_self,
  *     def _open( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -5108,7 +4874,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__hasIndex(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":472
+/* "csamtools.pyx":476
  *         return self.index != NULL
  * 
  *     def _open( self,             # <<<<<<<<<<<<<<
@@ -5116,9 +4882,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__hasIndex(PyObject *__pyx_v_self,
  *                mode = None,
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile__open[] = "Samfile._open(self, char *filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None)\nopen a sam/bam file.\n\n        If _open is called on an existing bamfile, the current file will be\n        closed and a new file will be opened.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_3_open[] = "Samfile._open(self, char *filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None, add_sq_text=True)\nopen a sam/bam file.\n\n        If _open is called on an existing bamfile, the current file will be\n        closed and a new file will be opened.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_filename;
   PyObject *__pyx_v_mode = 0;
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_template = 0;
@@ -5127,6 +4893,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
   PyObject *__pyx_v_text = 0;
   PyObject *__pyx_v_header = 0;
   PyObject *__pyx_v_port = 0;
+  PyObject *__pyx_v_add_sq_text = 0;
   PyObject *__pyx_v_msg;
   bam_header_t *__pyx_v_header_to_write;
   char *__pyx_v_ctext;
@@ -5151,15 +4918,15 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
   uint32_t __pyx_t_14;
   char *__pyx_t_15;
   int __pyx_t_16;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__template,&__pyx_n_s__referencenames,&__pyx_n_s__referencelengths,&__pyx_n_s__text,&__pyx_n_s__header,&__pyx_n_s__port,0};
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__template,&__pyx_n_s__referencenames,&__pyx_n_s__referencelengths,&__pyx_n_s__text,&__pyx_n_s__header,&__pyx_n_s__port,&__pyx_n_s__add_sq_text,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_open");
-  __Pyx_TraceCall("_open", __pyx_f[0], 472);
+  __Pyx_TraceCall("_open", __pyx_f[0], 476);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[8] = {0,0,0,0,0,0,0,0};
+    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":474
+    /* "csamtools.pyx":478
  *     def _open( self,
  *                char * filename,
  *                mode = None,             # <<<<<<<<<<<<<<
@@ -5168,7 +4935,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":475
+    /* "csamtools.pyx":479
  *                char * filename,
  *                mode = None,
  *                Samfile template = None,             # <<<<<<<<<<<<<<
@@ -5177,7 +4944,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     values[2] = (PyObject *)((struct __pyx_obj_9csamtools_Samfile *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":476
+    /* "csamtools.pyx":480
  *                mode = None,
  *                Samfile template = None,
  *                referencenames = None,             # <<<<<<<<<<<<<<
@@ -5186,7 +4953,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":477
+    /* "csamtools.pyx":481
  *                Samfile template = None,
  *                referencenames = None,
  *                referencelengths = None,             # <<<<<<<<<<<<<<
@@ -5195,7 +4962,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     values[4] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":478
+    /* "csamtools.pyx":482
  *                referencenames = None,
  *                referencelengths = None,
  *                text = None,             # <<<<<<<<<<<<<<
@@ -5204,24 +4971,26 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     values[5] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":479
+    /* "csamtools.pyx":483
  *                referencelengths = None,
  *                text = None,
  *                header = None,             # <<<<<<<<<<<<<<
  *                port = None,
- *               ):
+ *                add_sq_text = True,
  */
     values[6] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":480
+    /* "csamtools.pyx":484
  *                text = None,
  *                header = None,
  *                port = None,             # <<<<<<<<<<<<<<
+ *                add_sq_text = True,
  *               ):
- *         '''open a sam/bam file.
  */
     values[7] = ((PyObject *)Py_None);
+    values[8] = __pyx_k_16;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
       case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
       case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
       case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
@@ -5273,11 +5042,16 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
         PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port);
         if (value) { values[7] = value; kw_args--; }
       }
+      case  8:
+      if (kw_args > 0) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_sq_text);
+        if (value) { values[8] = value; kw_args--; }
+      }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_mode = values[1];
     __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)values[2]);
     __pyx_v_referencenames = values[3];
@@ -5285,9 +5059,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     __pyx_v_text = values[5];
     __pyx_v_header = values[6];
     __pyx_v_port = values[7];
+    __pyx_v_add_sq_text = values[8];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":474
+    /* "csamtools.pyx":478
  *     def _open( self,
  *                char * filename,
  *                mode = None,             # <<<<<<<<<<<<<<
@@ -5296,7 +5071,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_mode = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":475
+    /* "csamtools.pyx":479
  *                char * filename,
  *                mode = None,
  *                Samfile template = None,             # <<<<<<<<<<<<<<
@@ -5305,7 +5080,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":476
+    /* "csamtools.pyx":480
  *                mode = None,
  *                Samfile template = None,
  *                referencenames = None,             # <<<<<<<<<<<<<<
@@ -5314,7 +5089,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_referencenames = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":477
+    /* "csamtools.pyx":481
  *                Samfile template = None,
  *                referencenames = None,
  *                referencelengths = None,             # <<<<<<<<<<<<<<
@@ -5323,7 +5098,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_referencelengths = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":478
+    /* "csamtools.pyx":482
  *                referencenames = None,
  *                referencelengths = None,
  *                text = None,             # <<<<<<<<<<<<<<
@@ -5332,24 +5107,26 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_text = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":479
+    /* "csamtools.pyx":483
  *                referencelengths = None,
  *                text = None,
  *                header = None,             # <<<<<<<<<<<<<<
  *                port = None,
- *               ):
+ *                add_sq_text = True,
  */
     __pyx_v_header = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":480
+    /* "csamtools.pyx":484
  *                text = None,
  *                header = None,
  *                port = None,             # <<<<<<<<<<<<<<
+ *                add_sq_text = True,
  *               ):
- *         '''open a sam/bam file.
  */
     __pyx_v_port = ((PyObject *)Py_None);
+    __pyx_v_add_sq_text = __pyx_k_16;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  9: __pyx_v_add_sq_text = PyTuple_GET_ITEM(__pyx_args, 8);
       case  8: __pyx_v_port = PyTuple_GET_ITEM(__pyx_args, 7);
       case  7: __pyx_v_header = PyTuple_GET_ITEM(__pyx_args, 6);
       case  6: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 5);
@@ -5357,41 +5134,42 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       case  4: __pyx_v_referencenames = PyTuple_GET_ITEM(__pyx_args, 3);
       case  3: __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 2));
       case  2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  1: __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       break;
       default: goto __pyx_L5_argtuple_error;
     }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile._open");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
+  __Pyx_INCREF(__pyx_v_text);
   __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_n = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":489
+  /* "csamtools.pyx":494
  * 
  *         # read mode autodetection
  *         if mode is None:             # <<<<<<<<<<<<<<
  *             try:
- *                 self._open(filename, 'r', template=template,
+ *                 self._open(filename, 'rb', template=template,
  */
   __pyx_t_1 = (__pyx_v_mode == Py_None);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":490
+    /* "csamtools.pyx":495
  *         # read mode autodetection
  *         if mode is None:
  *             try:             # <<<<<<<<<<<<<<
- *                 self._open(filename, 'r', template=template,
+ *                 self._open(filename, 'rb', template=template,
  *                            referencenames=referencenames,
  */
     {
@@ -5402,65 +5180,65 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       __Pyx_XGOTREF(__pyx_save_exc_tb);
       /*try:*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":491
+        /* "csamtools.pyx":496
  *         if mode is None:
  *             try:
- *                 self._open(filename, 'r', template=template,             # <<<<<<<<<<<<<<
+ *                 self._open(filename, 'rb', template=template,             # <<<<<<<<<<<<<<
  *                            referencenames=referencenames,
  *                            referencelengths=referencelengths,
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
         PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-        __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__r));
-        __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
+        __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
+        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__rb));
+        __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
         __pyx_t_3 = 0;
-        __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":492
+        /* "csamtools.pyx":497
  *             try:
- *                 self._open(filename, 'r', template=template,
+ *                 self._open(filename, 'rb', template=template,
  *                            referencenames=referencenames,             # <<<<<<<<<<<<<<
  *                            referencelengths=referencelengths,
  *                            text=text, header=header, port=port)
  */
-        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":493
- *                 self._open(filename, 'r', template=template,
+        /* "csamtools.pyx":498
+ *                 self._open(filename, 'rb', template=template,
  *                            referencenames=referencenames,
  *                            referencelengths=referencelengths,             # <<<<<<<<<<<<<<
  *                            text=text, header=header, port=port)
  *                 return
  */
-        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":494
+        /* "csamtools.pyx":499
  *                            referencenames=referencenames,
  *                            referencelengths=referencelengths,
  *                            text=text, header=header, port=port)             # <<<<<<<<<<<<<<
  *                 return
  *             except ValueError, msg:
  */
-        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-        __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":495
+        /* "csamtools.pyx":500
  *                            referencelengths=referencelengths,
  *                            text=text, header=header, port=port)
  *                 return             # <<<<<<<<<<<<<<
@@ -5487,17 +5265,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":496
+      /* "csamtools.pyx":501
  *                            text=text, header=header, port=port)
  *                 return
  *             except ValueError, msg:             # <<<<<<<<<<<<<<
  *                 pass
- *             self._open(filename, 'rb', template=template,
+ * 
  */
       __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
       if (__pyx_t_6) {
         __Pyx_AddTraceback("csamtools.Samfile._open");
-        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_GOTREF(__pyx_t_4);
@@ -5523,70 +5301,70 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       __pyx_L14_try_end:;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":498
- *             except ValueError, msg:
+    /* "csamtools.pyx":504
  *                 pass
- *             self._open(filename, 'rb', template=template,             # <<<<<<<<<<<<<<
+ * 
+ *             self._open(filename, 'r', template=template,             # <<<<<<<<<<<<<<
  *                        referencenames=referencenames,
  *                        referencelengths=referencelengths,
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
-    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__rb));
-    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
+    __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
+    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__r));
+    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":499
- *                 pass
- *             self._open(filename, 'rb', template=template,
+    /* "csamtools.pyx":505
+ * 
+ *             self._open(filename, 'r', template=template,
  *                        referencenames=referencenames,             # <<<<<<<<<<<<<<
  *                        referencelengths=referencelengths,
  *                        text=text, header=header, port=port)
  */
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":500
- *             self._open(filename, 'rb', template=template,
+    /* "csamtools.pyx":506
+ *             self._open(filename, 'r', template=template,
  *                        referencenames=referencenames,
  *                        referencelengths=referencelengths,             # <<<<<<<<<<<<<<
  *                        text=text, header=header, port=port)
  *             return
  */
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":501
+    /* "csamtools.pyx":507
  *                        referencenames=referencenames,
  *                        referencelengths=referencelengths,
  *                        text=text, header=header, port=port)             # <<<<<<<<<<<<<<
  *             return
  * 
  */
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":502
+    /* "csamtools.pyx":508
  *                        referencelengths=referencelengths,
  *                        text=text, header=header, port=port)
  *             return             # <<<<<<<<<<<<<<
  * 
- *         assert mode in ( "r","w","rb","wb", "wh", "wbu" ), "invalid file opening mode `%s`" % mode
+ *         assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode
  */
     __Pyx_XDECREF(__pyx_r);
     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -5595,25 +5373,25 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":504
+  /* "csamtools.pyx":510
  *             return
  * 
- *         assert mode in ( "r","w","rb","wb", "wh", "wbu" ), "invalid file opening mode `%s`" % mode             # <<<<<<<<<<<<<<
+ *         assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode             # <<<<<<<<<<<<<<
  *         assert filename != NULL
  * 
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   __Pyx_INCREF(__pyx_v_mode);
   __pyx_t_2 = __pyx_v_mode;
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_7 = __pyx_t_1;
   if (!__pyx_t_7) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_8 = __pyx_t_1;
     __pyx_t_1 = __pyx_t_8;
@@ -5621,9 +5399,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     __pyx_t_1 = __pyx_t_7;
   }
   if (!__pyx_t_1) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_8 = __pyx_t_7;
     __pyx_t_7 = __pyx_t_8;
@@ -5631,9 +5409,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     __pyx_t_7 = __pyx_t_1;
   }
   if (!__pyx_t_7) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_8 = __pyx_t_1;
     __pyx_t_1 = __pyx_t_8;
@@ -5641,9 +5419,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     __pyx_t_1 = __pyx_t_7;
   }
   if (!__pyx_t_1) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wh), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wh), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_8 = __pyx_t_7;
     __pyx_t_7 = __pyx_t_8;
@@ -5651,51 +5429,61 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     __pyx_t_7 = __pyx_t_1;
   }
   if (!__pyx_t_7) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wbu), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wbu), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_8 = __pyx_t_1;
     __pyx_t_1 = __pyx_t_8;
   } else {
     __pyx_t_1 = __pyx_t_7;
   }
+  if (!__pyx_t_1) {
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rU), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_7 = __pyx_t_8;
+  } else {
+    __pyx_t_7 = __pyx_t_1;
+  }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_1)) {
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__pyx_t_7)) {
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2));
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":505
+  /* "csamtools.pyx":511
  * 
- *         assert mode in ( "r","w","rb","wb", "wh", "wbu" ), "invalid file opening mode `%s`" % mode
+ *         assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode
  *         assert filename != NULL             # <<<<<<<<<<<<<<
  * 
  *         # close a previously opened file
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   if (unlikely(!(__pyx_v_filename != NULL))) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":508
+  /* "csamtools.pyx":514
  * 
  *         # close a previously opened file
  *         if self.samfile != NULL: self.close()             # <<<<<<<<<<<<<<
  *         self.samfile = NULL
  * 
  */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
-  if (__pyx_t_1) {
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
+  if (__pyx_t_7) {
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5703,7 +5491,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
   }
   __pyx_L17:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":509
+  /* "csamtools.pyx":515
  *         # close a previously opened file
  *         if self.samfile != NULL: self.close()
  *         self.samfile = NULL             # <<<<<<<<<<<<<<
@@ -5712,7 +5500,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":512
+  /* "csamtools.pyx":518
  * 
  *         cdef bam_header_t * header_to_write
  *         header_to_write = NULL             # <<<<<<<<<<<<<<
@@ -5721,45 +5509,54 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
   __pyx_v_header_to_write = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":514
+  /* "csamtools.pyx":520
  *         header_to_write = NULL
  * 
  *         if self._filename != NULL: free(self._filename )             # <<<<<<<<<<<<<<
  *         self._filename = strdup( filename )
- * 
+ *         self.isstream = strcmp( filename, "-" ) == 0
  */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_7 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL);
+  if (__pyx_t_7) {
     free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename);
     goto __pyx_L18;
   }
   __pyx_L18:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":515
+  /* "csamtools.pyx":521
  * 
  *         if self._filename != NULL: free(self._filename )
  *         self._filename = strdup( filename )             # <<<<<<<<<<<<<<
+ *         self.isstream = strcmp( filename, "-" ) == 0
  * 
- *         self.isbam = len(mode) > 1 and mode[1] == 'b'
  */
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":517
+  /* "csamtools.pyx":522
+ *         if self._filename != NULL: free(self._filename )
  *         self._filename = strdup( filename )
+ *         self.isstream = strcmp( filename, "-" ) == 0             # <<<<<<<<<<<<<<
+ * 
+ *         self.isbam = len(mode) > 1 and mode[1] == 'b'
+ */
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = (strcmp(__pyx_v_filename, __pyx_k_18) == 0);
+
+  /* "csamtools.pyx":524
+ *         self.isstream = strcmp( filename, "-" ) == 0
  * 
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'             # <<<<<<<<<<<<<<
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \
  */
-  __pyx_t_9 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_t_9 > 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_t_9 > 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_7) {
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__b), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__b), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = __pyx_t_5;
@@ -5768,34 +5565,34 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     __pyx_t_2 = __pyx_t_3;
     __pyx_t_3 = 0;
   }
-  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = __pyx_t_6;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":519
+  /* "csamtools.pyx":526
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \             # <<<<<<<<<<<<<<
  *             strncmp(filename,"ftp:",4) == 0
  * 
  */
-  __pyx_t_1 = (strncmp(__pyx_v_filename, __pyx_k_13, 5) == 0);
-  if (!__pyx_t_1) {
+  __pyx_t_7 = (strncmp(__pyx_v_filename, __pyx_k_19, 5) == 0);
+  if (!__pyx_t_7) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":520
+    /* "csamtools.pyx":527
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \
  *             strncmp(filename,"ftp:",4) == 0             # <<<<<<<<<<<<<<
  * 
  *         cdef char * ctext
  */
-    __pyx_t_7 = (strncmp(__pyx_v_filename, __pyx_k_14, 4) == 0);
-    __pyx_t_8 = __pyx_t_7;
-  } else {
+    __pyx_t_1 = (strncmp(__pyx_v_filename, __pyx_k_20, 4) == 0);
     __pyx_t_8 = __pyx_t_1;
+  } else {
+    __pyx_t_8 = __pyx_t_7;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":519
+  /* "csamtools.pyx":526
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \             # <<<<<<<<<<<<<<
@@ -5804,7 +5601,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
   ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote = __pyx_t_8;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":523
+  /* "csamtools.pyx":530
  * 
  *         cdef char * ctext
  *         ctext = NULL             # <<<<<<<<<<<<<<
@@ -5813,33 +5610,33 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
   __pyx_v_ctext = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":525
+  /* "csamtools.pyx":532
  *         ctext = NULL
  * 
  *         if mode[0] == 'w':             # <<<<<<<<<<<<<<
  *             # open file for writing
  * 
  */
-  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_8) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":529
+    /* "csamtools.pyx":536
  * 
  *             # header structure (used for writing)
  *             if template:             # <<<<<<<<<<<<<<
  *                 # copy header from another file
  *                 header_to_write = template.samfile.header
  */
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_8) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":531
+      /* "csamtools.pyx":538
  *             if template:
  *                 # copy header from another file
  *                 header_to_write = template.samfile.header             # <<<<<<<<<<<<<<
@@ -5850,17 +5647,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       goto __pyx_L20;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":533
+    /* "csamtools.pyx":540
  *                 header_to_write = template.samfile.header
  * 
  *             elif header:             # <<<<<<<<<<<<<<
  *                 header_to_write = self._buildHeader( header )
  * 
  */
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_8) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":534
+      /* "csamtools.pyx":541
  * 
  *             elif header:
  *                 header_to_write = self._buildHeader( header )             # <<<<<<<<<<<<<<
@@ -5872,44 +5669,44 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":538
+      /* "csamtools.pyx":545
  *             else:
  *                 # build header from a target names and lengths
  *                 assert referencenames and referencelengths, "either supply options `template`, `header` or  both `referencenames` and `referencelengths` for writing"             # <<<<<<<<<<<<<<
  *                 assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences"
  * 
  */
-      #ifndef PYREX_WITHOUT_ASSERTIONS
-      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #ifndef CYTHON_WITHOUT_ASSERTIONS
+      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_8) {
-        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_7 = __pyx_t_1;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = __pyx_t_7;
       } else {
-        __pyx_t_7 = __pyx_t_8;
+        __pyx_t_1 = __pyx_t_8;
       }
-      if (unlikely(!__pyx_t_7)) {
-        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_15));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(!__pyx_t_1)) {
+        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_21));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       #endif
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":539
+      /* "csamtools.pyx":546
  *                 # build header from a target names and lengths
  *                 assert referencenames and referencelengths, "either supply options `template`, `header` or  both `referencenames` and `referencelengths` for writing"
  *                 assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences"             # <<<<<<<<<<<<<<
  * 
  *                 # allocate and fill header
  */
-      #ifndef PYREX_WITHOUT_ASSERTIONS
-      __pyx_t_9 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_10 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #ifndef CYTHON_WITHOUT_ASSERTIONS
+      __pyx_t_9 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (unlikely(!(__pyx_t_9 == __pyx_t_10))) {
-        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_16));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_22));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       #endif
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":542
+      /* "csamtools.pyx":549
  * 
  *                 # allocate and fill header
  *                 header_to_write = bam_header_init()             # <<<<<<<<<<<<<<
@@ -5918,17 +5715,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
       __pyx_v_header_to_write = bam_header_init();
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":543
+      /* "csamtools.pyx":550
  *                 # allocate and fill header
  *                 header_to_write = bam_header_init()
  *                 header_to_write.n_targets = len(referencenames)             # <<<<<<<<<<<<<<
  *                 n = 0
  *                 for x in referencenames: n += len(x) + 1
  */
-      __pyx_t_10 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_v_header_to_write->n_targets = __pyx_t_10;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":544
+      /* "csamtools.pyx":551
  *                 header_to_write = bam_header_init()
  *                 header_to_write.n_targets = len(referencenames)
  *                 n = 0             # <<<<<<<<<<<<<<
@@ -5939,7 +5736,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       __Pyx_DECREF(__pyx_v_n);
       __pyx_v_n = __pyx_int_0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":545
+      /* "csamtools.pyx":552
  *                 header_to_write.n_targets = len(referencenames)
  *                 n = 0
  *                 for x in referencenames: n += len(x) + 1             # <<<<<<<<<<<<<<
@@ -5949,7 +5746,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) {
         __pyx_t_10 = 0; __pyx_t_3 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_3);
       } else {
-        __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
       }
       for (;;) {
@@ -5962,7 +5759,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
         } else {
           __pyx_t_2 = PyIter_Next(__pyx_t_3);
           if (!__pyx_t_2) {
-            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             break;
           }
           __Pyx_GOTREF(__pyx_t_2);
@@ -5970,10 +5767,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
         __Pyx_DECREF(__pyx_v_x);
         __pyx_v_x = __pyx_t_2;
         __pyx_t_2 = 0;
-        __pyx_t_9 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_9 + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_9 + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_v_n);
@@ -5982,27 +5779,27 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
       }
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":546
+      /* "csamtools.pyx":553
  *                 n = 0
  *                 for x in referencenames: n += len(x) + 1
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))             # <<<<<<<<<<<<<<
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:
  */
-      __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_v_header_to_write->target_name = ((char **)calloc(__pyx_t_11, (sizeof(char *))));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":547
+      /* "csamtools.pyx":554
  *                 for x in referencenames: n += len(x) + 1
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))             # <<<<<<<<<<<<<<
  *                 for x from 0 <= x < header_to_write.n_targets:
  *                     header_to_write.target_len[x] = referencelengths[x]
  */
-      __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_v_header_to_write->target_len = ((uint32_t *)calloc(__pyx_t_11, (sizeof(uint32_t))));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":548
+      /* "csamtools.pyx":555
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
@@ -6011,119 +5808,208 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
       __pyx_t_12 = __pyx_v_header_to_write->n_targets;
       for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) {
-        __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(__pyx_v_x);
         __pyx_v_x = __pyx_t_3;
         __pyx_t_3 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":549
+        /* "csamtools.pyx":556
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:
  *                     header_to_write.target_len[x] = referencelengths[x]             # <<<<<<<<<<<<<<
  *                     name = referencenames[x]
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
  */
-        __pyx_t_3 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_14 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_14 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         (__pyx_v_header_to_write->target_len[__pyx_t_10]) = __pyx_t_14;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":550
+        /* "csamtools.pyx":557
  *                 for x from 0 <= x < header_to_write.n_targets:
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]             # <<<<<<<<<<<<<<
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
  *                     strncpy( header_to_write.target_name[x], name, len(name) )
  */
-        __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(__pyx_v_name);
         __pyx_v_name = __pyx_t_3;
         __pyx_t_3 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":551
+        /* "csamtools.pyx":558
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))             # <<<<<<<<<<<<<<
  *                     strncpy( header_to_write.target_name[x], name, len(name) )
  * 
  */
-        __pyx_t_10 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         (__pyx_v_header_to_write->target_name[__pyx_t_9]) = ((char *)calloc((__pyx_t_10 + 1), (sizeof(char))));
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":552
+        /* "csamtools.pyx":559
  *                     name = referencenames[x]
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
  *                     strncpy( header_to_write.target_name[x], name, len(name) )             # <<<<<<<<<<<<<<
  * 
- *                 if text != None:
+ *                 # Optionally, if there is no text, add a SAM compatible header to output
  */
-        __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_15 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_9 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_15 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         strncpy((__pyx_v_header_to_write->target_name[__pyx_t_10]), __pyx_t_15, __pyx_t_9);
-        __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":548
+      /* "csamtools.pyx":555
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]
  */
-      __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_v_x);
       __pyx_v_x = __pyx_t_3;
       __pyx_t_3 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":554
- *                     strncpy( header_to_write.target_name[x], name, len(name) )
- * 
- *                 if text != None:             # <<<<<<<<<<<<<<
- *                     # copy without \0
- *                     ctext = text
+      /* "csamtools.pyx":563
+ *                 # Optionally, if there is no text, add a SAM compatible header to output
+ *                 # file.
+ *                 if text is None and add_sq_text:             # <<<<<<<<<<<<<<
+ *                     text = ''
+ *                     for x from 0 <= x < header_to_write.n_targets:
  */
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_1 = (__pyx_v_text == Py_None);
+      if (__pyx_t_1) {
+        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_add_sq_text); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __pyx_t_8;
+      } else {
+        __pyx_t_7 = __pyx_t_1;
+      }
       if (__pyx_t_7) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":556
- *                 if text != None:
- *                     # copy without \0
- *                     ctext = text             # <<<<<<<<<<<<<<
- *                     header_to_write.l_text = strlen(ctext)
- *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
+        /* "csamtools.pyx":564
+ *                 # file.
+ *                 if text is None and add_sq_text:
+ *                     text = ''             # <<<<<<<<<<<<<<
+ *                     for x from 0 <= x < header_to_write.n_targets:
+ *                         text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
  */
-        __pyx_t_15 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_v_ctext = __pyx_t_15;
+        __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
+        __Pyx_DECREF(__pyx_v_text);
+        __pyx_v_text = ((PyObject *)__pyx_kp_s_12);
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":557
- *                     # copy without \0
- *                     ctext = text
- *                     header_to_write.l_text = strlen(ctext)             # <<<<<<<<<<<<<<
- *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
- *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
+        /* "csamtools.pyx":565
+ *                 if text is None and add_sq_text:
+ *                     text = ''
+ *                     for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
+ *                         text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
+ * 
  */
-        __pyx_v_header_to_write->l_text = strlen(__pyx_v_ctext);
+        __pyx_t_12 = __pyx_v_header_to_write->n_targets;
+        for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) {
+          __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __Pyx_DECREF(__pyx_v_x);
+          __pyx_v_x = __pyx_t_3;
+          __pyx_t_3 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":558
- *                     ctext = text
- *                     header_to_write.l_text = strlen(ctext)
- *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )             # <<<<<<<<<<<<<<
- *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
+          /* "csamtools.pyx":566
+ *                     text = ''
+ *                     for x from 0 <= x < header_to_write.n_targets:
+ *                         text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )             # <<<<<<<<<<<<<<
  * 
+ *                 if text != None:
  */
-        __pyx_v_header_to_write->text = ((char *)calloc(strlen(__pyx_v_ctext), (sizeof(char))));
-
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":559
+          __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_5 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_5);
+          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
+          __Pyx_GIVEREF(__pyx_t_3);
+          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
+          __Pyx_GIVEREF(__pyx_t_5);
+          __pyx_t_3 = 0;
+          __pyx_t_5 = 0;
+          __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+          __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_text, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+          __Pyx_DECREF(__pyx_v_text);
+          __pyx_v_text = __pyx_t_2;
+          __pyx_t_2 = 0;
+          __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+
+        /* "csamtools.pyx":565
+ *                 if text is None and add_sq_text:
+ *                     text = ''
+ *                     for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
+ *                         text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
+ * 
+ */
+        __pyx_t_2 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_v_x);
+        __pyx_v_x = __pyx_t_2;
+        __pyx_t_2 = 0;
+        goto __pyx_L25;
+      }
+      __pyx_L25:;
+
+      /* "csamtools.pyx":568
+ *                         text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
+ * 
+ *                 if text != None:             # <<<<<<<<<<<<<<
+ *                     # copy without \0
+ *                     ctext = text
+ */
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (__pyx_t_7) {
+
+        /* "csamtools.pyx":570
+ *                 if text != None:
+ *                     # copy without \0
+ *                     ctext = text             # <<<<<<<<<<<<<<
+ *                     header_to_write.l_text = strlen(ctext)
+ *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
+ */
+        __pyx_t_15 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_v_ctext = __pyx_t_15;
+
+        /* "csamtools.pyx":571
+ *                     # copy without \0
+ *                     ctext = text
+ *                     header_to_write.l_text = strlen(ctext)             # <<<<<<<<<<<<<<
+ *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
+ *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
+ */
+        __pyx_v_header_to_write->l_text = strlen(__pyx_v_ctext);
+
+        /* "csamtools.pyx":572
+ *                     ctext = text
+ *                     header_to_write.l_text = strlen(ctext)
+ *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )             # <<<<<<<<<<<<<<
+ *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
+ * 
+ */
+        __pyx_v_header_to_write->text = ((char *)calloc(strlen(__pyx_v_ctext), (sizeof(char))));
+
+        /* "csamtools.pyx":573
  *                     header_to_write.l_text = strlen(ctext)
  *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
  *                     memcpy( header_to_write.text, ctext, strlen(ctext) )             # <<<<<<<<<<<<<<
@@ -6131,11 +6017,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  *                 header_to_write.hash = NULL
  */
         memcpy(__pyx_v_header_to_write->text, __pyx_v_ctext, strlen(__pyx_v_ctext));
-        goto __pyx_L25;
+        goto __pyx_L28;
       }
-      __pyx_L25:;
+      __pyx_L28:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":561
+      /* "csamtools.pyx":575
  *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
  * 
  *                 header_to_write.hash = NULL             # <<<<<<<<<<<<<<
@@ -6144,7 +6030,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
       __pyx_v_header_to_write->hash = NULL;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":562
+      /* "csamtools.pyx":576
  * 
  *                 header_to_write.hash = NULL
  *                 header_to_write.rg2lib = NULL             # <<<<<<<<<<<<<<
@@ -6155,64 +6041,64 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
     }
     __pyx_L20:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":566
+    /* "csamtools.pyx":580
  *             # open file. Header gets written to file at the same time for bam files
  *             # and sam files (in the latter case, the mode needs to be wh)
  *             store = StderrStore()             # <<<<<<<<<<<<<<
  *             self.samfile = samopen( filename, mode, header_to_write )
  *             store.release()
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_store);
     __pyx_v_store = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":567
+    /* "csamtools.pyx":581
  *             # and sam files (in the latter case, the mode needs to be wh)
  *             store = StderrStore()
  *             self.samfile = samopen( filename, mode, header_to_write )             # <<<<<<<<<<<<<<
  *             store.release()
  * 
  */
-    __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_v_filename, __pyx_t_15, __pyx_v_header_to_write);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":568
+    /* "csamtools.pyx":582
  *             store = StderrStore()
  *             self.samfile = samopen( filename, mode, header_to_write )
  *             store.release()             # <<<<<<<<<<<<<<
  * 
  *             # bam_header_destroy takes care of cleaning up of all the members
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":571
+    /* "csamtools.pyx":585
  * 
  *             # bam_header_destroy takes care of cleaning up of all the members
  *             if not template and header_to_write != NULL:             # <<<<<<<<<<<<<<
  *                 bam_header_destroy( header_to_write )
  * 
  */
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = (!__pyx_t_7);
-    if (__pyx_t_8) {
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = (!__pyx_t_7);
+    if (__pyx_t_1) {
       __pyx_t_7 = (__pyx_v_header_to_write != NULL);
-      __pyx_t_1 = __pyx_t_7;
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_1 = __pyx_t_8;
+      __pyx_t_8 = __pyx_t_1;
     }
-    if (__pyx_t_1) {
+    if (__pyx_t_8) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":572
+      /* "csamtools.pyx":586
  *             # bam_header_destroy takes care of cleaning up of all the members
  *             if not template and header_to_write != NULL:
  *                 bam_header_destroy( header_to_write )             # <<<<<<<<<<<<<<
@@ -6220,332 +6106,298 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  *         elif mode[0] == "r":
  */
       bam_header_destroy(__pyx_v_header_to_write);
-      goto __pyx_L26;
+      goto __pyx_L29;
     }
-    __pyx_L26:;
+    __pyx_L29:;
     goto __pyx_L19;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":574
+  /* "csamtools.pyx":588
  *                 bam_header_destroy( header_to_write )
  * 
  *         elif mode[0] == "r":             # <<<<<<<<<<<<<<
  *             # open file for reading
  *             if strncmp( filename, "-", 1) != 0 and \
  */
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_1) {
+  if (__pyx_t_8) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":576
+    /* "csamtools.pyx":590
  *         elif mode[0] == "r":
  *             # open file for reading
  *             if strncmp( filename, "-", 1) != 0 and \             # <<<<<<<<<<<<<<
  *                     not self.isremote and \
  *                     not os.path.exists( filename ):
  */
-    __pyx_t_1 = (strncmp(__pyx_v_filename, __pyx_k_17, 1) != 0);
-    if (__pyx_t_1) {
+    __pyx_t_8 = (strncmp(__pyx_v_filename, __pyx_k_18, 1) != 0);
+    if (__pyx_t_8) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":577
+      /* "csamtools.pyx":591
  *             # open file for reading
  *             if strncmp( filename, "-", 1) != 0 and \
  *                     not self.isremote and \             # <<<<<<<<<<<<<<
  *                     not os.path.exists( filename ):
  *                 raise IOError( "file `%s` not found" % filename)
  */
-      __pyx_t_8 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
-      if (__pyx_t_8) {
+      __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
+      if (__pyx_t_1) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":578
+        /* "csamtools.pyx":592
  *             if strncmp( filename, "-", 1) != 0 and \
  *                     not self.isremote and \
  *                     not os.path.exists( filename ):             # <<<<<<<<<<<<<<
  *                 raise IOError( "file `%s` not found" % filename)
  * 
  */
-        __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-        __pyx_t_3 = 0;
-        __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __pyx_t_16 = (!__pyx_t_7);
         __pyx_t_7 = __pyx_t_16;
       } else {
-        __pyx_t_7 = __pyx_t_8;
+        __pyx_t_7 = __pyx_t_1;
       }
-      __pyx_t_8 = __pyx_t_7;
+      __pyx_t_1 = __pyx_t_7;
     } else {
-      __pyx_t_8 = __pyx_t_1;
+      __pyx_t_1 = __pyx_t_8;
     }
-    if (__pyx_t_8) {
+    if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":579
+      /* "csamtools.pyx":593
  *                     not self.isremote and \
  *                     not os.path.exists( filename ):
  *                 raise IOError( "file `%s` not found" % filename)             # <<<<<<<<<<<<<<
  * 
  *             # try to detect errors
  */
-      __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+      __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_Raise(__pyx_t_3, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_2, 0, 0);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L27;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L30;
     }
-    __pyx_L27:;
+    __pyx_L30:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":582
+    /* "csamtools.pyx":596
  * 
  *             # try to detect errors
  *             self.samfile = samopen( filename, mode, NULL )             # <<<<<<<<<<<<<<
  *             if self.samfile == NULL:
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
  */
-    __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_v_filename, __pyx_t_15, NULL);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":583
+    /* "csamtools.pyx":597
  *             # try to detect errors
  *             self.samfile = samopen( filename, mode, NULL )
  *             if self.samfile == NULL:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  */
-    __pyx_t_8 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
-    if (__pyx_t_8) {
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
+    if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":584
+      /* "csamtools.pyx":598
  *             self.samfile = samopen( filename, mode, NULL )
  *             if self.samfile == NULL:
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)             # <<<<<<<<<<<<<<
  * 
  *             if self.samfile.header == NULL:
  */
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+      __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_Raise(__pyx_t_3, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_2, 0, 0);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L28;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L31;
     }
-    __pyx_L28:;
+    __pyx_L31:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":586
+    /* "csamtools.pyx":600
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  *             if self.samfile.header == NULL:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode )
  * 
  */
-    __pyx_t_8 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
-    if (__pyx_t_8) {
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
+    if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":587
+      /* "csamtools.pyx":601
  * 
  *             if self.samfile.header == NULL:
  *                 raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode )             # <<<<<<<<<<<<<<
  * 
  *             #disabled for autodetection to work
  */
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_2, 0, 0);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L29;
-    }
-    __pyx_L29:;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":590
- * 
- *             #disabled for autodetection to work
- *             if self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
- *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
- * 
- */
-    __pyx_t_8 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
-    if (__pyx_t_8) {
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":591
- *             #disabled for autodetection to work
- *             if self.samfile.header.n_targets == 0:
- *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)             # <<<<<<<<<<<<<<
- * 
- *         if self.samfile == NULL:
- */
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+      __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_Raise(__pyx_t_3, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_2, 0, 0);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L30;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L32;
     }
-    __pyx_L30:;
+    __pyx_L32:;
     goto __pyx_L19;
   }
   __pyx_L19:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":593
- *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
+  /* "csamtools.pyx":608
+ *             #    raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  *         if self.samfile == NULL:             # <<<<<<<<<<<<<<
  *             raise IOError("could not open file `%s`" % filename )
  * 
  */
-  __pyx_t_8 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
-  if (__pyx_t_8) {
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
+  if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":594
+    /* "csamtools.pyx":609
  * 
  *         if self.samfile == NULL:
  *             raise IOError("could not open file `%s`" % filename )             # <<<<<<<<<<<<<<
  * 
  *         # check for index and open if present
  */
-    __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L31;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L33;
   }
-  __pyx_L31:;
+  __pyx_L33:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":597
+  /* "csamtools.pyx":612
  * 
  *         # check for index and open if present
  *         if mode[0] == "r" and self.isbam:             # <<<<<<<<<<<<<<
  * 
  *             if not self.isremote:
  */
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__pyx_t_8) {
-    __pyx_t_1 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam;
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_1) {
+    __pyx_t_8 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam;
   } else {
-    __pyx_t_1 = __pyx_t_8;
+    __pyx_t_8 = __pyx_t_1;
   }
-  if (__pyx_t_1) {
+  if (__pyx_t_8) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":599
+    /* "csamtools.pyx":614
  *         if mode[0] == "r" and self.isbam:
  * 
  *             if not self.isremote:             # <<<<<<<<<<<<<<
  *                 if not os.path.exists(filename +".bai"):
  *                     self.index = NULL
  */
-    __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
-    if (__pyx_t_1) {
+    __pyx_t_8 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
+    if (__pyx_t_8) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":600
+      /* "csamtools.pyx":615
  * 
  *             if not self.isremote:
  *                 if not os.path.exists(filename +".bai"):             # <<<<<<<<<<<<<<
  *                     self.index = NULL
  *                 else:
  */
-      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_kp_s_22)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
       __Pyx_GIVEREF(__pyx_t_5);
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_8 = (!__pyx_t_1);
-      if (__pyx_t_8) {
+      __pyx_t_1 = (!__pyx_t_8);
+      if (__pyx_t_1) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":601
+        /* "csamtools.pyx":616
  *             if not self.isremote:
  *                 if not os.path.exists(filename +".bai"):
  *                     self.index = NULL             # <<<<<<<<<<<<<<
@@ -6553,11 +6405,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  *                     # returns NULL if there is no index or index could not be opened
  */
         ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = NULL;
-        goto __pyx_L34;
+        goto __pyx_L36;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":604
+        /* "csamtools.pyx":619
  *                 else:
  *                     # returns NULL if there is no index or index could not be opened
  *                     self.index = bam_index_load(filename)             # <<<<<<<<<<<<<<
@@ -6566,49 +6418,49 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
         ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_v_filename);
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":605
+        /* "csamtools.pyx":620
  *                     # returns NULL if there is no index or index could not be opened
  *                     self.index = bam_index_load(filename)
  *                     if self.index == NULL:             # <<<<<<<<<<<<<<
  *                         raise IOError("error while opening index `%s` " % filename )
  *             else:
  */
-        __pyx_t_8 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
-        if (__pyx_t_8) {
+        __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
+        if (__pyx_t_1) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":606
+          /* "csamtools.pyx":621
  *                     self.index = bam_index_load(filename)
  *                     if self.index == NULL:
  *                         raise IOError("error while opening index `%s` " % filename )             # <<<<<<<<<<<<<<
  *             else:
  *                 self.index = bam_index_load(filename)
  */
-          __pyx_t_5 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_5 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-          __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+          __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
           __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-          __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
-          PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-          __pyx_t_3 = 0;
-          __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-          __Pyx_Raise(__pyx_t_3, 0, 0);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          goto __pyx_L35;
+          __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+          PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+          __pyx_t_2 = 0;
+          __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+          __Pyx_Raise(__pyx_t_2, 0, 0);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          goto __pyx_L37;
         }
-        __pyx_L35:;
+        __pyx_L37:;
       }
-      __pyx_L34:;
-      goto __pyx_L33;
+      __pyx_L36:;
+      goto __pyx_L35;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":608
+      /* "csamtools.pyx":623
  *                         raise IOError("error while opening index `%s` " % filename )
  *             else:
  *                 self.index = bam_index_load(filename)             # <<<<<<<<<<<<<<
@@ -6617,47 +6469,69 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
  */
       ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_v_filename);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":609
+      /* "csamtools.pyx":624
  *             else:
  *                 self.index = bam_index_load(filename)
  *                 if self.index == NULL:             # <<<<<<<<<<<<<<
  *                     raise IOError("error while opening index `%s` " % filename )
  * 
  */
-      __pyx_t_8 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
-      if (__pyx_t_8) {
+      __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
+      if (__pyx_t_1) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":610
+        /* "csamtools.pyx":625
  *                 self.index = bam_index_load(filename)
  *                 if self.index == NULL:
  *                     raise IOError("error while opening index `%s` " % filename )             # <<<<<<<<<<<<<<
  * 
- *     def gettid( self, reference ):
+ *             if not self.isstream:
  */
-        __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
         __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_Raise(__pyx_t_5, 0, 0);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L36;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        goto __pyx_L38;
       }
-      __pyx_L36:;
+      __pyx_L38:;
     }
-    __pyx_L33:;
-    goto __pyx_L32;
+    __pyx_L35:;
+
+    /* "csamtools.pyx":627
+ *                     raise IOError("error while opening index `%s` " % filename )
+ * 
+ *             if not self.isstream:             # <<<<<<<<<<<<<<
+ *                 self.start_offset = bam_tell( self.samfile.x.bam )
+ * 
+ */
+    __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream);
+    if (__pyx_t_1) {
+
+      /* "csamtools.pyx":628
+ * 
+ *             if not self.isstream:
+ *                 self.start_offset = bam_tell( self.samfile.x.bam )             # <<<<<<<<<<<<<<
+ * 
+ *     def gettid( self, reference ):
+ */
+      ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset = bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam);
+      goto __pyx_L39;
+    }
+    __pyx_L39:;
+    goto __pyx_L34;
   }
-  __pyx_L32:;
+  __pyx_L34:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -6674,23 +6548,24 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__open(PyObject *__pyx_v_self, PyOb
   __Pyx_DECREF(__pyx_v_x);
   __Pyx_DECREF(__pyx_v_name);
   __Pyx_DECREF(__pyx_v_store);
+  __Pyx_DECREF(__pyx_v_text);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_TraceReturn(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":612
- *                     raise IOError("error while opening index `%s` " % filename )
+/* "csamtools.pyx":630
+ *                 self.start_offset = bam_tell( self.samfile.x.bam )
  * 
  *     def gettid( self, reference ):             # <<<<<<<<<<<<<<
  *         '''
  *         convert :term:`reference` name into numerical :term:`tid`
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_gettid[] = "Samfile.gettid(self, reference)\n\n        convert :term:`reference` name into numerical :term:`tid`\n\n        returns -1 if reference is not known.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_4gettid[] = "Samfile.gettid(self, reference)\n\n        convert :term:`reference` name into numerical :term:`tid`\n\n        returns -1 if reference is not known.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -6699,40 +6574,34 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_gettid(PyObject *__pyx_v_self, PyO
   char *__pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("gettid");
-  __Pyx_TraceCall("gettid", __pyx_f[0], 612);
+  __Pyx_TraceCall("gettid", __pyx_f[0], 630);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":618
+  /* "csamtools.pyx":636
  *         returns -1 if reference is not known.
  *         '''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         return pysam_reference2tid( self.samfile.header, reference )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":619
+  /* "csamtools.pyx":637
  *         '''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         return pysam_reference2tid( self.samfile.header, reference )             # <<<<<<<<<<<<<<
@@ -6740,11 +6609,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_gettid(PyObject *__pyx_v_self, PyO
  *     def getrname( self, tid ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_5 = PyBytes_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromLong(pysam_reference2tid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = PyBytes_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(pysam_reference2tid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -6761,7 +6630,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_gettid(PyObject *__pyx_v_self, PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":621
+/* "csamtools.pyx":639
  *         return pysam_reference2tid( self.samfile.header, reference )
  * 
  *     def getrname( self, tid ):             # <<<<<<<<<<<<<<
@@ -6769,9 +6638,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_gettid(PyObject *__pyx_v_self, PyO
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_getrname[] = "Samfile.getrname(self, tid)\n\n        convert numerical :term:`tid` into :term:`reference` name.";
-static PyObject *__pyx_pf_9csamtools_7Samfile_getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_5getrname[] = "Samfile.getrname(self, tid)\n\n        convert numerical :term:`tid` into :term:`reference` name.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -6780,97 +6649,91 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_getrname(PyObject *__pyx_v_self, P
   Py_ssize_t __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("getrname");
-  __Pyx_TraceCall("getrname", __pyx_f[0], 621);
+  __Pyx_TraceCall("getrname", __pyx_f[0], 639);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":624
+  /* "csamtools.pyx":642
  *         '''
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":625
+  /* "csamtools.pyx":643
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  *         return self.samfile.header.target_name[tid]
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_tid, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_v_tid, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
+    __Pyx_DECREF(__pyx_t_2);
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  }
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  }
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":626
+    /* "csamtools.pyx":644
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )             # <<<<<<<<<<<<<<
  *         return self.samfile.header.target_name[tid]
  * 
  */
-    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_tid);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tid);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tid);
     __Pyx_GIVEREF(__pyx_v_tid);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":627
+  /* "csamtools.pyx":645
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  *         return self.samfile.header.target_name[tid]             # <<<<<<<<<<<<<<
@@ -6878,11 +6741,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_getrname(PyObject *__pyx_v_self, P
  *     cdef char * _getrname( self, int tid ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_tid); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_r = ((PyObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_tid); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -6899,7 +6762,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_getrname(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":629
+/* "csamtools.pyx":647
  *         return self.samfile.header.target_name[tid]
  * 
  *     cdef char * _getrname( self, int tid ):             # <<<<<<<<<<<<<<
@@ -6916,40 +6779,34 @@ static  char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_
   PyObject *__pyx_t_5 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_getrname");
-  __Pyx_TraceCall("_getrname", __pyx_f[0], 629);
+  __Pyx_TraceCall("_getrname", __pyx_f[0], 647);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":632
+  /* "csamtools.pyx":650
  *         '''
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":633
+  /* "csamtools.pyx":651
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
@@ -6963,44 +6820,44 @@ static  char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":634
+    /* "csamtools.pyx":652
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )             # <<<<<<<<<<<<<<
  *         return self.samfile.header.target_name[tid]
  * 
  */
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_1 = 0;
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_Raise(__pyx_t_1, 0, 0);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":635
+  /* "csamtools.pyx":653
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  *         return self.samfile.header.target_name[tid]             # <<<<<<<<<<<<<<
@@ -7024,7 +6881,7 @@ static  char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":637
+/* "csamtools.pyx":655
  *         return self.samfile.header.target_name[tid]
  * 
  *     def _parseRegion( self,             # <<<<<<<<<<<<<<
@@ -7032,9 +6889,9 @@ static  char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_
  *                       start = None,
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile__parseRegion[] = "Samfile._parseRegion(self, reference=None, start=None, end=None, region=None)\n\n        parse region information.\n\n        raise ValueError for for invalid regions.\n\n        returns a tuple of flag, tid, start and end. Flag indicates\n        whether some coordinates were supplied.\n\n        Note that regions are 1-based, while start,end are python coordinates.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_6_parseRegion[] = "Samfile._parseRegion(self, reference=None, start=None, end=None, region=None)\n\n        parse region information.\n\n        raise ValueError for for invalid regions.\n\n        returns a tuple of flag, tid, start and end. Flag indicates\n        whether some coordinates were supplied.\n\n        Note that regions are 1-based, while start,end are python coordinates.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -7057,12 +6914,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_parseRegion");
-  __Pyx_TraceCall("_parseRegion", __pyx_f[0], 637);
+  __Pyx_TraceCall("_parseRegion", __pyx_f[0], 655);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[4] = {0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":638
+    /* "csamtools.pyx":656
  * 
  *     def _parseRegion( self,
  *                       reference = None,             # <<<<<<<<<<<<<<
@@ -7071,7 +6928,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":639
+    /* "csamtools.pyx":657
  *     def _parseRegion( self,
  *                       reference = None,
  *                       start = None,             # <<<<<<<<<<<<<<
@@ -7080,7 +6937,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":640
+    /* "csamtools.pyx":658
  *                       reference = None,
  *                       start = None,
  *                       end = None,             # <<<<<<<<<<<<<<
@@ -7089,7 +6946,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":641
+    /* "csamtools.pyx":659
  *                       start = None,
  *                       end = None,
  *                       region = None ):             # <<<<<<<<<<<<<<
@@ -7128,7 +6985,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_reference = values[0];
     __pyx_v_start = values[1];
@@ -7136,7 +6993,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
     __pyx_v_region = values[3];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":638
+    /* "csamtools.pyx":656
  * 
  *     def _parseRegion( self,
  *                       reference = None,             # <<<<<<<<<<<<<<
@@ -7145,7 +7002,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":639
+    /* "csamtools.pyx":657
  *     def _parseRegion( self,
  *                       reference = None,
  *                       start = None,             # <<<<<<<<<<<<<<
@@ -7154,7 +7011,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":640
+    /* "csamtools.pyx":658
  *                       reference = None,
  *                       start = None,
  *                       end = None,             # <<<<<<<<<<<<<<
@@ -7163,7 +7020,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":641
+    /* "csamtools.pyx":659
  *                       start = None,
  *                       end = None,
  *                       region = None ):             # <<<<<<<<<<<<<<
@@ -7182,7 +7039,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
   __Pyx_RefNannyFinishContext();
@@ -7191,7 +7048,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   __Pyx_INCREF(__pyx_v_reference);
   __pyx_v_parts = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":660
+  /* "csamtools.pyx":678
  *         cdef long long rend
  * 
  *         rtid = -1             # <<<<<<<<<<<<<<
@@ -7200,7 +7057,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
   __pyx_v_rtid = -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":661
+  /* "csamtools.pyx":679
  * 
  *         rtid = -1
  *         rstart = 0             # <<<<<<<<<<<<<<
@@ -7209,7 +7066,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
   __pyx_v_rstart = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":662
+  /* "csamtools.pyx":680
  *         rtid = -1
  *         rstart = 0
  *         rend = max_pos             # <<<<<<<<<<<<<<
@@ -7218,20 +7075,20 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
   __pyx_v_rend = __pyx_v_9csamtools_max_pos;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":663
+  /* "csamtools.pyx":681
  *         rstart = 0
  *         rend = max_pos
  *         if start != None:             # <<<<<<<<<<<<<<
  *             try:
  *                 rstart = start
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":664
+    /* "csamtools.pyx":682
  *         rend = max_pos
  *         if start != None:
  *             try:             # <<<<<<<<<<<<<<
@@ -7246,14 +7103,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       __Pyx_XGOTREF(__pyx_save_exc_tb);
       /*try:*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":665
+        /* "csamtools.pyx":683
  *         if start != None:
  *             try:
  *                 rstart = start             # <<<<<<<<<<<<<<
  *             except OverflowError:
  *                 raise ValueError( 'start out of range (%i)' % start )
  */
-        __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __pyx_v_rstart = __pyx_t_3;
       }
       __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
@@ -7263,7 +7120,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       __pyx_L7_error:;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":666
+      /* "csamtools.pyx":684
  *             try:
  *                 rstart = start
  *             except OverflowError:             # <<<<<<<<<<<<<<
@@ -7273,31 +7130,31 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
       if (__pyx_t_4) {
         __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
-        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_GOTREF(__pyx_t_6);
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":667
+        /* "csamtools.pyx":685
  *                 rstart = start
  *             except OverflowError:
  *                 raise ValueError( 'start out of range (%i)' % start )             # <<<<<<<<<<<<<<
  * 
  *         if end != None:
  */
-        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
         PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
         __Pyx_Raise(__pyx_t_7, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -7320,20 +7177,20 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":669
+  /* "csamtools.pyx":687
  *                 raise ValueError( 'start out of range (%i)' % start )
  * 
  *         if end != None:             # <<<<<<<<<<<<<<
  *             try:
  *                 rend = end
  */
-  __pyx_t_6 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":670
+    /* "csamtools.pyx":688
  * 
  *         if end != None:
  *             try:             # <<<<<<<<<<<<<<
@@ -7348,14 +7205,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       __Pyx_XGOTREF(__pyx_save_exc_tb);
       /*try:*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":671
+        /* "csamtools.pyx":689
  *         if end != None:
  *             try:
  *                 rend = end             # <<<<<<<<<<<<<<
  *             except OverflowError:
  *                 raise ValueError( 'end out of range (%i)' % end )
  */
-        __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
+        __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
         __pyx_v_rend = __pyx_t_3;
       }
       __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
@@ -7369,7 +7226,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":672
+      /* "csamtools.pyx":690
  *             try:
  *                 rend = end
  *             except OverflowError:             # <<<<<<<<<<<<<<
@@ -7379,31 +7236,31 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
       __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
       if (__pyx_t_4) {
         __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
-        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
+        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_GOTREF(__pyx_t_1);
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":673
+        /* "csamtools.pyx":691
  *                 rend = end
  *             except OverflowError:
  *                 raise ValueError( 'end out of range (%i)' % end )             # <<<<<<<<<<<<<<
  * 
  *         if region:
  */
-        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
+        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
         PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
         __Pyx_Raise(__pyx_t_7, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -7426,108 +7283,108 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   }
   __pyx_L17:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":675
+  /* "csamtools.pyx":693
  *                 raise ValueError( 'end out of range (%i)' % end )
  * 
  *         if region:             # <<<<<<<<<<<<<<
  *             parts = re.split( "[:-]", region )
  *             reference = parts[0]
  */
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":676
+    /* "csamtools.pyx":694
  * 
  *         if region:
  *             parts = re.split( "[:-]", region )             # <<<<<<<<<<<<<<
  *             reference = parts[0]
  *             if len(parts) >= 2: rstart = int(parts[1]) - 1
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_25));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_33));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
     __Pyx_INCREF(__pyx_v_region);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_region);
     __Pyx_GIVEREF(__pyx_v_region);
-    __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_parts);
     __pyx_v_parts = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":677
+    /* "csamtools.pyx":695
  *         if region:
  *             parts = re.split( "[:-]", region )
  *             reference = parts[0]             # <<<<<<<<<<<<<<
  *             if len(parts) >= 2: rstart = int(parts[1]) - 1
  *             if len(parts) >= 3: rend = int(parts[2])
  */
-    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_v_reference);
     __pyx_v_reference = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":678
+    /* "csamtools.pyx":696
  *             parts = re.split( "[:-]", region )
  *             reference = parts[0]
  *             if len(parts) >= 2: rstart = int(parts[1]) - 1             # <<<<<<<<<<<<<<
  *             if len(parts) >= 3: rend = int(parts[2])
  * 
  */
-    __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_2 = (__pyx_t_9 >= 2);
     if (__pyx_t_2) {
-      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
       __Pyx_GIVEREF(__pyx_t_6);
       __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_v_rstart = __pyx_t_3;
       goto __pyx_L29;
     }
     __pyx_L29:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":679
+    /* "csamtools.pyx":697
  *             reference = parts[0]
  *             if len(parts) >= 2: rstart = int(parts[1]) - 1
  *             if len(parts) >= 3: rend = int(parts[2])             # <<<<<<<<<<<<<<
  * 
  *         if not reference: return 0, 0, 0, 0
  */
-    __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_2 = (__pyx_t_9 >= 3);
     if (__pyx_t_2) {
-      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_v_rend = __pyx_t_3;
       goto __pyx_L30;
@@ -7537,61 +7394,47 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   }
   __pyx_L28:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":681
+  /* "csamtools.pyx":699
  *             if len(parts) >= 3: rend = int(parts[2])
  * 
  *         if not reference: return 0, 0, 0, 0             # <<<<<<<<<<<<<<
  * 
  *         rtid = self.gettid( reference )
  */
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_10 = (!__pyx_t_2);
   if (__pyx_t_10) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(__pyx_int_0);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
-    __Pyx_GIVEREF(__pyx_int_0);
-    __Pyx_INCREF(__pyx_int_0);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
-    __Pyx_GIVEREF(__pyx_int_0);
-    __Pyx_INCREF(__pyx_int_0);
-    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
-    __Pyx_GIVEREF(__pyx_int_0);
-    __Pyx_INCREF(__pyx_int_0);
-    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_0);
-    __Pyx_GIVEREF(__pyx_int_0);
-    __pyx_r = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_34));
+    __pyx_r = ((PyObject *)__pyx_k_tuple_34);
     goto __pyx_L0;
     goto __pyx_L31;
   }
   __pyx_L31:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":683
+  /* "csamtools.pyx":701
  *         if not reference: return 0, 0, 0, 0
  * 
  *         rtid = self.gettid( reference )             # <<<<<<<<<<<<<<
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   __Pyx_INCREF(__pyx_v_reference);
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __pyx_v_rtid = __pyx_t_4;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":684
+  /* "csamtools.pyx":702
  * 
  *         rtid = self.gettid( reference )
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )             # <<<<<<<<<<<<<<
@@ -7600,24 +7443,24 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
   __pyx_t_10 = (__pyx_v_rtid < 0);
   if (__pyx_t_10) {
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), __pyx_v_reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_5, 0, 0);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L32;
   }
   __pyx_L32:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":685
+  /* "csamtools.pyx":703
  *         rtid = self.gettid( reference )
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )             # <<<<<<<<<<<<<<
@@ -7626,37 +7469,37 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
  */
   __pyx_t_10 = (__pyx_v_rstart > __pyx_v_rend);
   if (__pyx_t_10) {
-    __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
     __pyx_t_5 = 0;
     __pyx_t_6 = 0;
-    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_Raise(__pyx_t_6, 0, 0);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L33;
   }
   __pyx_L33:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":686
+  /* "csamtools.pyx":704
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
  *         if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )             # <<<<<<<<<<<<<<
@@ -7669,27 +7512,27 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   }
   __pyx_t_2 = (!__pyx_t_10);
   if (__pyx_t_2) {
-    __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_1, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L34;
   }
   __pyx_L34:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":687
+  /* "csamtools.pyx":705
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
  *         if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
  *         if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )             # <<<<<<<<<<<<<<
@@ -7702,42 +7545,42 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   }
   __pyx_t_10 = (!__pyx_t_2);
   if (__pyx_t_10) {
-    __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_Raise(__pyx_t_6, 0, 0);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L35;
   }
   __pyx_L35:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":689
+  /* "csamtools.pyx":707
  *         if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
  * 
  *         return 1, rtid, rstart, rend             # <<<<<<<<<<<<<<
  * 
- *     def seek( self, uint64_t offset, int where = 0):
+ *     def reset( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
@@ -7750,7 +7593,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   __pyx_t_6 = 0;
   __pyx_t_1 = 0;
   __pyx_t_5 = 0;
-  __pyx_r = __pyx_t_7;
+  __pyx_r = ((PyObject *)__pyx_t_7);
   __pyx_t_7 = 0;
   goto __pyx_L0;
 
@@ -7773,17 +7616,79 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__parseRegion(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":691
+/* "csamtools.pyx":709
  *         return 1, rtid, rstart, rend
  * 
+ *     def reset( self ):             # <<<<<<<<<<<<<<
+ *         '''reset file position to beginning of read section.'''
+ *         return self.seek( self.start_offset, 0 )
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_7reset[] = "Samfile.reset(self)\nreset file position to beginning of read section.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("reset");
+  __Pyx_TraceCall("reset", __pyx_f[0], 709);
+
+  /* "csamtools.pyx":711
+ *     def reset( self ):
+ *         '''reset file position to beginning of read section.'''
+ *         return self.seek( self.start_offset, 0 )             # <<<<<<<<<<<<<<
+ * 
+ *     def seek( self, uint64_t offset, int where = 0):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
+  __Pyx_GIVEREF(__pyx_int_0);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("csamtools.Samfile.reset");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":713
+ *         return self.seek( self.start_offset, 0 )
+ * 
  *     def seek( self, uint64_t offset, int where = 0):             # <<<<<<<<<<<<<<
  *         '''
  *         move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n        move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_8seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n        move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   uint64_t __pyx_v_offset;
   int __pyx_v_where;
   PyObject *__pyx_r = NULL;
@@ -7794,7 +7699,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_seek(PyObject *__pyx_v_self, PyObj
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("seek");
-  __Pyx_TraceCall("seek", __pyx_f[0], 691);
+  __Pyx_TraceCall("seek", __pyx_f[0], 713);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[2] = {0,0};
@@ -7816,112 +7721,125 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_seek(PyObject *__pyx_v_self, PyObj
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(values[0]); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(values[0]); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     if (values[1]) {
-      __pyx_v_where = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_where = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_where = ((int)0);
     }
   } else {
     __pyx_v_where = ((int)0);
     switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: __pyx_v_where = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      case  1: __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  2: __pyx_v_where = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  1: __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       break;
       default: goto __pyx_L5_argtuple_error;
     }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile.seek");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":696
+  /* "csamtools.pyx":718
  *         '''
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":697
+    /* "csamtools.pyx":719
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":698
+  /* "csamtools.pyx":720
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:             # <<<<<<<<<<<<<<
  *             raise NotImplementedError("seek only available in bam files")
- *         return bam_seek( self.samfile.x.bam, offset, where )
+ *         if self.isstream:
  */
   __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":699
+    /* "csamtools.pyx":721
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
- *         return bam_seek( self.samfile.x.bam, offset, where )
- * 
+ *         if self.isstream:
+ *             raise OSError("seek no available in streams")
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_28));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":700
+  /* "csamtools.pyx":722
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")
+ *         if self.isstream:             # <<<<<<<<<<<<<<
+ *             raise OSError("seek no available in streams")
+ * 
+ */
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
+
+    /* "csamtools.pyx":723
+ *             raise NotImplementedError("seek only available in bam files")
+ *         if self.isstream:
+ *             raise OSError("seek no available in streams")             # <<<<<<<<<<<<<<
+ * 
+ *         return bam_seek( self.samfile.x.bam, offset, where )
+ */
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L8;
+  }
+  __pyx_L8:;
+
+  /* "csamtools.pyx":725
+ *             raise OSError("seek no available in streams")
+ * 
  *         return bam_seek( self.samfile.x.bam, offset, where )             # <<<<<<<<<<<<<<
  * 
  *     def tell( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -7941,7 +7859,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_seek(PyObject *__pyx_v_self, PyObj
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":702
+/* "csamtools.pyx":727
  *         return bam_seek( self.samfile.x.bam, offset, where )
  * 
  *     def tell( self ):             # <<<<<<<<<<<<<<
@@ -7949,9 +7867,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_seek(PyObject *__pyx_v_self, PyObj
  *         return current file position
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_tell[] = "Samfile.tell(self)\n\n        return current file position\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_9tell[] = "Samfile.tell(self)\n\n        return current file position\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -7959,48 +7877,42 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHO
   int __pyx_t_4;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("tell");
-  __Pyx_TraceCall("tell", __pyx_f[0], 702);
+  __Pyx_TraceCall("tell", __pyx_f[0], 727);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":706
+  /* "csamtools.pyx":731
  *         return current file position
  *         '''
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":707
+    /* "csamtools.pyx":732
  *         '''
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":708
+  /* "csamtools.pyx":733
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:             # <<<<<<<<<<<<<<
@@ -8010,29 +7922,23 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHO
   __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":709
+    /* "csamtools.pyx":734
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
  * 
  *         return bam_tell( self.samfile.x.bam )
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_28));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":711
+  /* "csamtools.pyx":736
  *             raise NotImplementedError("seek only available in bam files")
  * 
  *         return bam_tell( self.samfile.x.bam )             # <<<<<<<<<<<<<<
@@ -8040,7 +7946,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHO
  *     def fetch( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -8060,7 +7966,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":713
+/* "csamtools.pyx":738
  *         return bam_tell( self.samfile.x.bam )
  * 
  *     def fetch( self,             # <<<<<<<<<<<<<<
@@ -8068,9 +7974,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_tell(PyObject *__pyx_v_self, CYTHO
  *                start = None,
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_fetch[] = "Samfile.fetch(self, reference=None, start=None, end=None, region=None, callback=None, until_eof=False)\n\n        fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can \n        be supplied.\n\n        Without *reference* or *region* all reads will be fetched. The reads will be returned\n        ordered by reference sequence, which will not necessarily be the order within the file.\n        If *until_eof* is given, all reads from the current file position will be returned\n        *in order as they are within the file*.  \n        \n        If only *reference* is set, all reads aligned to *reference* will be fetched.\n\n        The method returns an iterator of type :class:`pysam.IteratorRow` unless\n        a *callback is provided. If *callback* is given, the callback will be executed \n        for each position within the :term:`region`. Note that callbacks currently work\n        only, if *region* or *reference* is given.\n\n        Note that a :term:`SAM` file does not allow random access. If *region* or *reference* are given,\n        an exception is raised.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_10fetch[] = "Samfile.fetch(self, reference=None, start=None, end=None, region=None, callback=None, until_eof=False)\n\n        fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can \n        be supplied.\n\n        Without *reference* or *region* all mapped reads will be fetched. The reads will be returned\n        ordered by reference sequence, which will not necessarily be the order within the file.\n\n        If *until_eof* is given, all reads from the current file position will be returned\n        in order as they are within the file. Using this option will also fetch unmapped reads. \n        \n        If only *reference* is set, all reads aligned to *reference* will be fetched.\n\n        The method returns an iterator of type :class:`pysam.IteratorRow` unless\n        a *callback is provided. If *callback* is given, the callback will be executed \n        for each position within the :term:`region`. Note that callbacks currently work\n        only, if *region* or *reference* is given.\n\n        Note that a :term:`SAM` file does not allow random access. If *region* or *reference* are given,\n        an exception is raised.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -8081,6 +7987,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
   int __pyx_v_rstart;
   int __pyx_v_rend;
   int __pyx_v_has_coord;
+  int __pyx_v_reopen;
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -8099,12 +8006,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,&__pyx_n_s__until_eof,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("fetch");
-  __Pyx_TraceCall("fetch", __pyx_f[0], 713);
+  __Pyx_TraceCall("fetch", __pyx_f[0], 738);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[6] = {0,0,0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":714
+    /* "csamtools.pyx":739
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -8113,7 +8020,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":715
+    /* "csamtools.pyx":740
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -8122,7 +8029,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":716
+    /* "csamtools.pyx":741
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -8131,7 +8038,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":717
+    /* "csamtools.pyx":742
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -8140,7 +8047,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":718
+    /* "csamtools.pyx":743
  *                end = None,
  *                region = None,
  *                callback = None,             # <<<<<<<<<<<<<<
@@ -8148,7 +8055,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  *         '''
  */
     values[4] = ((PyObject *)Py_None);
-    values[5] = __pyx_k_29;
+    values[5] = __pyx_k_44;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
       case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
@@ -8192,7 +8099,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_reference = values[0];
     __pyx_v_start = values[1];
@@ -8202,7 +8109,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
     __pyx_v_until_eof = values[5];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":714
+    /* "csamtools.pyx":739
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -8211,7 +8118,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":715
+    /* "csamtools.pyx":740
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -8220,7 +8127,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":716
+    /* "csamtools.pyx":741
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -8229,7 +8136,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":717
+    /* "csamtools.pyx":742
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -8238,7 +8145,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_region = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":718
+    /* "csamtools.pyx":743
  *                end = None,
  *                region = None,
  *                callback = None,             # <<<<<<<<<<<<<<
@@ -8246,7 +8153,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  *         '''
  */
     __pyx_v_callback = ((PyObject *)Py_None);
-    __pyx_v_until_eof = __pyx_k_29;
+    __pyx_v_until_eof = __pyx_k_44;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  6: __pyx_v_until_eof = PyTuple_GET_ITEM(__pyx_args, 5);
       case  5: __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 4);
@@ -8260,92 +8167,86 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile.fetch");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":742
+  /* "csamtools.pyx":768
  *         cdef int rtid, rstart, rend, has_coord
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":743
+    /* "csamtools.pyx":769
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":745
+  /* "csamtools.pyx":771
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
- *         if self.isbam:
+ *         if self.isstream: reopen = False
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
   __Pyx_INCREF(__pyx_v_start);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_start);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
   __Pyx_GIVEREF(__pyx_v_start);
   __Pyx_INCREF(__pyx_v_end);
-  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
   __Pyx_GIVEREF(__pyx_v_end);
   __Pyx_INCREF(__pyx_v_region);
-  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_region);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
   __Pyx_GIVEREF(__pyx_v_region);
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
     PyObject* tuple = __pyx_t_5;
-    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
-    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
-    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_v_has_coord = __pyx_t_8;
@@ -8353,26 +8254,26 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
     __pyx_v_rstart = __pyx_t_10;
     __pyx_v_rend = __pyx_t_11;
   } else {
-    __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     __pyx_v_has_coord = __pyx_t_11;
     __pyx_v_rtid = __pyx_t_10;
@@ -8380,31 +8281,55 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
     __pyx_v_rend = __pyx_t_8;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":747
+  /* "csamtools.pyx":773
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  * 
+ *         if self.isstream: reopen = False             # <<<<<<<<<<<<<<
+ *         else: reopen = True
+ * 
+ */
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
+    __pyx_v_reopen = 0;
+    goto __pyx_L7;
+  }
+  /*else*/ {
+
+    /* "csamtools.pyx":774
+ * 
+ *         if self.isstream: reopen = False
+ *         else: reopen = True             # <<<<<<<<<<<<<<
+ * 
+ *         if self.isbam:
+ */
+    __pyx_v_reopen = 1;
+  }
+  __pyx_L7:;
+
+  /* "csamtools.pyx":776
+ *         else: reopen = True
+ * 
  *         if self.isbam:             # <<<<<<<<<<<<<<
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )
  */
   if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":748
+    /* "csamtools.pyx":777
  * 
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "fetch called on bamfile without index" )
  * 
  */
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_13 = (!__pyx_t_4);
       if (__pyx_t_13) {
@@ -8419,39 +8344,33 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
     }
     if (__pyx_t_13) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":749
+      /* "csamtools.pyx":778
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
  * 
  *             if callback:
  */
-      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
-      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_30));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_7, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L9;
     }
-    __pyx_L8:;
+    __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":751
+    /* "csamtools.pyx":780
  *                 raise ValueError( "fetch called on bamfile without index" )
  * 
  *             if callback:             # <<<<<<<<<<<<<<
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )
  */
-    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_13) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":752
+      /* "csamtools.pyx":781
  * 
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -8460,53 +8379,41 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
       __pyx_t_13 = (!__pyx_v_has_coord);
       if (__pyx_t_13) {
-        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
-        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_31));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
-        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_Raise(__pyx_t_7, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L10;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        goto __pyx_L11;
       }
-      __pyx_L10:;
+      __pyx_L11:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":753
+      /* "csamtools.pyx":782
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
  *                 return bam_fetch(self.samfile.x.bam,
  *                                  self.index,
  */
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_3 = (!__pyx_t_13);
       if (__pyx_t_3) {
-        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
-        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_32));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
-        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_Raise(__pyx_t_5, 0, 0);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __Pyx_Raise(__pyx_t_7, 0, 0);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L11;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        goto __pyx_L12;
       }
-      __pyx_L11:;
+      __pyx_L12:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":754
+      /* "csamtools.pyx":783
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )
  *                 return bam_fetch(self.samfile.x.bam,             # <<<<<<<<<<<<<<
@@ -8515,253 +8422,252 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
  */
       __Pyx_XDECREF(__pyx_r);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":760
+      /* "csamtools.pyx":789
  *                                  rend,
  *                                  <void*>callback,
  *                                  fetch_callback )             # <<<<<<<<<<<<<<
  *             else:
  *                 if has_coord:
  */
-      __pyx_t_7 = PyInt_FromLong(bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)__pyx_v_callback), __pyx_f_9csamtools_fetch_callback)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_r = __pyx_t_7;
-      __pyx_t_7 = 0;
+      __pyx_t_5 = PyInt_FromLong(bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)__pyx_v_callback), __pyx_f_9csamtools_fetch_callback)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_r = __pyx_t_5;
+      __pyx_t_5 = 0;
       goto __pyx_L0;
-      goto __pyx_L9;
+      goto __pyx_L10;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":762
+      /* "csamtools.pyx":791
  *                                  fetch_callback )
  *             else:
  *                 if has_coord:             # <<<<<<<<<<<<<<
- *                     return IteratorRowRegion( self, rtid, rstart, rend )
+ *                     return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
  *                 else:
  */
       if (__pyx_v_has_coord) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":763
+        /* "csamtools.pyx":792
  *             else:
  *                 if has_coord:
- *                     return IteratorRowRegion( self, rtid, rstart, rend )             # <<<<<<<<<<<<<<
+ *                     return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )             # <<<<<<<<<<<<<<
  *                 else:
  *                     if until_eof:
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_7 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_self);
-        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
         __Pyx_GIVEREF(__pyx_v_self);
-        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
-        __Pyx_GIVEREF(__pyx_t_7);
-        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
         __Pyx_GIVEREF(__pyx_t_5);
-        PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_6);
+        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
+        __Pyx_GIVEREF(__pyx_t_7);
+        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
-        __pyx_t_7 = 0;
         __pyx_t_5 = 0;
+        __pyx_t_7 = 0;
         __pyx_t_6 = 0;
-        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_r = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+        __pyx_r = __pyx_t_7;
+        __pyx_t_7 = 0;
         goto __pyx_L0;
-        goto __pyx_L12;
+        goto __pyx_L13;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":765
- *                     return IteratorRowRegion( self, rtid, rstart, rend )
+        /* "csamtools.pyx":794
+ *                     return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
  *                 else:
  *                     if until_eof:             # <<<<<<<<<<<<<<
- *                         return IteratorRowAll( self )
+ *                         return IteratorRowAll( self, reopen=reopen )
  *                     else:
  */
-        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_3) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":766
+          /* "csamtools.pyx":795
  *                 else:
  *                     if until_eof:
- *                         return IteratorRowAll( self )             # <<<<<<<<<<<<<<
+ *                         return IteratorRowAll( self, reopen=reopen )             # <<<<<<<<<<<<<<
  *                     else:
- *                         return IteratorRowAllRefs(self)
+ *                         # AH: check - reason why no reopen for AllRefs?
  */
           __Pyx_XDECREF(__pyx_r);
-          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_6);
+          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
           __Pyx_INCREF(__pyx_v_self);
-          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
+          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
           __Pyx_GIVEREF(__pyx_v_self);
-          __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __pyx_r = __pyx_t_1;
-          __pyx_t_1 = 0;
+          __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+          __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+          __pyx_r = __pyx_t_2;
+          __pyx_t_2 = 0;
           goto __pyx_L0;
-          goto __pyx_L13;
+          goto __pyx_L14;
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":768
- *                         return IteratorRowAll( self )
+          /* "csamtools.pyx":798
  *                     else:
- *                         return IteratorRowAllRefs(self)             # <<<<<<<<<<<<<<
+ *                         # AH: check - reason why no reopen for AllRefs?
+ *                         return IteratorRowAllRefs(self ) # , reopen=reopen )             # <<<<<<<<<<<<<<
  *         else:
  *             # check if header is present - otherwise sam_read1 aborts
  */
           __Pyx_XDECREF(__pyx_r);
-          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
           __Pyx_INCREF(__pyx_v_self);
-          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
+          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
           __Pyx_GIVEREF(__pyx_v_self);
-          __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAllRefs)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAllRefs)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
           __pyx_r = __pyx_t_6;
           __pyx_t_6 = 0;
           goto __pyx_L0;
         }
-        __pyx_L13:;
+        __pyx_L14:;
       }
-      __pyx_L12:;
+      __pyx_L13:;
     }
-    __pyx_L9:;
-    goto __pyx_L7;
+    __pyx_L10:;
+    goto __pyx_L8;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":772
+    /* "csamtools.pyx":802
  *             # check if header is present - otherwise sam_read1 aborts
  *             # this happens if a bamfile is opened with mode 'r'
- *             if self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
- *                 raise ValueError( "fetch called for samfile without header")
+ *             if has_coord:             # <<<<<<<<<<<<<<
+ *                 raise ValueError ("fetching by region is not available for sam files" )
  * 
  */
-    __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
-    if (__pyx_t_3) {
+    if (__pyx_v_has_coord) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":773
+      /* "csamtools.pyx":803
  *             # this happens if a bamfile is opened with mode 'r'
- *             if self.samfile.header.n_targets == 0:
- *                 raise ValueError( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
+ *             if has_coord:
+ *                 raise ValueError ("fetching by region is not available for sam files" )             # <<<<<<<<<<<<<<
  * 
- *             if region != None:
+ *             if self.samfile.header.n_targets == 0:
  */
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
-      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_33));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_Raise(__pyx_t_6, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L14;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L15;
     }
-    __pyx_L14:;
+    __pyx_L15:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":775
+    /* "csamtools.pyx":805
+ *                 raise ValueError ("fetching by region is not available for sam files" )
+ * 
+ *             if self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "fetch called for samfile without header")
  * 
- *             if region != None:             # <<<<<<<<<<<<<<
- *                 raise ValueError ("fetch for a region is not available for sam files" )
- *             if callback:
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_region, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":776
+      /* "csamtools.pyx":806
+ * 
+ *             if self.samfile.header.n_targets == 0:
+ *                 raise ValueError( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
  * 
- *             if region != None:
- *                 raise ValueError ("fetch for a region is not available for sam files" )             # <<<<<<<<<<<<<<
  *             if callback:
- *                 raise NotImplementedError( "callback not implemented yet" )
  */
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
-      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_34));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
-      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_Raise(__pyx_t_6, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L15;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L16;
     }
-    __pyx_L15:;
+    __pyx_L16:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":777
- *             if region != None:
- *                 raise ValueError ("fetch for a region is not available for sam files" )
+    /* "csamtools.pyx":808
+ *                 raise ValueError( "fetch called for samfile without header")
+ * 
  *             if callback:             # <<<<<<<<<<<<<<
  *                 raise NotImplementedError( "callback not implemented yet" )
  *             else:
  */
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":778
- *                 raise ValueError ("fetch for a region is not available for sam files" )
+      /* "csamtools.pyx":809
+ * 
  *             if callback:
  *                 raise NotImplementedError( "callback not implemented yet" )             # <<<<<<<<<<<<<<
  *             else:
- *                 return IteratorRowAll( self )
+ *                 return IteratorRowAll( self, reopen=reopen )
  */
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
-      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_35));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_Raise(__pyx_t_6, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L16;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L17;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":780
+      /* "csamtools.pyx":811
  *                 raise NotImplementedError( "callback not implemented yet" )
  *             else:
- *                 return IteratorRowAll( self )             # <<<<<<<<<<<<<<
+ *                 return IteratorRowAll( self, reopen=reopen )             # <<<<<<<<<<<<<<
  * 
  *     def mate( self,
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_INCREF(__pyx_v_self);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
       __Pyx_GIVEREF(__pyx_v_self);
-      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_r = __pyx_t_6;
-      __pyx_t_6 = 0;
+      __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_r = __pyx_t_7;
+      __pyx_t_7 = 0;
       goto __pyx_L0;
     }
-    __pyx_L16:;
+    __pyx_L17:;
   }
-  __pyx_L7:;
+  __pyx_L8:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -8781,17 +8687,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_fetch(PyObject *__pyx_v_self, PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":782
- *                 return IteratorRowAll( self )
+/* "csamtools.pyx":813
+ *                 return IteratorRowAll( self, reopen=reopen )
  * 
  *     def mate( self,             # <<<<<<<<<<<<<<
  *               AlignedRead read ):
  *         '''return the mate of :class:`AlignedRead` *read*.
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_mate[] = "Samfile.mate(self, AlignedRead read)\nreturn the mate of :class:`AlignedRead` *read*.\n\n        Throws a ValueError if read is unpaired or the mate\n        is unmapped.\n\n        .. note::\n            Calling this method will change the file position.\n            This might interfere with any iterators that have\n            not re-opened the file.\n\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_11mate[] = "Samfile.mate(self, AlignedRead read)\nreturn the mate of :class:`AlignedRead` *read*.\n\n        Throws a ValueError if read is unpaired or the mate\n        is unmapped.\n\n        .. note::\n            Calling this method will change the file position.\n            This might interfere with any iterators that have\n            not re-opened the file.\n\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
   uint32_t __pyx_v_flag;
   __pyx_t_9csamtools_MateData __pyx_v_mate_data;
   int __pyx_v_x;
@@ -8802,10 +8708,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
   PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("mate");
-  __Pyx_TraceCall("mate", __pyx_f[0], 782);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("mate", __pyx_f[0], 813);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":795
+  /* "csamtools.pyx":826
  * 
  *         '''
  *         cdef uint32_t flag = read._delegate.core.flag             # <<<<<<<<<<<<<<
@@ -8814,7 +8720,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   __pyx_v_flag = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.flag;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":797
+  /* "csamtools.pyx":828
  *         cdef uint32_t flag = read._delegate.core.flag
  * 
  *         if flag & BAM_FPAIRED == 0:             # <<<<<<<<<<<<<<
@@ -8824,34 +8730,34 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
   __pyx_t_1 = ((__pyx_v_flag & 1) == 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":798
+    /* "csamtools.pyx":829
  * 
  *         if flag & BAM_FPAIRED == 0:
  *             raise ValueError( "read %s: is unpaired" % (read.qname))             # <<<<<<<<<<<<<<
  *         if flag & BAM_FMUNMAP != 0:
  *             raise ValueError( "mate %s: is unmapped" % (read.qname))
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":799
+  /* "csamtools.pyx":830
  *         if flag & BAM_FPAIRED == 0:
  *             raise ValueError( "read %s: is unpaired" % (read.qname))
  *         if flag & BAM_FMUNMAP != 0:             # <<<<<<<<<<<<<<
@@ -8861,34 +8767,34 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
   __pyx_t_1 = ((__pyx_v_flag & 8) != 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":800
+    /* "csamtools.pyx":831
  *             raise ValueError( "read %s: is unpaired" % (read.qname))
  *         if flag & BAM_FMUNMAP != 0:
  *             raise ValueError( "mate %s: is unmapped" % (read.qname))             # <<<<<<<<<<<<<<
  * 
  *         cdef MateData mate_data
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_59), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":804
+  /* "csamtools.pyx":835
  *         cdef MateData mate_data
  * 
  *         mate_data.name = <char *>bam1_qname(read._delegate)             # <<<<<<<<<<<<<<
@@ -8897,7 +8803,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   __pyx_v_mate_data.name = bam1_qname(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":805
+  /* "csamtools.pyx":836
  * 
  *         mate_data.name = <char *>bam1_qname(read._delegate)
  *         mate_data.mate = NULL             # <<<<<<<<<<<<<<
@@ -8906,7 +8812,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   __pyx_v_mate_data.mate = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":807
+  /* "csamtools.pyx":838
  *         mate_data.mate = NULL
  *         # xor flags to get the other mate
  *         cdef int x = BAM_FREAD1 + BAM_FREAD2             # <<<<<<<<<<<<<<
@@ -8915,7 +8821,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   __pyx_v_x = 192;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":808
+  /* "csamtools.pyx":839
  *         # xor flags to get the other mate
  *         cdef int x = BAM_FREAD1 + BAM_FREAD2
  *         mate_data.flag = ( flag ^ x) & x             # <<<<<<<<<<<<<<
@@ -8924,7 +8830,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   __pyx_v_mate_data.flag = ((__pyx_v_flag ^ __pyx_v_x) & __pyx_v_x);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":816
+  /* "csamtools.pyx":847
  *                   read._delegate.core.mpos + 1,
  *                   <void*>&mate_data,
  *                   mate_callback )             # <<<<<<<<<<<<<<
@@ -8933,7 +8839,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mtid, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos, (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos + 1), ((void *)(&__pyx_v_mate_data)), __pyx_f_9csamtools_mate_callback);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":818
+  /* "csamtools.pyx":849
  *                   mate_callback )
  * 
  *         if mate_data.mate == NULL:             # <<<<<<<<<<<<<<
@@ -8943,42 +8849,36 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
   __pyx_t_1 = (__pyx_v_mate_data.mate == NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":819
+    /* "csamtools.pyx":850
  * 
  *         if mate_data.mate == NULL:
  *             raise ValueError( "mate not found" )             # <<<<<<<<<<<<<<
  * 
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_38));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":821
+  /* "csamtools.pyx":852
  *             raise ValueError( "mate not found" )
  * 
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)             # <<<<<<<<<<<<<<
  *         dest._delegate = mate_data.mate
  *         return dest
  */
-  __pyx_t_3 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_3);
-  __pyx_t_3 = 0;
+  __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_2);
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":822
+  /* "csamtools.pyx":853
  * 
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *         dest._delegate = mate_data.mate             # <<<<<<<<<<<<<<
@@ -8987,7 +8887,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  */
   __pyx_v_dest->_delegate = __pyx_v_mate_data.mate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":823
+  /* "csamtools.pyx":854
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *         dest._delegate = mate_data.mate
  *         return dest             # <<<<<<<<<<<<<<
@@ -9014,7 +8914,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":825
+/* "csamtools.pyx":856
  *         return dest
  * 
  *     def count( self,             # <<<<<<<<<<<<<<
@@ -9022,9 +8922,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_mate(PyObject *__pyx_v_self, PyObj
  *                start = None,
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_count[] = "Samfile.count(self, reference=None, start=None, end=None, region=None, until_eof=False)\n*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*\n               \n        count  reads :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n        Note that a :term:`TAM` file does not allow random access. If *region* or *reference* are given,\n        an exception is raised.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_12count[] = "Samfile.count(self, reference=None, start=None, end=None, region=None, until_eof=False)\n*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*\n               \n        count  reads :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n        Note that a :term:`TAM` file does not allow random access. If *region* or *reference* are given,\n        an exception is raised.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -9051,12 +8951,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__until_eof,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("count");
-  __Pyx_TraceCall("count", __pyx_f[0], 825);
+  __Pyx_TraceCall("count", __pyx_f[0], 856);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[5] = {0,0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":826
+    /* "csamtools.pyx":857
  * 
  *     def count( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -9065,7 +8965,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":827
+    /* "csamtools.pyx":858
  *     def count( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -9074,7 +8974,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":828
+    /* "csamtools.pyx":859
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -9083,7 +8983,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":829
+    /* "csamtools.pyx":860
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -9091,7 +8991,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  *         '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
  */
     values[3] = ((PyObject *)Py_None);
-    values[4] = __pyx_k_39;
+    values[4] = __pyx_k_62;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
       case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
@@ -9129,7 +9029,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_reference = values[0];
     __pyx_v_start = values[1];
@@ -9138,7 +9038,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
     __pyx_v_until_eof = values[4];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":826
+    /* "csamtools.pyx":857
  * 
  *     def count( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -9147,7 +9047,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":827
+    /* "csamtools.pyx":858
  *     def count( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -9156,7 +9056,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":828
+    /* "csamtools.pyx":859
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -9165,7 +9065,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":829
+    /* "csamtools.pyx":860
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -9173,7 +9073,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  *         '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
  */
     __pyx_v_region = ((PyObject *)Py_None);
-    __pyx_v_until_eof = __pyx_k_39;
+    __pyx_v_until_eof = __pyx_k_62;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  5: __pyx_v_until_eof = PyTuple_GET_ITEM(__pyx_args, 4);
       case  4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
@@ -9186,7 +9086,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("count", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("count", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile.count");
   __Pyx_RefNannyFinishContext();
@@ -9194,120 +9094,114 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
   __pyx_L4_argument_unpacking_done:;
   __Pyx_INCREF(__pyx_v_region);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":843
+  /* "csamtools.pyx":874
  *         cdef int rend
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":844
+    /* "csamtools.pyx":875
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":846
+  /* "csamtools.pyx":877
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
  *         cdef int counter
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
   __Pyx_INCREF(__pyx_v_start);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_start);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
   __Pyx_GIVEREF(__pyx_v_start);
   __Pyx_INCREF(__pyx_v_end);
-  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
   __Pyx_GIVEREF(__pyx_v_end);
   __Pyx_INCREF(__pyx_v_region);
-  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_region);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
   __Pyx_GIVEREF(__pyx_v_region);
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
     PyObject* tuple = __pyx_t_5;
-    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
-    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
-    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
-    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_v_region);
-    __pyx_v_region = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_region = __pyx_t_1;
+    __pyx_t_1 = 0;
     __pyx_v_rtid = __pyx_t_8;
     __pyx_v_rstart = __pyx_t_9;
     __pyx_v_rend = __pyx_t_10;
   } else {
-    __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_11, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_11, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_11, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_11, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__Pyx_EndUnpack(__pyx_t_11, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_11, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     __Pyx_DECREF(__pyx_v_region);
-    __pyx_v_region = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_region = __pyx_t_1;
+    __pyx_t_1 = 0;
     __pyx_v_rtid = __pyx_t_10;
     __pyx_v_rstart = __pyx_t_9;
     __pyx_v_rend = __pyx_t_8;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":849
+  /* "csamtools.pyx":880
  * 
  *         cdef int counter
  *         counter = 0;             # <<<<<<<<<<<<<<
@@ -9316,7 +9210,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
   __pyx_v_counter = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":851
+  /* "csamtools.pyx":882
  *         counter = 0;
  * 
  *         if self.isbam:             # <<<<<<<<<<<<<<
@@ -9325,22 +9219,22 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
   if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":852
+    /* "csamtools.pyx":883
  * 
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "fetch called on bamfile without index" )
  * 
  */
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_12 = (!__pyx_t_4);
       if (__pyx_t_12) {
@@ -9355,93 +9249,75 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
     }
     if (__pyx_t_12) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":853
+      /* "csamtools.pyx":884
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
  * 
  *             if not region:
  */
-      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
-      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_30));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_7, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":855
+    /* "csamtools.pyx":886
  *                 raise ValueError( "fetch called on bamfile without index" )
  * 
  *             if not region:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "counting functionality requires a region/reference" )
  *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )
  */
-    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = (!__pyx_t_12);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":856
+      /* "csamtools.pyx":887
  * 
  *             if not region:
  *                 raise ValueError( "counting functionality requires a region/reference" )             # <<<<<<<<<<<<<<
  *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )
  *             bam_fetch(self.samfile.x.bam,
  */
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
-      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_40));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
-      __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_Raise(__pyx_t_7, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":857
+    /* "csamtools.pyx":888
  *             if not region:
  *                 raise ValueError( "counting functionality requires a region/reference" )
  *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
  *             bam_fetch(self.samfile.x.bam,
  *                              self.index,
  */
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_12 = (!__pyx_t_3);
     if (__pyx_t_12) {
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
-      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_32));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
-      __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_Raise(__pyx_t_5, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_Raise(__pyx_t_7, 0, 0);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L10;
     }
     __pyx_L10:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":864
+    /* "csamtools.pyx":895
  *                              rend,
  *                              <void*>&counter,
  *                              count_callback )             # <<<<<<<<<<<<<<
@@ -9450,7 +9326,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  */
     bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)(&__pyx_v_counter)), __pyx_f_9csamtools_count_callback);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":865
+    /* "csamtools.pyx":896
  *                              <void*>&counter,
  *                              count_callback )
  *             return counter             # <<<<<<<<<<<<<<
@@ -9458,33 +9334,27 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  *             raise ValueError ("count for a region is not available for sam files" )
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_7 = PyInt_FromLong(__pyx_v_counter); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_r = __pyx_t_7;
-    __pyx_t_7 = 0;
+    __pyx_t_5 = PyInt_FromLong(__pyx_v_counter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_r = __pyx_t_5;
+    __pyx_t_5 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":867
+    /* "csamtools.pyx":898
  *             return counter
  *         else:
  *             raise ValueError ("count for a region is not available for sam files" )             # <<<<<<<<<<<<<<
  * 
  *     def pileup( self,
  */
-    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
-    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_41));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_Raise(__pyx_t_5, 0, 0);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L7:;
 
@@ -9507,7 +9377,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":869
+/* "csamtools.pyx":900
  *             raise ValueError ("count for a region is not available for sam files" )
  * 
  *     def pileup( self,             # <<<<<<<<<<<<<<
@@ -9515,9 +9385,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_count(PyObject *__pyx_v_self, PyOb
  *                 start = None,
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_pileup[] = "Samfile.pileup(self, reference=None, start=None, end=None, region=None, callback=None, **kwargs)\n\n        perform a :term:`pileup` within a :term:`region`. The region is specified by\n        :term:`reference`, *start* and *end* (using 0-based indexing). \n        Alternatively, a samtools *region* string can be supplied.\n\n        Without *reference* or *region* all reads will be used for the pileup. The reads will be returned\n        ordered by :term:`reference` sequence, which will not necessarily be the order within the file.\n\n        The method returns an iterator of type :class:`pysam.IteratorColumn` unless\n        a *callback is provided. If a *callback* is given, the callback will be executed \n        for each column within the :term:`region`. \n\n        Note that :term:`SAM` formatted files do not allow random access. \n        In these files, if a *region* or *reference* are given an exception is raised.\n        \n        Optional *kwargs* to the iterator:\n\n        stepper\n           The stepper controlls how the iterator advances. \n           Possible options for the stepper are \n       \n           ``all``\n              use all reads for pileup.\n           ``samtools``\n              same filter and read processing as in :term:`csamtools` pileup\n\n        fastafile\n           A :class:`FastaFile` object\n\n         mask\n           Skip all reads with bits set in mask.\n\n\n        .. note::\n\n            *all* reads which overlap the region are returned. The first base returned will be the \n            first base of the first read *not* necessarily the first base of the region used in the query.\n\n            The maximum number of reads considered for pileup is *8000*. This limit is set by\n            :term:`csamtools`.\n\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_13pileup[] = "Samfile.pileup(self, reference=None, start=None, end=None, region=None, callback=None, **kwargs)\n\n        perform a :term:`pileup` within a :term:`region`. The region is specified by\n        :term:`reference`, *start* and *end* (using 0-based indexing). \n        Alternatively, a samtools *region* string can be supplied.\n\n        Without *reference* or *region* all reads will be used for the pileup. The reads will be returned\n        ordered by :term:`reference` sequence, which will not necessarily be the order within the file.\n\n        The method returns an iterator of type :class:`pysam.IteratorColumn` unless\n        a *callback is provided. If a *callback* is given, the callback will be executed \n        for each column within the :term:`region`. \n\n        Note that :term:`SAM` formatted files do not allow random access. \n        In these files, if a *region* or *reference* are given an exception is raised.\n        \n        Optional *kwargs* to the iterator:\n\n        stepper\n           The stepper controlls how the iterator advances. \n           Possible options for the stepper are \n       \n           ``all``\n              use all reads for pileup.\n           ``samtools``\n              same filter and read processing as in :term:`csamtools` pileup\n\n        fastafile\n           A :class:`FastaFile` object\n\n         mask\n           Skip all reads with bits set in mask.\n\n         max_depth\n           Maximum read depth permitted. The default limit is *8000*.\n\n        .. note::\n\n            *all* reads which overlap the region are returned. The first base returned will be the \n            first base of the first read *not* necessarily the first base of the region used in the query.\n\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -9545,14 +9415,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("pileup");
-  __Pyx_TraceCall("pileup", __pyx_f[0], 869);
+  __Pyx_TraceCall("pileup", __pyx_f[0], 900);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
   __Pyx_GOTREF(__pyx_v_kwargs);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[5] = {0,0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":870
+    /* "csamtools.pyx":901
  * 
  *     def pileup( self,
  *                 reference = None,             # <<<<<<<<<<<<<<
@@ -9561,7 +9431,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":871
+    /* "csamtools.pyx":902
  *     def pileup( self,
  *                 reference = None,
  *                 start = None,             # <<<<<<<<<<<<<<
@@ -9570,7 +9440,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":872
+    /* "csamtools.pyx":903
  *                 reference = None,
  *                 start = None,
  *                 end = None,             # <<<<<<<<<<<<<<
@@ -9579,7 +9449,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":873
+    /* "csamtools.pyx":904
  *                 start = None,
  *                 end = None,
  *                 region = None,             # <<<<<<<<<<<<<<
@@ -9588,7 +9458,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":874
+    /* "csamtools.pyx":905
  *                 end = None,
  *                 region = None,
  *                 callback = None,             # <<<<<<<<<<<<<<
@@ -9633,7 +9503,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_reference = values[0];
     __pyx_v_start = values[1];
@@ -9642,7 +9512,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
     __pyx_v_callback = values[4];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":870
+    /* "csamtools.pyx":901
  * 
  *     def pileup( self,
  *                 reference = None,             # <<<<<<<<<<<<<<
@@ -9651,7 +9521,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":871
+    /* "csamtools.pyx":902
  *     def pileup( self,
  *                 reference = None,
  *                 start = None,             # <<<<<<<<<<<<<<
@@ -9660,7 +9530,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":872
+    /* "csamtools.pyx":903
  *                 reference = None,
  *                 start = None,
  *                 end = None,             # <<<<<<<<<<<<<<
@@ -9669,7 +9539,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":873
+    /* "csamtools.pyx":904
  *                 start = None,
  *                 end = None,
  *                 region = None,             # <<<<<<<<<<<<<<
@@ -9678,7 +9548,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
     __pyx_v_region = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":874
+    /* "csamtools.pyx":905
  *                 end = None,
  *                 region = None,
  *                 callback = None,             # <<<<<<<<<<<<<<
@@ -9698,7 +9568,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("pileup", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("pileup", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs);
   __Pyx_AddTraceback("csamtools.Samfile.pileup");
@@ -9706,85 +9576,79 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":921
+  /* "csamtools.pyx":951
  *         cdef bam_plbuf_t *buf
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":922
+    /* "csamtools.pyx":952
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":924
+  /* "csamtools.pyx":954
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
  *         if self.isbam:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
   __Pyx_INCREF(__pyx_v_start);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_start);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
   __Pyx_GIVEREF(__pyx_v_start);
   __Pyx_INCREF(__pyx_v_end);
-  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
   __Pyx_GIVEREF(__pyx_v_end);
   __Pyx_INCREF(__pyx_v_region);
-  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_region);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
   __Pyx_GIVEREF(__pyx_v_region);
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
     PyObject* tuple = __pyx_t_5;
-    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
-    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
-    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_v_has_coord = __pyx_t_8;
@@ -9792,26 +9656,26 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
     __pyx_v_rstart = __pyx_t_10;
     __pyx_v_rend = __pyx_t_11;
   } else {
-    __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     __pyx_v_has_coord = __pyx_t_11;
     __pyx_v_rtid = __pyx_t_10;
@@ -9819,7 +9683,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
     __pyx_v_rend = __pyx_t_8;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":926
+  /* "csamtools.pyx":956
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  * 
  *         if self.isbam:             # <<<<<<<<<<<<<<
@@ -9828,48 +9692,42 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
   if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":927
+    /* "csamtools.pyx":957
  * 
  *         if self.isbam:
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )             # <<<<<<<<<<<<<<
  * 
  *             if callback:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
-      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
-      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_42));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_7, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":929
+    /* "csamtools.pyx":959
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )
  * 
  *             if callback:             # <<<<<<<<<<<<<<
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  * 
  */
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":930
+      /* "csamtools.pyx":960
  * 
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -9878,22 +9736,16 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
       __pyx_t_3 = (!__pyx_v_has_coord);
       if (__pyx_t_3) {
-        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
-        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_31));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
-        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_Raise(__pyx_t_7, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L10;
       }
       __pyx_L10:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":932
+      /* "csamtools.pyx":962
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  * 
  *                 buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )             # <<<<<<<<<<<<<<
@@ -9902,7 +9754,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
       __pyx_v_buf = bam_plbuf_init(((bam_pileup_f)__pyx_f_9csamtools_pileup_callback), ((void *)__pyx_v_callback));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":935
+      /* "csamtools.pyx":965
  *                 bam_fetch(self.samfile.x.bam,
  *                           self.index, rtid, rstart, rend,
  *                           buf, pileup_fetch_callback )             # <<<<<<<<<<<<<<
@@ -9911,7 +9763,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
       bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, __pyx_v_buf, __pyx_f_9csamtools_pileup_fetch_callback);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":938
+      /* "csamtools.pyx":968
  * 
  *                 # finalize pileup
  *                 bam_plbuf_push( NULL, buf)             # <<<<<<<<<<<<<<
@@ -9920,7 +9772,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
       bam_plbuf_push(NULL, __pyx_v_buf);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":939
+      /* "csamtools.pyx":969
  *                 # finalize pileup
  *                 bam_plbuf_push( NULL, buf)
  *                 bam_plbuf_destroy(buf)             # <<<<<<<<<<<<<<
@@ -9932,7 +9784,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":941
+      /* "csamtools.pyx":971
  *                 bam_plbuf_destroy(buf)
  *             else:
  *                 if has_coord:             # <<<<<<<<<<<<<<
@@ -9941,7 +9793,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  */
       if (__pyx_v_has_coord) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":942
+        /* "csamtools.pyx":972
  *             else:
  *                 if has_coord:
  *                     return IteratorColumnRegion( self,             # <<<<<<<<<<<<<<
@@ -9949,61 +9801,61 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  *                                                  start = rstart,
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_self);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
         __Pyx_GIVEREF(__pyx_v_self);
-        __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":943
+        /* "csamtools.pyx":973
  *                 if has_coord:
  *                     return IteratorColumnRegion( self,
  *                                                  tid = rtid,             # <<<<<<<<<<<<<<
  *                                                  start = rstart,
  *                                                  end = rend,
  */
-        __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":944
+        /* "csamtools.pyx":974
  *                     return IteratorColumnRegion( self,
  *                                                  tid = rtid,
  *                                                  start = rstart,             # <<<<<<<<<<<<<<
  *                                                  end = rend,
  *                                                  **kwargs )
  */
-        __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":945
+        /* "csamtools.pyx":975
  *                                                  tid = rtid,
  *                                                  start = rstart,
  *                                                  end = rend,             # <<<<<<<<<<<<<<
  *                                                  **kwargs )
  *                 else:
  */
-        __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":946
+        /* "csamtools.pyx":976
  *                                                  start = rstart,
  *                                                  end = rend,
  *                                                  **kwargs )             # <<<<<<<<<<<<<<
  *                 else:
  *                     return IteratorColumnAllRefs(self, **kwargs )
  */
-        if (PyDict_Update(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_kwargs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_6 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnRegion)), __pyx_t_7, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (PyDict_Update(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_kwargs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnRegion)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
         __pyx_r = __pyx_t_6;
         __pyx_t_6 = 0;
@@ -10012,7 +9864,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":948
+        /* "csamtools.pyx":978
  *                                                  **kwargs )
  *                 else:
  *                     return IteratorColumnAllRefs(self, **kwargs )             # <<<<<<<<<<<<<<
@@ -10020,14 +9872,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  *         else:
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         __Pyx_INCREF(__pyx_v_self);
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
         __Pyx_GIVEREF(__pyx_v_self);
-        __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), __pyx_t_6, ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
         goto __pyx_L0;
@@ -10039,24 +9891,18 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":951
+    /* "csamtools.pyx":981
  * 
  *         else:
  *             raise NotImplementedError( "pileup of samfiles not implemented yet" )             # <<<<<<<<<<<<<<
  * 
  *     def close( self ):
  */
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_43));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_Raise(__pyx_t_5, 0, 0);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_Raise(__pyx_t_6, 0, 0);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L7:;
 
@@ -10079,7 +9925,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":953
+/* "csamtools.pyx":983
  *             raise NotImplementedError( "pileup of samfiles not implemented yet" )
  * 
  *     def close( self ):             # <<<<<<<<<<<<<<
@@ -10087,16 +9933,16 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_pileup(PyObject *__pyx_v_self, PyO
  *         closes the :class:`pysam.Samfile`.'''
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_close[] = "Samfile.close(self)\n\n        closes the :class:`pysam.Samfile`.";
-static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_14close[] = "Samfile.close(self)\n\n        closes the :class:`pysam.Samfile`.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("close");
-  __Pyx_TraceCall("close", __pyx_f[0], 953);
+  __Pyx_TraceCall("close", __pyx_f[0], 983);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":956
+  /* "csamtools.pyx":986
  *         '''
  *         closes the :class:`pysam.Samfile`.'''
  *         if self.samfile != NULL:             # <<<<<<<<<<<<<<
@@ -10106,7 +9952,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTH
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":957
+    /* "csamtools.pyx":987
  *         closes the :class:`pysam.Samfile`.'''
  *         if self.samfile != NULL:
  *             samclose( self.samfile )             # <<<<<<<<<<<<<<
@@ -10115,7 +9961,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTH
  */
     samclose(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":958
+    /* "csamtools.pyx":988
  *         if self.samfile != NULL:
  *             samclose( self.samfile )
  *             bam_index_destroy(self.index);             # <<<<<<<<<<<<<<
@@ -10124,7 +9970,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTH
  */
     bam_index_destroy(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":959
+    /* "csamtools.pyx":989
  *             samclose( self.samfile )
  *             bam_index_destroy(self.index);
  *             self.samfile = NULL             # <<<<<<<<<<<<<<
@@ -10143,7 +9989,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTH
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":961
+/* "csamtools.pyx":991
  *             self.samfile = NULL
  * 
  *     def __dealloc__( self ):             # <<<<<<<<<<<<<<
@@ -10151,30 +9997,30 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_close(PyObject *__pyx_v_self, CYTH
  *         # note: no doc string
  */
 
-static void __pyx_pf_9csamtools_7Samfile___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_7Samfile___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self) {
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 961);
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 991);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":965
+  /* "csamtools.pyx":995
  *         # note: no doc string
  *         # note: __del__ is not called.
  *         self.close()             # <<<<<<<<<<<<<<
  *         bam_destroy1(self.b)
  *         if self._filename != NULL: free( self._filename )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":966
+  /* "csamtools.pyx":996
  *         # note: __del__ is not called.
  *         self.close()
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
@@ -10183,7 +10029,7 @@ static void __pyx_pf_9csamtools_7Samfile___dealloc__(PyObject *__pyx_v_self) {
  */
   bam_destroy1(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":967
+  /* "csamtools.pyx":997
  *         self.close()
  *         bam_destroy1(self.b)
  *         if self._filename != NULL: free( self._filename )             # <<<<<<<<<<<<<<
@@ -10207,7 +10053,7 @@ static void __pyx_pf_9csamtools_7Samfile___dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":969
+/* "csamtools.pyx":999
  *         if self._filename != NULL: free( self._filename )
  * 
  *     cpdef int write( self, AlignedRead read ) except -1:             # <<<<<<<<<<<<<<
@@ -10215,7 +10061,7 @@ static void __pyx_pf_9csamtools_7Samfile___dealloc__(PyObject *__pyx_v_self) {
  *         write a single :class:`pysam.AlignedRead` to disk.
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
 static  int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read, int __pyx_skip_dispatch) {
   int __pyx_r;
   PyObject *__pyx_t_1 = NULL;
@@ -10226,23 +10072,23 @@ static  int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfil
   int __pyx_t_6;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("write");
-  __Pyx_TraceCall("write", __pyx_f[0], 969);
+  __Pyx_TraceCall("write", __pyx_f[0], 999);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
   /* Check if overriden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9csamtools_7Samfile_write)) {
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9csamtools_7Samfile_16write)) {
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(((PyObject *)__pyx_v_read));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_read));
       __Pyx_GIVEREF(((PyObject *)__pyx_v_read));
-      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __pyx_r = __pyx_t_4;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -10251,24 +10097,24 @@ static  int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfil
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":975
+  /* "csamtools.pyx":1005
  *         returns the number of bytes written.
  *         '''
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             return 0
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_6 = (!__pyx_t_5);
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":976
+    /* "csamtools.pyx":1006
  *         '''
  *         if not self._isOpen():
  *             return 0             # <<<<<<<<<<<<<<
@@ -10281,7 +10127,7 @@ static  int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfil
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":978
+  /* "csamtools.pyx":1008
  *             return 0
  * 
  *         return samwrite( self.samfile, read._delegate )             # <<<<<<<<<<<<<<
@@ -10305,7 +10151,7 @@ static  int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfil
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":969
+/* "csamtools.pyx":999
  *         if self._filename != NULL: free( self._filename )
  * 
  *     cpdef int write( self, AlignedRead read ) except -1:             # <<<<<<<<<<<<<<
@@ -10313,17 +10159,17 @@ static  int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfil
  *         write a single :class:`pysam.AlignedRead` to disk.
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_write[] = "Samfile.write(self, AlignedRead read) -> int\n\n        write a single :class:`pysam.AlignedRead` to disk.\n\n        returns the number of bytes written.\n        ";
-static PyObject *__pyx_pf_9csamtools_7Samfile_write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_16write[] = "Samfile.write(self, AlignedRead read) -> int\n\n        write a single :class:`pysam.AlignedRead` to disk.\n\n        returns the number of bytes written.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("write");
-  __Pyx_TraceCall("write", __pyx_f[0], 969);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("write", __pyx_f[0], 999);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -10342,7 +10188,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_write(PyObject *__pyx_v_self, PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":980
+/* "csamtools.pyx":1010
  *         return samwrite( self.samfile, read._delegate )
  * 
  *     def __enter__(self):             # <<<<<<<<<<<<<<
@@ -10350,15 +10196,15 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_write(PyObject *__pyx_v_self, PyOb
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile___enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile___enter__[] = "Samfile.__enter__(self)";
-static PyObject *__pyx_pf_9csamtools_7Samfile___enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_17__enter__[] = "Samfile.__enter__(self)";
+static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__enter__");
-  __Pyx_TraceCall("__enter__", __pyx_f[0], 980);
+  __Pyx_TraceCall("__enter__", __pyx_f[0], 1010);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":981
+  /* "csamtools.pyx":1011
  * 
  *     def __enter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -10378,7 +10224,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___enter__(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":983
+/* "csamtools.pyx":1013
  *         return self
  * 
  *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
@@ -10386,9 +10232,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___enter__(PyObject *__pyx_v_self,
  *         return False
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile___exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
-static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_18__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
+static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_exc_type = 0;
   PyObject *__pyx_v_exc_value = 0;
   PyObject *__pyx_v_traceback = 0;
@@ -10398,7 +10244,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, P
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__exit__");
-  __Pyx_TraceCall("__exit__", __pyx_f[0], 983);
+  __Pyx_TraceCall("__exit__", __pyx_f[0], 1013);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
@@ -10418,17 +10264,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, P
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_value);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__traceback);
       if (likely(values[2])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_exc_type = values[0];
     __pyx_v_exc_value = values[1];
@@ -10442,28 +10288,28 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, P
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile.__exit__");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":984
+  /* "csamtools.pyx":1014
  * 
  *     def __exit__(self, exc_type, exc_value, traceback):
  *         self.close()             # <<<<<<<<<<<<<<
  *         return False
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":985
+  /* "csamtools.pyx":1015
  *     def __exit__(self, exc_type, exc_value, traceback):
  *         self.close()
  *         return False             # <<<<<<<<<<<<<<
@@ -10471,7 +10317,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, P
  *     ###############################################################
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -10491,7 +10337,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___exit__(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":994
+/* "csamtools.pyx":1024
  *     property filename:
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -10508,40 +10354,34 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_
   int __pyx_t_4;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 994);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1024);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":995
+  /* "csamtools.pyx":1025
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             return self._filename
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":996
+  /* "csamtools.pyx":1026
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self._filename             # <<<<<<<<<<<<<<
@@ -10549,10 +10389,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_
  *     property nreferences:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_r = ((PyObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
+  __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10569,7 +10409,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1000
+/* "csamtools.pyx":1030
  *     property nreferences:
  *         '''number of :term:`reference` sequences in the file.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -10586,40 +10426,34 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__
   int __pyx_t_4;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1000);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1030);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1001
+  /* "csamtools.pyx":1031
  *         '''number of :term:`reference` sequences in the file.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             return self.samfile.header.n_targets
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1002
+  /* "csamtools.pyx":1032
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self.samfile.header.n_targets             # <<<<<<<<<<<<<<
@@ -10627,10 +10461,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__
  *     property references:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10647,7 +10481,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1006
+/* "csamtools.pyx":1036
  *     property references:
  *         """tuple with the names of :term:`reference` sequences."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -10668,54 +10502,48 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__p
   int __pyx_t_6;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1006);
-  __pyx_v_t = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1036);
+  __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1007
+  /* "csamtools.pyx":1037
  *         """tuple with the names of :term:`reference` sequences."""
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1008
+  /* "csamtools.pyx":1038
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []             # <<<<<<<<<<<<<<
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_name[x] )
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_v_t));
-  __pyx_v_t = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_t = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1009
+  /* "csamtools.pyx":1039
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
@@ -10725,7 +10553,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__p
   __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1010
+    /* "csamtools.pyx":1040
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_name[x] )             # <<<<<<<<<<<<<<
@@ -10733,15 +10561,15 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__p
  * 
  */
     if (unlikely(__pyx_v_t == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_t), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_6 = PyList_Append(__pyx_v_t, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1011
+  /* "csamtools.pyx":1041
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_name[x] )
  *             return tuple(t)             # <<<<<<<<<<<<<<
@@ -10750,12 +10578,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__p
  */
   __Pyx_XDECREF(__pyx_r);
   if (unlikely(__pyx_v_t == Py_None)) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
-  __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_r = ((PyObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
+  __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10773,7 +10601,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1017
+/* "csamtools.pyx":1047
  *         :attr:`pysam.Samfile.references`
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -10794,54 +10622,48 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v
   int __pyx_t_6;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1017);
-  __pyx_v_t = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1047);
+  __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1018
+  /* "csamtools.pyx":1048
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1019
+  /* "csamtools.pyx":1049
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []             # <<<<<<<<<<<<<<
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_len[x] )
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_v_t));
-  __pyx_v_t = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_t = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1020
+  /* "csamtools.pyx":1050
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
@@ -10851,7 +10673,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v
   __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1021
+    /* "csamtools.pyx":1051
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_len[x] )             # <<<<<<<<<<<<<<
@@ -10859,29 +10681,29 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v
  * 
  */
     if (unlikely(__pyx_v_t == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_t), __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1022
+  /* "csamtools.pyx":1052
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_len[x] )
  *             return tuple(t)             # <<<<<<<<<<<<<<
  * 
- *     property text:
+ *     property mapped:
  */
   __Pyx_XDECREF(__pyx_r);
   if (unlikely(__pyx_v_t == Py_None)) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
-  __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_r = ((PyObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
+  __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10899,76 +10721,323 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1026
- *     property text:
- *         '''full contents of the :term:`sam file` header as a string.'''
+/* "csamtools.pyx":1057
+ *         """total number of mapped reads in file.
+ *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
- *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
+ *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self) {
+  int __pyx_v_tid;
+  uint32_t __pyx_v_total;
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
   int __pyx_t_4;
+  int32_t __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1026);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1057);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1027
- *         '''full contents of the :term:`sam file` header as a string.'''
+  /* "csamtools.pyx":1058
+ *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
- *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
+ *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1028
+  /* "csamtools.pyx":1059
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
- *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)             # <<<<<<<<<<<<<<
+ *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )             # <<<<<<<<<<<<<<
  * 
- *     property header:
+ *             cdef int tid
  */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyString_FromStringAndSize(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->l_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
+  if (__pyx_t_4) {
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("csamtools.Samfile.text.__get__");
+  /* "csamtools.pyx":1062
+ * 
+ *             cdef int tid
+ *             cdef uint32_t total = 0             # <<<<<<<<<<<<<<
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:
+ *                 total += pysam_get_mapped( self.index, tid )
+ */
+  __pyx_v_total = 0;
+
+  /* "csamtools.pyx":1063
+ *             cdef int tid
+ *             cdef uint32_t total = 0
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
+ *                 total += pysam_get_mapped( self.index, tid )
+ *             return total
+ */
+  __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
+  for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
+
+    /* "csamtools.pyx":1064
+ *             cdef uint32_t total = 0
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:
+ *                 total += pysam_get_mapped( self.index, tid )             # <<<<<<<<<<<<<<
+ *             return total
+ * 
+ */
+    __pyx_v_total = (__pyx_v_total + pysam_get_mapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid));
+  }
+
+  /* "csamtools.pyx":1065
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:
+ *                 total += pysam_get_mapped( self.index, tid )
+ *             return total             # <<<<<<<<<<<<<<
+ * 
+ *     property unmapped:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.Samfile.mapped.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":1070
+ *         """total number of unmapped reads in file.
+ *         """
+ *         def __get__(self):             # <<<<<<<<<<<<<<
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self) {
+  int __pyx_v_tid;
+  uint32_t __pyx_v_total;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  int32_t __pyx_t_5;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__get__");
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1070);
+
+  /* "csamtools.pyx":1071
+ *         """
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
+ *             cdef int tid
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_4 = (!__pyx_t_3);
+  if (__pyx_t_4) {
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "csamtools.pyx":1072
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )             # <<<<<<<<<<<<<<
+ *             cdef int tid
+ *             cdef uint32_t total = 0
+ */
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
+  if (__pyx_t_4) {
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "csamtools.pyx":1074
+ *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
+ *             cdef int tid
+ *             cdef uint32_t total = 0             # <<<<<<<<<<<<<<
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:
+ *                 total += pysam_get_unmapped( self.index, tid )
+ */
+  __pyx_v_total = 0;
+
+  /* "csamtools.pyx":1075
+ *             cdef int tid
+ *             cdef uint32_t total = 0
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
+ *                 total += pysam_get_unmapped( self.index, tid )
+ *             # get unmapped reads without coordinates
+ */
+  __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
+  for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
+
+    /* "csamtools.pyx":1076
+ *             cdef uint32_t total = 0
+ *             for tid from 0 <= tid < self.samfile.header.n_targets:
+ *                 total += pysam_get_unmapped( self.index, tid )             # <<<<<<<<<<<<<<
+ *             # get unmapped reads without coordinates
+ *             total += pysam_get_unmapped( self.index, -1 )
+ */
+    __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid));
+  }
+
+  /* "csamtools.pyx":1078
+ *                 total += pysam_get_unmapped( self.index, tid )
+ *             # get unmapped reads without coordinates
+ *             total += pysam_get_unmapped( self.index, -1 )             # <<<<<<<<<<<<<<
+ *             return total
+ * 
+ */
+  __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, -1));
+
+  /* "csamtools.pyx":1079
+ *             # get unmapped reads without coordinates
+ *             total += pysam_get_unmapped( self.index, -1 )
+ *             return total             # <<<<<<<<<<<<<<
+ * 
+ *     property text:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.Samfile.unmapped.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":1083
+ *     property text:
+ *         '''full contents of the :term:`sam file` header as a string.'''
+ *         def __get__(self):             # <<<<<<<<<<<<<<
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__get__");
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1083);
+
+  /* "csamtools.pyx":1084
+ *         '''full contents of the :term:`sam file` header as a string.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
+ * 
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_4 = (!__pyx_t_3);
+  if (__pyx_t_4) {
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "csamtools.pyx":1085
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)             # <<<<<<<<<<<<<<
+ * 
+ *     property header:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_2 = PyString_FromStringAndSize(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->l_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.Samfile.text.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -10977,7 +11046,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1034
+/* "csamtools.pyx":1091
  *         a two-level dictionary.
  *         '''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -11009,62 +11078,56 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
   PyObject *__pyx_t_10 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1034);
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1091);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_line = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_fields = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_record = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_x = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_x = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_field = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1035
+  /* "csamtools.pyx":1092
  *         '''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *             result = {}
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1037
+  /* "csamtools.pyx":1094
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  * 
  *             result = {}             # <<<<<<<<<<<<<<
  * 
  *             if self.samfile.header.text != NULL:
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_v_result));
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_result = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1039
+  /* "csamtools.pyx":1096
  *             result = {}
  * 
  *             if self.samfile.header.text != NULL:             # <<<<<<<<<<<<<<
@@ -11074,77 +11137,71 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
   __pyx_t_4 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text != NULL);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1041
+    /* "csamtools.pyx":1098
  *             if self.samfile.header.text != NULL:
  *                 # convert to python string (note: call self.text to create 0-terminated string)
  *                 t = self.text             # <<<<<<<<<<<<<<
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_t);
-    __pyx_v_t = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __pyx_v_t = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1042
+    /* "csamtools.pyx":1099
  *                 # convert to python string (note: call self.text to create 0-terminated string)
  *                 t = self.text
  *                 for line in t.split("\n"):             # <<<<<<<<<<<<<<
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_t, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_t, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-    __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
-      __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2);
+    if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+      __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
     } else {
-      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
     }
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     for (;;) {
       if (likely(PyList_CheckExact(__pyx_t_2))) {
         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
       } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++;
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
       } else {
-        __pyx_t_6 = PyIter_Next(__pyx_t_2);
-        if (!__pyx_t_6) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyIter_Next(__pyx_t_2);
+        if (!__pyx_t_1) {
+          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(__pyx_t_1);
       }
       __Pyx_DECREF(__pyx_v_line);
-      __pyx_v_line = __pyx_t_6;
-      __pyx_t_6 = 0;
+      __pyx_v_line = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1043
+      /* "csamtools.pyx":1100
  *                 t = self.text
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue             # <<<<<<<<<<<<<<
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  *                     fields = line[1:].split("\t")
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __pyx_t_3 = (!__pyx_t_4);
       if (__pyx_t_3) {
         goto __pyx_L7_continue;
@@ -11152,167 +11209,154 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
       }
       __pyx_L9:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1044
+      /* "csamtools.pyx":1101
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line             # <<<<<<<<<<<<<<
  *                     fields = line[1:].split("\t")
  *                     record = fields[0]
  */
-      #ifndef PYREX_WITHOUT_ASSERTIONS
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #ifndef CYTHON_WITHOUT_ASSERTIONS
+      __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
-      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_44));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
-      __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (unlikely(!__pyx_t_3)) {
-        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), __pyx_v_line); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_7));
-        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_91), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       #endif
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1045
+      /* "csamtools.pyx":1102
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  *                     fields = line[1:].split("\t")             # <<<<<<<<<<<<<<
  *                     record = fields[0]
  *                     assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
  */
-      __pyx_t_7 = PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
-      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_1));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
-      __pyx_t_1 = PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_v_fields);
       __pyx_v_fields = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1046
+      /* "csamtools.pyx":1103
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  *                     fields = line[1:].split("\t")
  *                     record = fields[0]             # <<<<<<<<<<<<<<
  *                     assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
  * 
  */
-      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_v_record);
       __pyx_v_record = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1047
+      /* "csamtools.pyx":1104
  *                     fields = line[1:].split("\t")
  *                     record = fields[0]
  *                     assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)             # <<<<<<<<<<<<<<
  * 
  *                     # treat comments
  */
-      #ifndef PYREX_WITHOUT_ASSERTIONS
-      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #ifndef CYTHON_WITHOUT_ASSERTIONS
+      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (unlikely(!__pyx_t_3)) {
-        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_7));
-        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_93), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+        PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_6));
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       #endif
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1050
+      /* "csamtools.pyx":1107
  * 
  *                     # treat comments
  *                     if record == "CO":             # <<<<<<<<<<<<<<
  *                         if record not in result: result[record] = []
  *                         result[record].append( "\t".join( fields[1:] ) )
  */
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_6 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       if (__pyx_t_3) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1051
+        /* "csamtools.pyx":1108
  *                     # treat comments
  *                     if record == "CO":
  *                         if record not in result: result[record] = []             # <<<<<<<<<<<<<<
  *                         result[record].append( "\t".join( fields[1:] ) )
  *                         continue
  */
-        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
-          __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        } else {
-          __pyx_t_3 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(__pyx_v_result == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
+        __pyx_t_3 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_3) {
-          __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-          if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+          __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+          if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
           goto __pyx_L11;
         }
         __pyx_L11:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1052
+        /* "csamtools.pyx":1109
  *                     if record == "CO":
  *                         if record not in result: result[record] = []
  *                         result[record].append( "\t".join( fields[1:] ) )             # <<<<<<<<<<<<<<
  *                         continue
  * 
  */
-        __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_6 = PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
-        __Pyx_GIVEREF(__pyx_t_6);
-        __pyx_t_6 = 0;
-        __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
+        __Pyx_GIVEREF(__pyx_t_7);
+        __pyx_t_7 = 0;
+        __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1053
+        /* "csamtools.pyx":1110
  *                         if record not in result: result[record] = []
  *                         result[record].append( "\t".join( fields[1:] ) )
  *                         continue             # <<<<<<<<<<<<<<
@@ -11324,46 +11368,46 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
       }
       __pyx_L10:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1056
+      /* "csamtools.pyx":1113
  * 
  *                     # the following is clumsy as generators do not work?
  *                     x = {}             # <<<<<<<<<<<<<<
  *                     for field in fields[1:]:
  *                         key, value = field.split(":",1)
  */
-      __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(((PyObject *)__pyx_v_x));
       __pyx_v_x = __pyx_t_8;
       __pyx_t_8 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1057
+      /* "csamtools.pyx":1114
  *                     # the following is clumsy as generators do not work?
  *                     x = {}
  *                     for field in fields[1:]:             # <<<<<<<<<<<<<<
  *                         key, value = field.split(":",1)
  *                         # uppercase keys must be valid
  */
-      __pyx_t_8 = PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
       if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
-        __pyx_t_9 = 0; __pyx_t_6 = __pyx_t_8; __Pyx_INCREF(__pyx_t_6);
+        __pyx_t_9 = 0; __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7);
       } else {
-        __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
       }
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       for (;;) {
-        if (likely(PyList_CheckExact(__pyx_t_6))) {
-          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
-          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
-        } else if (likely(PyTuple_CheckExact(__pyx_t_6))) {
-          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
+        if (likely(PyList_CheckExact(__pyx_t_7))) {
+          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
+          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
+        } else if (likely(PyTuple_CheckExact(__pyx_t_7))) {
+          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
+          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
         } else {
-          __pyx_t_8 = PyIter_Next(__pyx_t_6);
+          __pyx_t_8 = PyIter_Next(__pyx_t_7);
           if (!__pyx_t_8) {
-            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             break;
           }
           __Pyx_GOTREF(__pyx_t_8);
@@ -11372,285 +11416,274 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
         __pyx_v_field = __pyx_t_8;
         __pyx_t_8 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1058
+        /* "csamtools.pyx":1115
  *                     x = {}
  *                     for field in fields[1:]:
  *                         key, value = field.split(":",1)             # <<<<<<<<<<<<<<
  *                         # uppercase keys must be valid
  *                         # lowercase are permitted for user fields
  */
-        __pyx_t_8 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_47));
-        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_47));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_47));
-        __Pyx_INCREF(__pyx_int_1);
-        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_1);
-        __Pyx_GIVEREF(__pyx_int_1);
-        __pyx_t_1 = PyObject_Call(__pyx_t_8, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
-          PyObject* tuple = __pyx_t_1;
-          __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
-          __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
+          PyObject* tuple = __pyx_t_6;
+          __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8);
+          __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __Pyx_DECREF(__pyx_v_key);
-          __pyx_v_key = __pyx_t_7;
-          __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_v_value);
-          __pyx_v_value = __pyx_t_8;
+          __pyx_v_key = __pyx_t_8;
           __pyx_t_8 = 0;
+          __Pyx_DECREF(__pyx_v_value);
+          __pyx_v_value = __pyx_t_1;
+          __pyx_t_1 = 0;
         } else {
-          __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
-          __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_8);
-          if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_1);
+          if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           __Pyx_DECREF(__pyx_v_key);
-          __pyx_v_key = __pyx_t_7;
-          __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_v_value);
-          __pyx_v_value = __pyx_t_8;
+          __pyx_v_key = __pyx_t_8;
           __pyx_t_8 = 0;
+          __Pyx_DECREF(__pyx_v_value);
+          __pyx_v_value = __pyx_t_1;
+          __pyx_t_1 = 0;
         }
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1061
+        /* "csamtools.pyx":1118
  *                         # uppercase keys must be valid
  *                         # lowercase are permitted for user fields
  *                         if key in VALID_HEADER_FIELDS[record]:             # <<<<<<<<<<<<<<
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)
  *                         elif not key.isupper():
  */
-        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_8 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_3 = ((PySequence_Contains(__pyx_t_8, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         if (__pyx_t_3) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1062
+          /* "csamtools.pyx":1119
  *                         # lowercase are permitted for user fields
  *                         if key in VALID_HEADER_FIELDS[record]:
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)             # <<<<<<<<<<<<<<
  *                         elif not key.isupper():
  *                             x[key] = value
  */
-          __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __pyx_t_1 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          __pyx_t_8 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
+          __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_6);
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_1);
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __Pyx_INCREF(__pyx_v_value);
-          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
+          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value);
           __Pyx_GIVEREF(__pyx_v_value);
-          __pyx_t_7 = PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+          if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
           goto __pyx_L14;
         }
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1063
+        /* "csamtools.pyx":1120
  *                         if key in VALID_HEADER_FIELDS[record]:
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)
  *                         elif not key.isupper():             # <<<<<<<<<<<<<<
  *                             x[key] = value
  *                         else:
  */
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __pyx_t_4 = (!__pyx_t_3);
         if (__pyx_t_4) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1064
+          /* "csamtools.pyx":1121
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)
  *                         elif not key.isupper():
  *                             x[key] = value             # <<<<<<<<<<<<<<
  *                         else:
  *                             raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
  */
-          if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           goto __pyx_L14;
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1066
+          /* "csamtools.pyx":1123
  *                             x[key] = value
  *                         else:
  *                             raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )             # <<<<<<<<<<<<<<
  * 
  *                     if VALID_HEADER_TYPES[record] == dict:
  */
-          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __Pyx_INCREF(__pyx_v_key);
-          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
+          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key);
           __Pyx_GIVEREF(__pyx_v_key);
           __Pyx_INCREF(__pyx_v_record);
-          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_record);
+          PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_record);
           __Pyx_GIVEREF(__pyx_v_record);
-          __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
-          PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_7));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
-          __pyx_t_7 = 0;
-          __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __Pyx_Raise(__pyx_t_7, 0, 0);
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_96), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+          PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_8));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+          __pyx_t_8 = 0;
+          __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
+          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+          __Pyx_Raise(__pyx_t_8, 0, 0);
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         __pyx_L14:;
       }
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1068
+      /* "csamtools.pyx":1125
  *                             raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
  * 
  *                     if VALID_HEADER_TYPES[record] == dict:             # <<<<<<<<<<<<<<
  *                         if record in result:
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  */
-      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_7 = PyObject_GetItem(__pyx_t_6, __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)((PyObject*)&PyDict_Type)), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       if (__pyx_t_4) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1069
+        /* "csamtools.pyx":1126
  * 
  *                     if VALID_HEADER_TYPES[record] == dict:
  *                         if record in result:             # <<<<<<<<<<<<<<
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x
  */
-        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
-          __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        } else {
-          __pyx_t_4 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(__pyx_v_result == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
+        __pyx_t_4 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_4) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1070
+          /* "csamtools.pyx":1127
  *                     if VALID_HEADER_TYPES[record] == dict:
  *                         if record in result:
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )             # <<<<<<<<<<<<<<
  *                         result[record] = x
  *                     elif VALID_HEADER_TYPES[record] == list:
  */
-          __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_v_record); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), __pyx_v_record); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+          PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+          __pyx_t_7 = 0;
+          __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
-          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
-          __pyx_t_6 = 0;
-          __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_6);
+          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+          __Pyx_Raise(__pyx_t_7, 0, 0);
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_Raise(__pyx_t_6, 0, 0);
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           goto __pyx_L16;
         }
         __pyx_L16:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1071
+        /* "csamtools.pyx":1128
  *                         if record in result:
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x             # <<<<<<<<<<<<<<
  *                     elif VALID_HEADER_TYPES[record] == list:
  *                         if record not in result: result[record] = []
  */
-        if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L15;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1072
+      /* "csamtools.pyx":1129
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x
  *                     elif VALID_HEADER_TYPES[record] == list:             # <<<<<<<<<<<<<<
  *                         if record not in result: result[record] = []
  *                         result[record].append( x )
  */
-      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_7 = PyObject_GetItem(__pyx_t_6, __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)((PyObject*)&PyList_Type)), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       if (__pyx_t_4) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1073
+        /* "csamtools.pyx":1130
  *                         result[record] = x
  *                     elif VALID_HEADER_TYPES[record] == list:
  *                         if record not in result: result[record] = []             # <<<<<<<<<<<<<<
  *                         result[record].append( x )
  * 
  */
-        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
-          __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        } else {
-          __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(__pyx_v_result == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
+        __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_4) {
-          __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-          if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+          __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+          if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
           goto __pyx_L17;
         }
         __pyx_L17:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1074
+        /* "csamtools.pyx":1131
  *                     elif VALID_HEADER_TYPES[record] == list:
  *                         if record not in result: result[record] = []
  *                         result[record].append( x )             # <<<<<<<<<<<<<<
  * 
  *             return result
  */
-        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_6, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_7, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L15;
       }
       __pyx_L15:;
@@ -11661,7 +11694,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1076
+  /* "csamtools.pyx":1133
  *                         result[record].append( x )
  * 
  *             return result             # <<<<<<<<<<<<<<
@@ -11700,7 +11733,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1078
+/* "csamtools.pyx":1135
  *             return result
  * 
  *     def _buildLine( self, fields, record ):             # <<<<<<<<<<<<<<
@@ -11708,9 +11741,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile__buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
-static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_19_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
+static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_fields = 0;
   PyObject *__pyx_v_record = 0;
   PyObject *__pyx_v_line;
@@ -11726,7 +11759,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_buildLine");
-  __Pyx_TraceCall("_buildLine", __pyx_f[0], 1078);
+  __Pyx_TraceCall("_buildLine", __pyx_f[0], 1135);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[2] = {0,0};
@@ -11745,11 +11778,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_fields = values[0];
     __pyx_v_record = values[1];
@@ -11761,25 +11794,25 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Samfile._buildLine");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_v_line = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_line = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1082
+  /* "csamtools.pyx":1139
  * 
  *         # TODO: add checking for field and sort order
  *         line = ["@%s" % record ]             # <<<<<<<<<<<<<<
  *         if record == "CO":
  *             line.append( fields )
  */
-  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), __pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_98), __pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
@@ -11788,20 +11821,20 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
   __pyx_v_line = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1083
+  /* "csamtools.pyx":1140
  *         # TODO: add checking for field and sort order
  *         line = ["@%s" % record ]
  *         if record == "CO":             # <<<<<<<<<<<<<<
  *             line.append( fields )
  *         else:
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1084
+    /* "csamtools.pyx":1141
  *         line = ["@%s" % record ]
  *         if record == "CO":
  *             line.append( fields )             # <<<<<<<<<<<<<<
@@ -11809,29 +11842,29 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
  *             # write fields of the specification
  */
     if (unlikely(__pyx_v_line == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_line), __pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyList_Append(__pyx_v_line, __pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1087
+    /* "csamtools.pyx":1144
  *         else:
  *             # write fields of the specification
  *             for key in VALID_HEADER_ORDER[record]:             # <<<<<<<<<<<<<<
  *                 if key in fields:
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  */
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
       __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
     } else {
-      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -11845,7 +11878,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
       } else {
         __pyx_t_1 = PyIter_Next(__pyx_t_2);
         if (!__pyx_t_1) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
         __Pyx_GOTREF(__pyx_t_1);
@@ -11854,17 +11887,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
       __pyx_v_key = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1088
+      /* "csamtools.pyx":1145
  *             # write fields of the specification
  *             for key in VALID_HEADER_ORDER[record]:
  *                 if key in fields:             # <<<<<<<<<<<<<<
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  *             # write user fields
  */
-      __pyx_t_3 = ((PySequence_Contains(__pyx_v_fields, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = ((PySequence_Contains(__pyx_v_fields, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_3) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1089
+        /* "csamtools.pyx":1146
  *             for key in VALID_HEADER_ORDER[record]:
  *                 if key in fields:
  *                     line.append( "%s:%s" % (key, str(fields[key])))             # <<<<<<<<<<<<<<
@@ -11872,30 +11905,30 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
  *             for key in fields:
  */
         if (unlikely(__pyx_v_line == Py_None)) {
-          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_1 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
         __Pyx_GIVEREF(__pyx_t_1);
         __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         __Pyx_INCREF(__pyx_v_key);
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key);
         __Pyx_GIVEREF(__pyx_v_key);
         PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
         __Pyx_GIVEREF(__pyx_t_1);
         __pyx_t_1 = 0;
-        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_line), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+        __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         goto __pyx_L9;
       }
@@ -11903,7 +11936,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1091
+    /* "csamtools.pyx":1148
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  *             # write user fields
  *             for key in fields:             # <<<<<<<<<<<<<<
@@ -11913,7 +11946,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
     if (PyList_CheckExact(__pyx_v_fields) || PyTuple_CheckExact(__pyx_v_fields)) {
       __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_2);
     } else {
-      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
     }
     for (;;) {
@@ -11926,7 +11959,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
       } else {
         __pyx_t_1 = PyIter_Next(__pyx_t_2);
         if (!__pyx_t_1) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
         __Pyx_GOTREF(__pyx_t_1);
@@ -11935,24 +11968,24 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
       __pyx_v_key = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1092
+      /* "csamtools.pyx":1149
  *             # write user fields
  *             for key in fields:
  *                 if not key.isupper():             # <<<<<<<<<<<<<<
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  * 
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __pyx_t_7 = (!__pyx_t_3);
       if (__pyx_t_7) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1093
+        /* "csamtools.pyx":1150
  *             for key in fields:
  *                 if not key.isupper():
  *                     line.append( "%s:%s" % (key, str(fields[key])))             # <<<<<<<<<<<<<<
@@ -11960,30 +11993,30 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
  *         return "\t".join( line )
  */
         if (unlikely(__pyx_v_line == Py_None)) {
-          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_6 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
         __pyx_t_6 = 0;
-        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_key);
         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
         __Pyx_GIVEREF(__pyx_v_key);
         PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
         __pyx_t_6 = 0;
-        __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_line), ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+        __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
         goto __pyx_L12;
       }
@@ -11993,7 +12026,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1095
+  /* "csamtools.pyx":1152
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  * 
  *         return "\t".join( line )             # <<<<<<<<<<<<<<
@@ -12001,17 +12034,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
  *     cdef bam_header_t * _buildHeader( self, new_header ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   __Pyx_INCREF(((PyObject *)__pyx_v_line));
   PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_line));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_line));
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -12033,7 +12066,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile__buildLine(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1097
+/* "csamtools.pyx":1154
  *         return "\t".join( line )
  * 
  *     cdef bam_header_t * _buildHeader( self, new_header ):             # <<<<<<<<<<<<<<
@@ -12069,31 +12102,31 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
   uint32_t __pyx_t_13;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_buildHeader");
-  __Pyx_TraceCall("_buildHeader", __pyx_f[0], 1097);
-  __pyx_v_lines = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("_buildHeader", __pyx_f[0], 1154);
+  __pyx_v_lines = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_record = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_ttype = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_fields = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_seqs = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_seqs = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_seqname = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_seqlen = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1103
+  /* "csamtools.pyx":1160
  *         '''
  * 
  *         lines = []             # <<<<<<<<<<<<<<
  * 
  *         # check if hash exists
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_lines));
   __pyx_v_lines = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1110
+  /* "csamtools.pyx":1167
  *         cdef bam_header_t * dest
  * 
  *         dest = bam_header_init()             # <<<<<<<<<<<<<<
@@ -12102,19 +12135,19 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  */
   __pyx_v_dest = bam_header_init();
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1112
+  /* "csamtools.pyx":1169
  *         dest = bam_header_init()
  * 
  *         for record in VALID_HEADERS:             # <<<<<<<<<<<<<<
  *             if record in new_header:
  *                 ttype = VALID_HEADER_TYPES[record]
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
     __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3);
   } else {
-    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -12128,7 +12161,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
     } else {
       __pyx_t_1 = PyIter_Next(__pyx_t_3);
       if (!__pyx_t_1) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
       __Pyx_GOTREF(__pyx_t_1);
@@ -12137,72 +12170,72 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
     __pyx_v_record = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1113
+    /* "csamtools.pyx":1170
  * 
  *         for record in VALID_HEADERS:
  *             if record in new_header:             # <<<<<<<<<<<<<<
  *                 ttype = VALID_HEADER_TYPES[record]
  *                 data = new_header[record]
  */
-    __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1114
+      /* "csamtools.pyx":1171
  *         for record in VALID_HEADERS:
  *             if record in new_header:
  *                 ttype = VALID_HEADER_TYPES[record]             # <<<<<<<<<<<<<<
  *                 data = new_header[record]
  *                 if type( data ) != type( ttype() ):
  */
-      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_v_ttype);
       __pyx_v_ttype = __pyx_t_5;
       __pyx_t_5 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1115
+      /* "csamtools.pyx":1172
  *             if record in new_header:
  *                 ttype = VALID_HEADER_TYPES[record]
  *                 data = new_header[record]             # <<<<<<<<<<<<<<
  *                 if type( data ) != type( ttype() ):
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
  */
-      __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_v_data);
       __pyx_v_data = __pyx_t_5;
       __pyx_t_5 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1116
+      /* "csamtools.pyx":1173
  *                 ttype = VALID_HEADER_TYPES[record]
  *                 data = new_header[record]
  *                 if type( data ) != type( ttype() ):             # <<<<<<<<<<<<<<
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
  *                 if type( data ) == types.DictType:
  */
-      __pyx_t_5 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_5)), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_5)), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_4) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1117
+        /* "csamtools.pyx":1174
  *                 data = new_header[record]
  *                 if type( data ) != type( ttype() ):
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )             # <<<<<<<<<<<<<<
  *                 if type( data ) == types.DictType:
  *                     lines.append( self._buildLine( data, record ) )
  */
-        __pyx_t_1 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
@@ -12213,44 +12246,44 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
         PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)Py_TYPE(__pyx_t_1)));
         __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_t_1)));
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_100), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
         __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
         __Pyx_Raise(__pyx_t_1, 0, 0);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L6;
       }
       __pyx_L6:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1118
+      /* "csamtools.pyx":1175
  *                 if type( data ) != type( ttype() ):
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
  *                 if type( data ) == types.DictType:             # <<<<<<<<<<<<<<
  *                     lines.append( self._buildLine( data, record ) )
  *                 else:
  */
-      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__DictType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__DictType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_4) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1119
+        /* "csamtools.pyx":1176
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
  *                 if type( data ) == types.DictType:
  *                     lines.append( self._buildLine( data, record ) )             # <<<<<<<<<<<<<<
@@ -12258,41 +12291,41 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  *                     for fields in new_header[record]:
  */
         if (unlikely(__pyx_v_lines == Py_None)) {
-          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __Pyx_INCREF(__pyx_v_data);
         PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
         __Pyx_GIVEREF(__pyx_v_data);
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
-        __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_lines), __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+        __pyx_t_7 = PyList_Append(__pyx_v_lines, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L7;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1121
+        /* "csamtools.pyx":1178
  *                     lines.append( self._buildLine( data, record ) )
  *                 else:
  *                     for fields in new_header[record]:             # <<<<<<<<<<<<<<
  *                         lines.append( self._buildLine( fields, record ) )
  * 
  */
-        __pyx_t_6 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
           __pyx_t_8 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5);
         } else {
-          __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_5);
         }
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -12306,7 +12339,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
           } else {
             __pyx_t_6 = PyIter_Next(__pyx_t_5);
             if (!__pyx_t_6) {
-              if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+              if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               break;
             }
             __Pyx_GOTREF(__pyx_t_6);
@@ -12315,7 +12348,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
           __pyx_v_fields = __pyx_t_6;
           __pyx_t_6 = 0;
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1122
+          /* "csamtools.pyx":1179
  *                 else:
  *                     for fields in new_header[record]:
  *                         lines.append( self._buildLine( fields, record ) )             # <<<<<<<<<<<<<<
@@ -12323,23 +12356,23 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  *         text = "\n".join(lines) + "\n"
  */
           if (unlikely(__pyx_v_lines == Py_None)) {
-            PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+            PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
           }
-          __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
           __Pyx_INCREF(__pyx_v_fields);
           PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields);
           __Pyx_GIVEREF(__pyx_v_fields);
           __Pyx_INCREF(__pyx_v_record);
           PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_record);
           __Pyx_GIVEREF(__pyx_v_record);
-          __pyx_t_9 = PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_9);
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_lines), __pyx_t_9); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+          __pyx_t_7 = PyList_Append(__pyx_v_lines, __pyx_t_9); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         }
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -12351,32 +12384,32 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1124
+  /* "csamtools.pyx":1181
  *                         lines.append( self._buildLine( fields, record ) )
  * 
  *         text = "\n".join(lines) + "\n"             # <<<<<<<<<<<<<<
  *         if dest.text != NULL: free( dest.text )
  *         dest.text = <char*>calloc( len(text), sizeof(char))
  */
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(((PyObject *)__pyx_v_lines));
   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_lines));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_lines));
-  __pyx_t_9 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyNumber_Add(__pyx_t_9, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  __pyx_t_5 = PyNumber_Add(__pyx_t_9, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   __Pyx_DECREF(__pyx_v_text);
   __pyx_v_text = __pyx_t_5;
   __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1125
+  /* "csamtools.pyx":1182
  * 
  *         text = "\n".join(lines) + "\n"
  *         if dest.text != NULL: free( dest.text )             # <<<<<<<<<<<<<<
@@ -12390,72 +12423,72 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
   }
   __pyx_L10:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1126
+  /* "csamtools.pyx":1183
  *         text = "\n".join(lines) + "\n"
  *         if dest.text != NULL: free( dest.text )
  *         dest.text = <char*>calloc( len(text), sizeof(char))             # <<<<<<<<<<<<<<
  *         dest.l_text = len(text)
  *         strncpy( dest.text, text, dest.l_text )
  */
-  __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_dest->text = ((char *)calloc(__pyx_t_2, (sizeof(char))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1127
+  /* "csamtools.pyx":1184
  *         if dest.text != NULL: free( dest.text )
  *         dest.text = <char*>calloc( len(text), sizeof(char))
  *         dest.l_text = len(text)             # <<<<<<<<<<<<<<
  *         strncpy( dest.text, text, dest.l_text )
  * 
  */
-  __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_dest->l_text = __pyx_t_2;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1128
+  /* "csamtools.pyx":1185
  *         dest.text = <char*>calloc( len(text), sizeof(char))
  *         dest.l_text = len(text)
  *         strncpy( dest.text, text, dest.l_text )             # <<<<<<<<<<<<<<
  * 
  *         # collect targets
  */
-  __pyx_t_10 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   strncpy(__pyx_v_dest->text, __pyx_t_10, __pyx_v_dest->l_text);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1131
+  /* "csamtools.pyx":1188
  * 
  *         # collect targets
  *         if "SQ" in new_header:             # <<<<<<<<<<<<<<
  *             seqs = []
  *             for fields in new_header["SQ"]:
  */
-  __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1132
+    /* "csamtools.pyx":1189
  *         # collect targets
  *         if "SQ" in new_header:
  *             seqs = []             # <<<<<<<<<<<<<<
  *             for fields in new_header["SQ"]:
  *                 try:
  */
-    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_DECREF(((PyObject *)__pyx_v_seqs));
     __pyx_v_seqs = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1133
+    /* "csamtools.pyx":1190
  *         if "SQ" in new_header:
  *             seqs = []
  *             for fields in new_header["SQ"]:             # <<<<<<<<<<<<<<
  *                 try:
  *                     seqs.append( (fields["SN"], fields["LN"] ) )
  */
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
       __pyx_t_2 = 0; __pyx_t_9 = __pyx_t_5; __Pyx_INCREF(__pyx_t_9);
     } else {
-      __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
     }
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -12469,7 +12502,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
       } else {
         __pyx_t_5 = PyIter_Next(__pyx_t_9);
         if (!__pyx_t_5) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
         __Pyx_GOTREF(__pyx_t_5);
@@ -12478,7 +12511,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
       __pyx_v_fields = __pyx_t_5;
       __pyx_t_5 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1134
+      /* "csamtools.pyx":1191
  *             seqs = []
  *             for fields in new_header["SQ"]:
  *                 try:             # <<<<<<<<<<<<<<
@@ -12493,7 +12526,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
         __Pyx_XGOTREF(__pyx_save_exc_tb);
         /*try:*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1135
+          /* "csamtools.pyx":1192
  *             for fields in new_header["SQ"]:
  *                 try:
  *                     seqs.append( (fields["SN"], fields["LN"] ) )             # <<<<<<<<<<<<<<
@@ -12501,22 +12534,22 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  *                     raise KeyError( "incomplete sequence information in '%s'" % str(fields))
  */
           if (unlikely(__pyx_v_seqs == Py_None)) {
-            PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L14_error;} 
+            PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;} 
           }
-          __pyx_t_5 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__SN)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
+          __pyx_t_5 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__SN)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
           __Pyx_GOTREF(__pyx_t_5);
-          __pyx_t_3 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__LN)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
+          __pyx_t_3 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__LN)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
           __Pyx_GOTREF(__pyx_t_3);
-          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
           PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
           __Pyx_GIVEREF(__pyx_t_5);
           PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
           __Pyx_GIVEREF(__pyx_t_3);
           __pyx_t_5 = 0;
           __pyx_t_3 = 0;
-          __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_seqs), __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __pyx_t_7 = PyList_Append(__pyx_v_seqs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         }
         __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
         __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
@@ -12528,7 +12561,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1136
+        /* "csamtools.pyx":1193
  *                 try:
  *                     seqs.append( (fields["SN"], fields["LN"] ) )
  *                 except KeyError:             # <<<<<<<<<<<<<<
@@ -12538,40 +12571,40 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
         __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
         if (__pyx_t_7) {
           __Pyx_AddTraceback("csamtools.Samfile._buildHeader");
-          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_GOTREF(__pyx_t_3);
           __Pyx_GOTREF(__pyx_t_5);
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1137
+          /* "csamtools.pyx":1194
  *                     seqs.append( (fields["SN"], fields["LN"] ) )
  *                 except KeyError:
  *                     raise KeyError( "incomplete sequence information in '%s'" % str(fields))             # <<<<<<<<<<<<<<
  * 
  *             dest.n_targets = len(seqs)
  */
-          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
-          __Pyx_GOTREF(__pyx_t_6);
+          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __Pyx_INCREF(__pyx_v_fields);
           PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fields);
           __Pyx_GIVEREF(__pyx_v_fields);
-          __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
           __Pyx_GOTREF(__pyx_t_11);
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), __pyx_t_11); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+          __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_101), __pyx_t_11); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-          __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
-          __Pyx_GOTREF(__pyx_t_11);
+          __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_11));
           PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_6));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
           __pyx_t_6 = 0;
-          __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
           __Pyx_Raise(__pyx_t_6, 0, 0);
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -12593,7 +12626,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
     }
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1139
+    /* "csamtools.pyx":1196
  *                     raise KeyError( "incomplete sequence information in '%s'" % str(fields))
  * 
  *             dest.n_targets = len(seqs)             # <<<<<<<<<<<<<<
@@ -12601,12 +12634,12 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
  */
     if (unlikely(__pyx_v_seqs == Py_None)) {
-      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
     __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_seqs)); 
     __pyx_v_dest->n_targets = __pyx_t_2;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1140
+    /* "csamtools.pyx":1197
  * 
  *             dest.n_targets = len(seqs)
  *             dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )             # <<<<<<<<<<<<<<
@@ -12615,7 +12648,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  */
     __pyx_v_dest->target_name = ((char **)calloc(__pyx_v_dest->n_targets, (sizeof(char *))));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1141
+    /* "csamtools.pyx":1198
  *             dest.n_targets = len(seqs)
  *             dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )             # <<<<<<<<<<<<<<
@@ -12624,7 +12657,7 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
  */
     __pyx_v_dest->target_len = ((uint32_t *)calloc(__pyx_v_dest->n_targets, (sizeof(uint32_t))));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1143
+    /* "csamtools.pyx":1200
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
  * 
  *             for x from 0 <= x < dest.n_targets:             # <<<<<<<<<<<<<<
@@ -12634,14 +12667,14 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
     __pyx_t_12 = __pyx_v_dest->n_targets;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_12; __pyx_v_x++) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1144
+      /* "csamtools.pyx":1201
  * 
  *             for x from 0 <= x < dest.n_targets:
  *                 seqname, seqlen = seqs[x]             # <<<<<<<<<<<<<<
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
  *                 strncpy( dest.target_name[x], seqname, len(seqname) + 1 )
  */
-      __pyx_t_9 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_seqs), __pyx_v_x, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_seqs), __pyx_v_x, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       if (PyTuple_CheckExact(__pyx_t_9) && likely(PyTuple_GET_SIZE(__pyx_t_9) == 2)) {
         PyObject* tuple = __pyx_t_9;
@@ -12655,14 +12688,14 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
         __pyx_v_seqlen = __pyx_t_3;
         __pyx_t_3 = 0;
       } else {
-        __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_1, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_1, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
-        if (__Pyx_EndUnpack(__pyx_t_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__Pyx_EndUnpack(__pyx_t_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_v_seqname);
         __pyx_v_seqname = __pyx_t_5;
@@ -12672,42 +12705,42 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
         __pyx_t_3 = 0;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1145
+      /* "csamtools.pyx":1202
  *             for x from 0 <= x < dest.n_targets:
  *                 seqname, seqlen = seqs[x]
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )             # <<<<<<<<<<<<<<
  *                 strncpy( dest.target_name[x], seqname, len(seqname) + 1 )
  *                 dest.target_len[x] = seqlen
  */
-      __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       (__pyx_v_dest->target_name[__pyx_v_x]) = ((char *)calloc((__pyx_t_2 + 1), (sizeof(char))));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1146
+      /* "csamtools.pyx":1203
  *                 seqname, seqlen = seqs[x]
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
  *                 strncpy( dest.target_name[x], seqname, len(seqname) + 1 )             # <<<<<<<<<<<<<<
  *                 dest.target_len[x] = seqlen
  * 
  */
-      __pyx_t_10 = PyBytes_AsString(__pyx_v_seqname); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyBytes_AsString(__pyx_v_seqname); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       strncpy((__pyx_v_dest->target_name[__pyx_v_x]), __pyx_t_10, (__pyx_t_2 + 1));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1147
+      /* "csamtools.pyx":1204
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
  *                 strncpy( dest.target_name[x], seqname, len(seqname) + 1 )
  *                 dest.target_len[x] = seqlen             # <<<<<<<<<<<<<<
  * 
  *         return dest
  */
-      __pyx_t_13 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_seqlen); if (unlikely((__pyx_t_13 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_13 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_seqlen); if (unlikely((__pyx_t_13 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       (__pyx_v_dest->target_len[__pyx_v_x]) = __pyx_t_13;
     }
     goto __pyx_L11;
   }
   __pyx_L11:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1149
+  /* "csamtools.pyx":1206
  *                 dest.target_len[x] = seqlen
  * 
  *         return dest             # <<<<<<<<<<<<<<
@@ -12743,59 +12776,86 @@ static  bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1159
+/* "csamtools.pyx":1216
  *     ## Possible solutions: deprecate or open new file handle
  *     ###############################################################
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
- *         return self
+ *         if not self.isbam and self.samfile.header.n_targets == 0:
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_7Samfile___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
   int __pyx_t_4;
+  int __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 1159);
+  __Pyx_TraceCall("__iter__", __pyx_f[0], 1216);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1160
+  /* "csamtools.pyx":1217
  *     ###############################################################
  *     def __iter__(self):
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
- *         return self
- * 
+ *         if not self.isbam and self.samfile.header.n_targets == 0:
+ *                 raise NotImplementedError( "can not iterate over samfile without header")
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1161
+  /* "csamtools.pyx":1218
  *     def __iter__(self):
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *         if not self.isbam and self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
+ *                 raise NotImplementedError( "can not iterate over samfile without header")
+ *         return self
+ */
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
+  if (__pyx_t_4) {
+    __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
+    __pyx_t_5 = __pyx_t_3;
+  } else {
+    __pyx_t_5 = __pyx_t_4;
+  }
+  if (__pyx_t_5) {
+
+    /* "csamtools.pyx":1219
+ *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *         if not self.isbam and self.samfile.header.n_targets == 0:
+ *                 raise NotImplementedError( "can not iterate over samfile without header")             # <<<<<<<<<<<<<<
+ *         return self
+ * 
+ */
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "csamtools.pyx":1220
+ *         if not self.isbam and self.samfile.header.n_targets == 0:
+ *                 raise NotImplementedError( "can not iterate over samfile without header")
  *         return self             # <<<<<<<<<<<<<<
  * 
  *     cdef bam1_t * getCurrent( self ):
@@ -12819,7 +12879,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___iter__(PyObject *__pyx_v_self) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1163
+/* "csamtools.pyx":1222
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -12831,9 +12891,9 @@ static  bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtoo
   bam1_t *__pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("getCurrent");
-  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1163);
+  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1222);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1164
+  /* "csamtools.pyx":1223
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -12850,7 +12910,7 @@ static  bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtoo
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1166
+/* "csamtools.pyx":1225
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -12862,9 +12922,9 @@ static  int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfil
   int __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("cnext");
-  __Pyx_TraceCall("cnext", __pyx_f[0], 1166);
+  __Pyx_TraceCall("cnext", __pyx_f[0], 1225);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1171
+  /* "csamtools.pyx":1230
  *         '''
  *         cdef int ret
  *         return samread(self.samfile, self.b)             # <<<<<<<<<<<<<<
@@ -12881,7 +12941,7 @@ static  int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfil
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1173
+/* "csamtools.pyx":1232
  *         return samread(self.samfile, self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -12889,19 +12949,19 @@ static  int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfil
  *         python version of next().
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile___next__[] = "\n        python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile___next__;
-static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_21__next__[] = "\n        python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile_21__next__;
+static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self) {
   int __pyx_v_ret;
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1173);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1232);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1178
+  /* "csamtools.pyx":1237
  *         """
  *         cdef int ret
  *         ret = samread(self.samfile, self.b)             # <<<<<<<<<<<<<<
@@ -12910,7 +12970,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
  */
   __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1179
+  /* "csamtools.pyx":1238
  *         cdef int ret
  *         ret = samread(self.samfile, self.b)
  *         if (ret > 0):             # <<<<<<<<<<<<<<
@@ -12920,7 +12980,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
   __pyx_t_1 = (__pyx_v_ret > 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1180
+    /* "csamtools.pyx":1239
  *         ret = samread(self.samfile, self.b)
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -12928,7 +12988,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -12937,7 +12997,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1182
+    /* "csamtools.pyx":1241
  *             return makeAlignedRead( self.b )
  *         else:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -12945,7 +13005,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
  * ##-------------------------------------------------------------------
  */
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L5:;
 
@@ -12962,7 +13022,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile___next__(PyObject *__pyx_v_self) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1234
+/* "csamtools.pyx":1293
  *     cdef int owns_samfile
  * 
  *     def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):             # <<<<<<<<<<<<<<
@@ -12988,7 +13048,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__beg,&__pyx_n_s__end,&__pyx_n_s__reopen,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1234);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1293);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[5] = {0,0,0,0,0};
@@ -13010,19 +13070,19 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg);
       if (likely(values[2])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  3:
       values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
       if (likely(values[3])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  4:
       if (kw_args > 0) {
@@ -13031,14 +13091,14 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
-    __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     if (values[4]) {
-      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_reopen = ((int)1);
     }
@@ -13046,11 +13106,11 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
     __pyx_v_reopen = ((int)1);
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  5:
-      __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       case  4:
-      __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __pyx_v_beg = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_beg = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
       break;
       default: goto __pyx_L5_argtuple_error;
@@ -13058,7 +13118,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__");
   __Pyx_RefNannyFinishContext();
@@ -13066,87 +13126,75 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1236
+  /* "csamtools.pyx":1295
  *     def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1237
+    /* "csamtools.pyx":1296
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         if not samfile._hasIndex():
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1239
+  /* "csamtools.pyx":1298
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         if not samfile._hasIndex():             # <<<<<<<<<<<<<<
  *             raise ValueError( "no index available for iteration" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1240
+    /* "csamtools.pyx":1299
  * 
  *         if not samfile._hasIndex():
  *             raise ValueError( "no index available for iteration" )             # <<<<<<<<<<<<<<
  * 
  *         # makes sure that samfile stays alive as long as the
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_54));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_54));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_1, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1244
+  /* "csamtools.pyx":1303
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -13159,7 +13207,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile));
   ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1246
+  /* "csamtools.pyx":1305
  *         self.samfile = samfile
  * 
  *         if samfile.isbam: mode = "rb"             # <<<<<<<<<<<<<<
@@ -13174,7 +13222,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1247
+    /* "csamtools.pyx":1306
  * 
  *         if samfile.isbam: mode = "rb"
  *         else: mode = "r"             # <<<<<<<<<<<<<<
@@ -13187,7 +13235,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1251
+  /* "csamtools.pyx":1310
  *         # reopen the file - note that this makes the iterator
  *         # slow and causes pileup to slow down significantly.
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -13196,61 +13244,61 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
  */
   if (__pyx_v_reopen) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1252
+    /* "csamtools.pyx":1311
  *         # slow and causes pileup to slow down significantly.
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_store);
     __pyx_v_store = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1253
+    /* "csamtools.pyx":1312
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
  *             store.release()
  *             assert self.fp != NULL
  */
-    __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1254
+    /* "csamtools.pyx":1313
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
  *             assert self.fp != NULL
  *             self.owns_samfile = True
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1255
+    /* "csamtools.pyx":1314
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
  *             self.owns_samfile = True
  *         else:
  */
-    #ifndef PYREX_WITHOUT_ASSERTIONS
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
     if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1256
+    /* "csamtools.pyx":1315
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
@@ -13262,7 +13310,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1258
+    /* "csamtools.pyx":1317
  *             self.owns_samfile = True
  *         else:
  *             self.fp = self.samfile.samfile             # <<<<<<<<<<<<<<
@@ -13271,7 +13319,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
  */
     ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->samfile;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1259
+    /* "csamtools.pyx":1318
  *         else:
  *             self.fp = self.samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
@@ -13282,7 +13330,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1261
+  /* "csamtools.pyx":1320
  *             self.owns_samfile = False
  * 
  *         self.retval = 0             # <<<<<<<<<<<<<<
@@ -13291,7 +13339,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
  */
   ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1263
+  /* "csamtools.pyx":1322
  *         self.retval = 0
  * 
  *         self.iter = bam_iter_query(self.samfile.index,             # <<<<<<<<<<<<<<
@@ -13300,7 +13348,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
  */
   ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->iter = bam_iter_query(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1267
+  /* "csamtools.pyx":1326
  *                                    beg,
  *                                    end)
  *         self.b = bam_init1()             # <<<<<<<<<<<<<<
@@ -13324,7 +13372,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1269
+/* "csamtools.pyx":1328
  *         self.b = bam_init1()
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -13332,14 +13380,14 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_s
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 1269);
+  __Pyx_TraceCall("__iter__", __pyx_f[0], 1328);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1270
+  /* "csamtools.pyx":1329
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -13359,7 +13407,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___iter__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1272
+/* "csamtools.pyx":1331
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -13371,9 +13419,9 @@ static  bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_o
   bam1_t *__pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("getCurrent");
-  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1272);
+  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1331);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1273
+  /* "csamtools.pyx":1332
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -13390,7 +13438,7 @@ static  bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_o
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1275
+/* "csamtools.pyx":1334
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -13402,9 +13450,9 @@ static  int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamt
   int __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("cnext");
-  __Pyx_TraceCall("cnext", __pyx_f[0], 1275);
+  __Pyx_TraceCall("cnext", __pyx_f[0], 1334);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1277
+  /* "csamtools.pyx":1336
  *     cdef int cnext(self):
  *         '''cversion of iterator. Used by IteratorColumn'''
  *         self.retval = bam_iter_read( self.fp.x.bam,             # <<<<<<<<<<<<<<
@@ -13419,7 +13467,7 @@ static  int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1281
+/* "csamtools.pyx":1340
  *                                      self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -13427,18 +13475,18 @@ static  int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamt
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_17IteratorRowRegion___next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion___next__;
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_17IteratorRowRegion_2__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__;
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1281);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1340);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1284
+  /* "csamtools.pyx":1343
  *         """python version of next().
  *         """
  *         self.cnext()             # <<<<<<<<<<<<<<
@@ -13447,7 +13495,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__py
  */
   ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1285
+  /* "csamtools.pyx":1344
  *         """
  *         self.cnext()
  *         if self.retval < 0: raise StopIteration             # <<<<<<<<<<<<<<
@@ -13457,12 +13505,12 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__py
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval < 0);
   if (__pyx_t_1) {
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1286
+  /* "csamtools.pyx":1345
  *         self.cnext()
  *         if self.retval < 0: raise StopIteration
  *         return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -13470,7 +13518,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__py
  *     def __dealloc__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -13489,7 +13537,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1288
+/* "csamtools.pyx":1347
  *         return makeAlignedRead( self.b )
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -13497,13 +13545,13 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion___next__(PyObject *__py
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_9csamtools_17IteratorRowRegion___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_17IteratorRowRegion___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1288);
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1347);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1289
+  /* "csamtools.pyx":1348
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
@@ -13512,7 +13560,7 @@ static void __pyx_pf_9csamtools_17IteratorRowRegion___dealloc__(PyObject *__pyx_
  */
   bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1290
+  /* "csamtools.pyx":1349
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
@@ -13529,8 +13577,8 @@ static void __pyx_pf_9csamtools_17IteratorRowRegion___dealloc__(PyObject *__pyx_
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1307
- *     cdef int owns_samfile
+/* "csamtools.pyx":1366
+ *     cdef int owns_samfile
  * 
  *     def __cinit__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
  * 
@@ -13552,7 +13600,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1307);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1366);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[2] = {0,0};
@@ -13574,18 +13622,18 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     if (values[1]) {
-      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_reopen = ((int)1);
     }
   } else {
     __pyx_v_reopen = ((int)1);
     switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       case  1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
       break;
       default: goto __pyx_L5_argtuple_error;
@@ -13593,7 +13641,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__");
   __Pyx_RefNannyFinishContext();
@@ -13601,48 +13649,42 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1309
+  /* "csamtools.pyx":1368
  *     def __cinit__(self, Samfile samfile, int reopen = True ):
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1310
+    /* "csamtools.pyx":1369
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         if samfile.isbam: mode = "rb"
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1312
+  /* "csamtools.pyx":1371
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         if samfile.isbam: mode = "rb"             # <<<<<<<<<<<<<<
@@ -13657,7 +13699,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1313
+    /* "csamtools.pyx":1372
  * 
  *         if samfile.isbam: mode = "rb"
  *         else: mode = "r"             # <<<<<<<<<<<<<<
@@ -13670,7 +13712,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1316
+  /* "csamtools.pyx":1375
  * 
  *         # reopen the file to avoid iterator conflict
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -13679,61 +13721,61 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
  */
   if (__pyx_v_reopen) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1317
+    /* "csamtools.pyx":1376
  *         # reopen the file to avoid iterator conflict
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_store);
-    __pyx_v_store = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_store = __pyx_t_1;
+    __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1318
+    /* "csamtools.pyx":1377
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
  *             store.release()
  *             assert self.fp != NULL
  */
-    __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1319
+    /* "csamtools.pyx":1378
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
  *             assert self.fp != NULL
  *             self.owns_samfile = True
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1320
+    /* "csamtools.pyx":1379
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
  *             self.owns_samfile = True
  *         else:
  */
-    #ifndef PYREX_WITHOUT_ASSERTIONS
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
     if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1321
+    /* "csamtools.pyx":1380
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
@@ -13745,7 +13787,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1323
+    /* "csamtools.pyx":1382
  *             self.owns_samfile = True
  *         else:
  *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
@@ -13754,7 +13796,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
  */
     ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1324
+    /* "csamtools.pyx":1383
  *         else:
  *             self.fp = samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
@@ -13765,7 +13807,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1327
+  /* "csamtools.pyx":1386
  * 
  *         # allocate memory for alignment
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))             # <<<<<<<<<<<<<<
@@ -13789,7 +13831,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1329
+/* "csamtools.pyx":1388
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -13797,14 +13839,14 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 1329);
+  __Pyx_TraceCall("__iter__", __pyx_f[0], 1388);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1330
+  /* "csamtools.pyx":1389
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -13824,7 +13866,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___iter__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1332
+/* "csamtools.pyx":1391
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -13836,9 +13878,9 @@ static  bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_
   bam1_t *__pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("getCurrent");
-  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1332);
+  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1391);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1333
+  /* "csamtools.pyx":1392
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -13855,7 +13897,7 @@ static  bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1335
+/* "csamtools.pyx":1394
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -13867,9 +13909,9 @@ static  int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtool
   int __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("cnext");
-  __Pyx_TraceCall("cnext", __pyx_f[0], 1335);
+  __Pyx_TraceCall("cnext", __pyx_f[0], 1394);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1338
+  /* "csamtools.pyx":1397
  *         '''cversion of iterator. Used by IteratorColumn'''
  *         cdef int ret
  *         return samread(self.fp, self.b)             # <<<<<<<<<<<<<<
@@ -13886,7 +13928,7 @@ static  int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1340
+/* "csamtools.pyx":1399
  *         return samread(self.fp, self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -13894,19 +13936,19 @@ static  int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtool
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_14IteratorRowAll___next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll___next__;
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_14IteratorRowAll_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__;
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self) {
   int __pyx_v_ret;
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1340);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1399);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1346
+  /* "csamtools.pyx":1405
  *         """
  *         cdef int ret
  *         ret = samread(self.fp, self.b)             # <<<<<<<<<<<<<<
@@ -13915,7 +13957,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
  */
   __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp, ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1347
+  /* "csamtools.pyx":1406
  *         cdef int ret
  *         ret = samread(self.fp, self.b)
  *         if (ret > 0):             # <<<<<<<<<<<<<<
@@ -13925,7 +13967,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
   __pyx_t_1 = (__pyx_v_ret > 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1348
+    /* "csamtools.pyx":1407
  *         ret = samread(self.fp, self.b)
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -13933,7 +13975,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -13942,7 +13984,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1350
+    /* "csamtools.pyx":1409
  *             return makeAlignedRead( self.b )
  *         else:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -13950,7 +13992,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
  *     def __dealloc__(self):
  */
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L5:;
 
@@ -13967,7 +14009,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1352
+/* "csamtools.pyx":1411
  *             raise StopIteration
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -13975,13 +14017,13 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll___next__(PyObject *__pyx_v
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_9csamtools_14IteratorRowAll___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_14IteratorRowAll___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1352);
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1411);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1353
+  /* "csamtools.pyx":1412
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
@@ -13990,7 +14032,7 @@ static void __pyx_pf_9csamtools_14IteratorRowAll___dealloc__(PyObject *__pyx_v_s
  */
   bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1354
+  /* "csamtools.pyx":1413
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
@@ -14007,7 +14049,7 @@ static void __pyx_pf_9csamtools_14IteratorRowAll___dealloc__(PyObject *__pyx_v_s
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1363
+/* "csamtools.pyx":1422
  *     cdef IteratorRowRegion rowiter
  * 
  *     def __cinit__(self, Samfile samfile):             # <<<<<<<<<<<<<<
@@ -14026,7 +14068,7 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1363);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1422);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[1] = {0};
@@ -14042,7 +14084,7 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_
       else goto __pyx_L5_argtuple_error;
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
   } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
@@ -14052,67 +14094,61 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1364
+  /* "csamtools.pyx":1423
  * 
  *     def __cinit__(self, Samfile samfile):
  *         assert samfile._isOpen()             # <<<<<<<<<<<<<<
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
  *         self.samfile = samfile
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1365
+  /* "csamtools.pyx":1424
  *     def __cinit__(self, Samfile samfile):
  *         assert samfile._isOpen()
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")             # <<<<<<<<<<<<<<
  *         self.samfile = samfile
  *         self.tid = -1
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_32));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_1, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1366
+  /* "csamtools.pyx":1425
  *         assert samfile._isOpen()
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -14125,7 +14161,7 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
   ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1367
+  /* "csamtools.pyx":1426
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
  *         self.samfile = samfile
  *         self.tid = -1             # <<<<<<<<<<<<<<
@@ -14147,7 +14183,7 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1369
+/* "csamtools.pyx":1428
  *         self.tid = -1
  * 
  *     def nextiter(self):             # <<<<<<<<<<<<<<
@@ -14155,27 +14191,27 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_18IteratorRowAllRefs_nextiter[] = "IteratorRowAllRefs.nextiter(self)";
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter[] = "IteratorRowAllRefs.nextiter(self)";
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("nextiter");
-  __Pyx_TraceCall("nextiter", __pyx_f[0], 1369);
+  __Pyx_TraceCall("nextiter", __pyx_f[0], 1428);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1370
+  /* "csamtools.pyx":1429
  * 
  *     def nextiter(self):
  *         self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)             # <<<<<<<<<<<<<<
  * 
  *     def __iter__(self):
  */
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
   __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
@@ -14188,9 +14224,9 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_nextiter(PyObject *__p
   PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_int_536870912);
   __Pyx_GIVEREF(__pyx_int_536870912);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter);
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter));
@@ -14211,7 +14247,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_nextiter(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1372
+/* "csamtools.pyx":1431
  *         self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -14219,14 +14255,14 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_nextiter(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 1372);
+  __Pyx_TraceCall("__iter__", __pyx_f[0], 1431);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1373
+  /* "csamtools.pyx":1432
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -14246,7 +14282,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___iter__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1375
+/* "csamtools.pyx":1434
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -14254,10 +14290,10 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___iter__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18IteratorRowAllRefs___next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs___next__;
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__;
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
@@ -14266,9 +14302,9 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
   PyObject *__pyx_t_5 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1375);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1434);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1381
+  /* "csamtools.pyx":1440
  *         """
  *         # Create an initial iterator
  *         if self.tid==-1:             # <<<<<<<<<<<<<<
@@ -14278,21 +14314,21 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid == -1);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1382
+    /* "csamtools.pyx":1441
  *         # Create an initial iterator
  *         if self.tid==-1:
  *             if not self.samfile.nreferences:             # <<<<<<<<<<<<<<
  *                 raise StopIteration
  *             self.tid = 0
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_3 = (!__pyx_t_1);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1383
+      /* "csamtools.pyx":1442
  *         if self.tid==-1:
  *             if not self.samfile.nreferences:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -14300,12 +14336,12 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
  *             self.nextiter()
  */
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
     __pyx_L6:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1384
+    /* "csamtools.pyx":1443
  *             if not self.samfile.nreferences:
  *                 raise StopIteration
  *             self.tid = 0             # <<<<<<<<<<<<<<
@@ -14314,16 +14350,16 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
  */
     ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1385
+    /* "csamtools.pyx":1444
  *                 raise StopIteration
  *             self.tid = 0
  *             self.nextiter()             # <<<<<<<<<<<<<<
  * 
  *         while 1:
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -14331,7 +14367,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1387
+  /* "csamtools.pyx":1446
  *             self.nextiter()
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -14341,7 +14377,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
   while (1) {
     if (!1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1388
+    /* "csamtools.pyx":1447
  * 
  *         while 1:
  *             self.rowiter.cnext()             # <<<<<<<<<<<<<<
@@ -14350,7 +14386,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
  */
     ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1391
+    /* "csamtools.pyx":1450
  * 
  *             # If current iterator is not exhausted, return aligned read
  *             if self.rowiter.retval>0:             # <<<<<<<<<<<<<<
@@ -14360,7 +14396,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
     __pyx_t_3 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->retval > 0);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1392
+      /* "csamtools.pyx":1451
  *             # If current iterator is not exhausted, return aligned read
  *             if self.rowiter.retval>0:
  *                 return makeAlignedRead(self.rowiter.b)             # <<<<<<<<<<<<<<
@@ -14368,7 +14404,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
  *             self.tid += 1
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __pyx_r = __pyx_t_4;
       __pyx_t_4 = 0;
@@ -14377,44 +14413,44 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1394
+    /* "csamtools.pyx":1453
  *                 return makeAlignedRead(self.rowiter.b)
  * 
  *             self.tid += 1             # <<<<<<<<<<<<<<
  * 
  *             # Otherwise, proceed to next reference or stop
  */
-    ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid += 1;
+    ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid + 1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1397
+    /* "csamtools.pyx":1456
  * 
  *             # Otherwise, proceed to next reference or stop
  *             if self.tid<self.samfile.nreferences:             # <<<<<<<<<<<<<<
  *                 self.nextiter()
  *             else:
  */
-    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1398
+      /* "csamtools.pyx":1457
  *             # Otherwise, proceed to next reference or stop
  *             if self.tid<self.samfile.nreferences:
  *                 self.nextiter()             # <<<<<<<<<<<<<<
  *             else:
  *                 raise StopIteration
  */
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -14422,7 +14458,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1400
+      /* "csamtools.pyx":1459
  *                 self.nextiter()
  *             else:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -14430,7 +14466,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
  * cdef class IteratorRowSelection(IteratorRow):
  */
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L10:;
   }
@@ -14450,7 +14486,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs___next__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1415
+/* "csamtools.pyx":1474
  *     cdef int owns_samfile
  * 
  *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):             # <<<<<<<<<<<<<<
@@ -14474,7 +14510,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__positions,&__pyx_n_s__reopen,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1415);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1474);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
@@ -14494,7 +14530,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__positions);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       if (kw_args > 0) {
@@ -14503,12 +14539,12 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     __pyx_v_positions = values[1];
     if (values[2]) {
-      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_reopen = ((int)1);
     }
@@ -14516,7 +14552,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
     __pyx_v_reopen = ((int)1);
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3:
-      __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       case  2:
       __pyx_v_positions = PyTuple_GET_ITEM(__pyx_args, 1);
       __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
@@ -14526,7 +14562,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__");
   __Pyx_RefNannyFinishContext();
@@ -14534,101 +14570,89 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1417
+  /* "csamtools.pyx":1476
  *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1418
+    /* "csamtools.pyx":1477
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         if not samfile._isOpen():
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1420
+  /* "csamtools.pyx":1479
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1421
+    /* "csamtools.pyx":1480
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         assert samfile.isbam, "can only use this iterator on bam files"
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_1, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1423
+  /* "csamtools.pyx":1482
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         assert samfile.isbam, "can only use this iterator on bam files"             # <<<<<<<<<<<<<<
  *         mode = "rb"
  * 
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   if (unlikely(!__pyx_v_samfile->isbam)) {
-    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_55));
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_112));
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1424
+  /* "csamtools.pyx":1483
  * 
  *         assert samfile.isbam, "can only use this iterator on bam files"
  *         mode = "rb"             # <<<<<<<<<<<<<<
@@ -14639,7 +14663,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   __Pyx_DECREF(__pyx_v_mode);
   __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1427
+  /* "csamtools.pyx":1486
  * 
  *         # reopen the file to avoid iterator conflict
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -14648,61 +14672,61 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
  */
   if (__pyx_v_reopen) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1428
+    /* "csamtools.pyx":1487
  *         # reopen the file to avoid iterator conflict
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_store);
     __pyx_v_store = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1429
+    /* "csamtools.pyx":1488
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
  *             store.release()
  *             assert self.fp != NULL
  */
-    __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1430
+    /* "csamtools.pyx":1489
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
  *             assert self.fp != NULL
  *             self.owns_samfile = True
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1431
+    /* "csamtools.pyx":1490
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
  *             self.owns_samfile = True
  *         else:
  */
-    #ifndef PYREX_WITHOUT_ASSERTIONS
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
     if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1432
+    /* "csamtools.pyx":1491
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
@@ -14714,7 +14738,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1434
+    /* "csamtools.pyx":1493
  *             self.owns_samfile = True
  *         else:
  *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
@@ -14723,7 +14747,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
  */
     ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1435
+    /* "csamtools.pyx":1494
  *         else:
  *             self.fp = samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
@@ -14734,7 +14758,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1438
+  /* "csamtools.pyx":1497
  * 
  *         # allocate memory for alignment
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))             # <<<<<<<<<<<<<<
@@ -14743,7 +14767,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
  */
   ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1440
+  /* "csamtools.pyx":1499
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
  *         self.positions = positions             # <<<<<<<<<<<<<<
@@ -14756,7 +14780,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions);
   ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions = __pyx_v_positions;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1441
+  /* "csamtools.pyx":1500
  * 
  *         self.positions = positions
  *         self.current_pos = 0             # <<<<<<<<<<<<<<
@@ -14780,7 +14804,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1443
+/* "csamtools.pyx":1502
  *         self.current_pos = 0
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -14788,14 +14812,14 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 1443);
+  __Pyx_TraceCall("__iter__", __pyx_f[0], 1502);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1444
+  /* "csamtools.pyx":1503
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -14815,7 +14839,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___iter__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1446
+/* "csamtools.pyx":1505
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -14827,9 +14851,9 @@ static  bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __py
   bam1_t *__pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("getCurrent");
-  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1446);
+  __Pyx_TraceCall("getCurrent", __pyx_f[0], 1505);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1447
+  /* "csamtools.pyx":1506
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -14846,7 +14870,7 @@ static  bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1449
+/* "csamtools.pyx":1508
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -14856,53 +14880,56 @@ static  bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __py
 
 static  int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
   int __pyx_r;
-  Py_ssize_t __pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  Py_ssize_t __pyx_t_2;
+  int __pyx_t_3;
   uint64_t __pyx_t_4;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("cnext");
-  __Pyx_TraceCall("cnext", __pyx_f[0], 1449);
+  __Pyx_TraceCall("cnext", __pyx_f[0], 1508);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1453
+  /* "csamtools.pyx":1512
  * 
  *         # end iteration if out of positions
  *         if self.current_pos >= len(self.positions): return -1             # <<<<<<<<<<<<<<
  * 
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
  */
-  __pyx_t_1 = PyObject_Length(__pyx_v_self->positions); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = (__pyx_v_self->current_pos >= __pyx_t_1);
-  if (__pyx_t_2) {
+  __pyx_t_1 = __pyx_v_self->positions;
+  __Pyx_INCREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = (__pyx_v_self->current_pos >= __pyx_t_2);
+  if (__pyx_t_3) {
     __pyx_r = -1;
     goto __pyx_L0;
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1455
+  /* "csamtools.pyx":1514
  *         if self.current_pos >= len(self.positions): return -1
  * 
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )             # <<<<<<<<<<<<<<
  *         self.current_pos += 1
  *         return samread(self.fp, self.b)
  */
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->positions, __pyx_v_self->current_pos, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_from_py_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->positions, __pyx_v_self->current_pos, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = __Pyx_PyInt_from_py_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   bam_seek(__pyx_v_self->fp->x.bam, __pyx_t_4, 0);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1456
+  /* "csamtools.pyx":1515
  * 
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
  *         self.current_pos += 1             # <<<<<<<<<<<<<<
  *         return samread(self.fp, self.b)
  * 
  */
-  __pyx_v_self->current_pos += 1;
+  __pyx_v_self->current_pos = (__pyx_v_self->current_pos + 1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1457
+  /* "csamtools.pyx":1516
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
  *         self.current_pos += 1
  *         return samread(self.fp, self.b)             # <<<<<<<<<<<<<<
@@ -14915,7 +14942,7 @@ static  int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9cs
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("csamtools.IteratorRowSelection.cnext");
   __pyx_r = 0;
   __pyx_L0:;
@@ -14924,7 +14951,7 @@ static  int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1459
+/* "csamtools.pyx":1518
  *         return samread(self.fp, self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -14932,19 +14959,19 @@ static  int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9cs
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_20IteratorRowSelection___next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection___next__;
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_20IteratorRowSelection_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__;
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self) {
   int __pyx_v_ret;
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1459);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1518);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1465
+  /* "csamtools.pyx":1524
  *         """
  * 
  *         cdef int ret = self.cnext()             # <<<<<<<<<<<<<<
@@ -14953,7 +14980,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
  */
   __pyx_v_ret = ((struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *)((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1466
+  /* "csamtools.pyx":1525
  * 
  *         cdef int ret = self.cnext()
  *         if (ret > 0):             # <<<<<<<<<<<<<<
@@ -14963,7 +14990,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
   __pyx_t_1 = (__pyx_v_ret > 0);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1467
+    /* "csamtools.pyx":1526
  *         cdef int ret = self.cnext()
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -14971,7 +14998,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -14980,7 +15007,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1469
+    /* "csamtools.pyx":1528
  *             return makeAlignedRead( self.b )
  *         else:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -14988,7 +15015,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
  *     def __dealloc__(self):
  */
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L5:;
 
@@ -15005,7 +15032,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1471
+/* "csamtools.pyx":1530
  *             raise StopIteration
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -15013,13 +15040,13 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection___next__(PyObject *_
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_9csamtools_20IteratorRowSelection___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_20IteratorRowSelection___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1471);
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1530);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1472
+  /* "csamtools.pyx":1531
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
@@ -15028,7 +15055,7 @@ static void __pyx_pf_9csamtools_20IteratorRowSelection___dealloc__(PyObject *__p
  */
   bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1473
+  /* "csamtools.pyx":1532
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
@@ -15045,7 +15072,7 @@ static void __pyx_pf_9csamtools_20IteratorRowSelection___dealloc__(PyObject *__p
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1486
+/* "csamtools.pyx":1545
  *     int seq_len
  * 
  * cdef int __advance_all( void * data, bam1_t * b ):             # <<<<<<<<<<<<<<
@@ -15058,9 +15085,9 @@ static  int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v
   int __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__advance_all");
-  __Pyx_TraceCall("__advance_all", __pyx_f[0], 1486);
+  __Pyx_TraceCall("__advance_all", __pyx_f[0], 1545);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1490
+  /* "csamtools.pyx":1549
  *     '''
  *     cdef __iterdata * d
  *     d = <__iterdata*>data             # <<<<<<<<<<<<<<
@@ -15069,7 +15096,7 @@ static  int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v
  */
   __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1491
+  /* "csamtools.pyx":1550
  *     cdef __iterdata * d
  *     d = <__iterdata*>data
  *     return bam_iter_read( d.samfile.x.bam, d.iter, b )             # <<<<<<<<<<<<<<
@@ -15086,7 +15113,7 @@ static  int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1493
+/* "csamtools.pyx":1552
  *     return bam_iter_read( d.samfile.x.bam, d.iter, b )
  * 
  * cdef int __advance_snpcalls( void * data, bam1_t * b ):             # <<<<<<<<<<<<<<
@@ -15112,9 +15139,9 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
   long __pyx_t_7;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__advance_snpcalls");
-  __Pyx_TraceCall("__advance_snpcalls", __pyx_f[0], 1493);
+  __Pyx_TraceCall("__advance_snpcalls", __pyx_f[0], 1552);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1498
+  /* "csamtools.pyx":1557
  *     '''
  *     cdef __iterdata * d
  *     d = <__iterdata*>data             # <<<<<<<<<<<<<<
@@ -15123,7 +15150,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
   __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1500
+  /* "csamtools.pyx":1559
  *     d = <__iterdata*>data
  * 
  *     cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )             # <<<<<<<<<<<<<<
@@ -15132,7 +15159,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
   __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1501
+  /* "csamtools.pyx":1560
  * 
  *     cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
  *     cdef int skip = 0             # <<<<<<<<<<<<<<
@@ -15141,7 +15168,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
   __pyx_v_skip = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1503
+  /* "csamtools.pyx":1562
  *     cdef int skip = 0
  *     cdef int q
  *     cdef int is_cns = 1             # <<<<<<<<<<<<<<
@@ -15150,7 +15177,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
   __pyx_v_is_cns = 1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1504
+  /* "csamtools.pyx":1563
  *     cdef int q
  *     cdef int is_cns = 1
  *     cdef int is_nobaq = 0             # <<<<<<<<<<<<<<
@@ -15159,7 +15186,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
   __pyx_v_is_nobaq = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1505
+  /* "csamtools.pyx":1564
  *     cdef int is_cns = 1
  *     cdef int is_nobaq = 0
  *     cdef int capQ_thres = 0             # <<<<<<<<<<<<<<
@@ -15168,7 +15195,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
   __pyx_v_capQ_thres = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1508
+  /* "csamtools.pyx":1567
  * 
  *     # reload sequence
  *     if d.fastafile != NULL and b.core.tid != d.tid:             # <<<<<<<<<<<<<<
@@ -15184,7 +15211,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
   }
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1509
+    /* "csamtools.pyx":1568
  *     # reload sequence
  *     if d.fastafile != NULL and b.core.tid != d.tid:
  *         if d.seq != NULL: free(d.seq)             # <<<<<<<<<<<<<<
@@ -15198,7 +15225,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     }
     __pyx_L4:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1510
+    /* "csamtools.pyx":1569
  *     if d.fastafile != NULL and b.core.tid != d.tid:
  *         if d.seq != NULL: free(d.seq)
  *         d.tid = b.core.tid             # <<<<<<<<<<<<<<
@@ -15207,7 +15234,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
     __pyx_v_d->tid = __pyx_v_b->core.tid;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1511
+    /* "csamtools.pyx":1570
  *         if d.seq != NULL: free(d.seq)
  *         d.tid = b.core.tid
  *         d.seq = faidx_fetch_seq(d.fastafile,             # <<<<<<<<<<<<<<
@@ -15216,7 +15243,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
     __pyx_v_d->seq = faidx_fetch_seq(__pyx_v_d->fastafile, (__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid]), 0, __pyx_v_9csamtools_max_pos, (&__pyx_v_d->seq_len));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1515
+    /* "csamtools.pyx":1574
  *                                 0, max_pos,
  *                                 &d.seq_len)
  *         if d.seq == NULL:             # <<<<<<<<<<<<<<
@@ -15226,47 +15253,47 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     __pyx_t_3 = (__pyx_v_d->seq == NULL);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1517
+      /* "csamtools.pyx":1576
  *         if d.seq == NULL:
  *             raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
  *                                   (d.samfile.header.target_name[d.tid],             # <<<<<<<<<<<<<<
  *                                    d.tid))
  * 
  */
-      __pyx_t_4 = PyBytes_FromString((__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyBytes_FromString((__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1518
+      /* "csamtools.pyx":1577
  *             raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
  *                                   (d.samfile.header.target_name[d.tid],
  *                                    d.tid))             # <<<<<<<<<<<<<<
  * 
  * 
  */
-      __pyx_t_5 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
       PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
       __Pyx_GIVEREF(__pyx_t_5);
       __pyx_t_4 = 0;
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_113), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_Raise(__pyx_t_5, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -15274,7 +15301,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1521
+  /* "csamtools.pyx":1580
  * 
  * 
  *     while ret >= 0:             # <<<<<<<<<<<<<<
@@ -15285,7 +15312,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     __pyx_t_3 = (__pyx_v_ret >= 0);
     if (!__pyx_t_3) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1523
+    /* "csamtools.pyx":1582
  *     while ret >= 0:
  * 
  *         skip = 0             # <<<<<<<<<<<<<<
@@ -15294,7 +15321,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
     __pyx_v_skip = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1526
+    /* "csamtools.pyx":1585
  * 
  *         # realign read - changes base qualities
  *         if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq )             # <<<<<<<<<<<<<<
@@ -15319,7 +15346,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1528
+    /* "csamtools.pyx":1587
  *         if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq )
  * 
  *         if d.seq != NULL and capQ_thres > 10:             # <<<<<<<<<<<<<<
@@ -15335,7 +15362,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     }
     if (__pyx_t_2) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1529
+      /* "csamtools.pyx":1588
  * 
  *         if d.seq != NULL and capQ_thres > 10:
  *             q = bam_cap_mapQ(b, d.seq, capQ_thres)             # <<<<<<<<<<<<<<
@@ -15344,7 +15371,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
  */
       __pyx_v_q = bam_cap_mapQ(__pyx_v_b, __pyx_v_d->seq, __pyx_v_capQ_thres);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1530
+      /* "csamtools.pyx":1589
  *         if d.seq != NULL and capQ_thres > 10:
  *             q = bam_cap_mapQ(b, d.seq, capQ_thres)
  *             if q < 0: skip = 1             # <<<<<<<<<<<<<<
@@ -15357,7 +15384,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
         goto __pyx_L10;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1531
+      /* "csamtools.pyx":1590
  *             q = bam_cap_mapQ(b, d.seq, capQ_thres)
  *             if q < 0: skip = 1
  *             elif b.core.qual > q: b.core.qual = q             # <<<<<<<<<<<<<<
@@ -15374,7 +15401,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1532
+    /* "csamtools.pyx":1591
  *             if q < 0: skip = 1
  *             elif b.core.qual > q: b.core.qual = q
  *         if b.core.flag & BAM_FUNMAP: skip = 1             # <<<<<<<<<<<<<<
@@ -15387,7 +15414,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
       goto __pyx_L11;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1533
+    /* "csamtools.pyx":1592
  *             elif b.core.qual > q: b.core.qual = q
  *         if b.core.flag & BAM_FUNMAP: skip = 1
  *         elif b.core.flag & 1 and not b.core.flag & 2: skip = 1             # <<<<<<<<<<<<<<
@@ -15406,7 +15433,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     }
     __pyx_L11:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1535
+    /* "csamtools.pyx":1594
  *         elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
  * 
  *         if not skip: break             # <<<<<<<<<<<<<<
@@ -15420,7 +15447,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
     }
     __pyx_L12:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1538
+    /* "csamtools.pyx":1597
  *         # additional filters
  * 
  *         ret = bam_iter_read( d.samfile.x.bam, d.iter, b )             # <<<<<<<<<<<<<<
@@ -15431,7 +15458,7 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
   }
   __pyx_L7_break:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1540
+  /* "csamtools.pyx":1599
  *         ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
  * 
  *     return ret             # <<<<<<<<<<<<<<
@@ -15455,8 +15482,8 @@ static  int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1599
- *     cdef stepper
+/* "csamtools.pyx":1659
+ *     cdef int max_depth
  * 
  *     def __cinit__( self, Samfile samfile, **kwargs ):             # <<<<<<<<<<<<<<
  *         self.samfile = samfile
@@ -15474,7 +15501,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1599);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1659);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
   __Pyx_GOTREF(__pyx_v_kwargs);
   if (unlikely(__pyx_kwds)) {
@@ -15492,7 +15519,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
       else goto __pyx_L5_argtuple_error;
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
   } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
@@ -15502,16 +15529,16 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs);
   __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1600
+  /* "csamtools.pyx":1660
  * 
  *     def __cinit__( self, Samfile samfile, **kwargs ):
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -15524,7 +15551,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile));
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1601
+  /* "csamtools.pyx":1661
  *     def __cinit__( self, Samfile samfile, **kwargs ):
  *         self.samfile = samfile
  *         self.mask = kwargs.get("mask", BAM_DEF_MASK )             # <<<<<<<<<<<<<<
@@ -15532,47 +15559,47 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
  *         self.stepper = kwargs.get( "stepper", None )
  */
   if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
-  __pyx_t_1 = PyInt_FromLong(BAM_DEF_MASK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(BAM_DEF_MASK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__mask), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__mask), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->mask = __pyx_t_3;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1602
+  /* "csamtools.pyx":1662
  *         self.samfile = samfile
  *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
  *         self.fastafile = kwargs.get( "fastafile", None )             # <<<<<<<<<<<<<<
  *         self.stepper = kwargs.get( "stepper", None )
- *         self.iterdata.seq = NULL
+ *         self.max_depth = kwargs.get( "max_depth", 8000 )
  */
   if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__fastafile), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__fastafile), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1603
+  /* "csamtools.pyx":1663
  *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
  *         self.fastafile = kwargs.get( "fastafile", None )
  *         self.stepper = kwargs.get( "stepper", None )             # <<<<<<<<<<<<<<
+ *         self.max_depth = kwargs.get( "max_depth", 8000 )
  *         self.iterdata.seq = NULL
- *         self.tid = 0
  */
   if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__stepper), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__stepper), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper);
@@ -15580,17 +15607,33 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1604
+  /* "csamtools.pyx":1664
  *         self.fastafile = kwargs.get( "fastafile", None )
  *         self.stepper = kwargs.get( "stepper", None )
+ *         self.max_depth = kwargs.get( "max_depth", 8000 )             # <<<<<<<<<<<<<<
+ *         self.iterdata.seq = NULL
+ *         self.tid = 0
+ */
+  if (unlikely(__pyx_v_kwargs == Py_None)) {
+    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
+  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_depth), __pyx_int_8000); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->max_depth = __pyx_t_3;
+
+  /* "csamtools.pyx":1665
+ *         self.stepper = kwargs.get( "stepper", None )
+ *         self.max_depth = kwargs.get( "max_depth", 8000 )
  *         self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
  *         self.tid = 0
  *         self.pos = 0
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1605
- *         self.stepper = kwargs.get( "stepper", None )
+  /* "csamtools.pyx":1666
+ *         self.max_depth = kwargs.get( "max_depth", 8000 )
  *         self.iterdata.seq = NULL
  *         self.tid = 0             # <<<<<<<<<<<<<<
  *         self.pos = 0
@@ -15598,7 +15641,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->tid = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1606
+  /* "csamtools.pyx":1667
  *         self.iterdata.seq = NULL
  *         self.tid = 0
  *         self.pos = 0             # <<<<<<<<<<<<<<
@@ -15607,7 +15650,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pos = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1607
+  /* "csamtools.pyx":1668
  *         self.tid = 0
  *         self.pos = 0
  *         self.n_plp = 0             # <<<<<<<<<<<<<<
@@ -15616,7 +15659,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->n_plp = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1608
+  /* "csamtools.pyx":1669
  *         self.pos = 0
  *         self.n_plp = 0
  *         self.plp = NULL             # <<<<<<<<<<<<<<
@@ -15625,12 +15668,12 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->plp = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1609
+  /* "csamtools.pyx":1670
  *         self.n_plp = 0
  *         self.plp = NULL
  *         self.pileup_iter = <bam_plp_t>NULL             # <<<<<<<<<<<<<<
  * 
- *     def __iter__(self):
+ * 
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL);
 
@@ -15648,22 +15691,22 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1611
- *         self.pileup_iter = <bam_plp_t>NULL
+/* "csamtools.pyx":1673
+ * 
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 1611);
+  __Pyx_TraceCall("__iter__", __pyx_f[0], 1673);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1612
+  /* "csamtools.pyx":1674
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -15683,7 +15726,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn___iter__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1614
+/* "csamtools.pyx":1676
  *         return self
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -15695,9 +15738,9 @@ static  int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtool
   int __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("cnext");
-  __Pyx_TraceCall("cnext", __pyx_f[0], 1614);
+  __Pyx_TraceCall("cnext", __pyx_f[0], 1676);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1620
+  /* "csamtools.pyx":1682
  *         It has been re-implemented to permit for filtering.
  *         '''
  *         self.plp = bam_plp_auto( self.pileup_iter,             # <<<<<<<<<<<<<<
@@ -15712,7 +15755,7 @@ static  int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1625
+/* "csamtools.pyx":1687
  *                                  &self.n_plp )
  * 
  *     cdef char * getSequence( self ):             # <<<<<<<<<<<<<<
@@ -15724,9 +15767,9 @@ static  char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9
   char *__pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("getSequence");
-  __Pyx_TraceCall("getSequence", __pyx_f[0], 1625);
+  __Pyx_TraceCall("getSequence", __pyx_f[0], 1687);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1628
+  /* "csamtools.pyx":1690
  *         '''return current reference sequence underlying the iterator.
  *         '''
  *         return self.iterdata.seq             # <<<<<<<<<<<<<<
@@ -15743,7 +15786,7 @@ static  char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1632
+/* "csamtools.pyx":1694
  *     property seq_len:
  *         '''current sequence length.'''
  *         def __get__(self): return self.iterdata.seq_len             # <<<<<<<<<<<<<<
@@ -15757,9 +15800,9 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1632);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 1694);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -15778,7 +15821,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1634
+/* "csamtools.pyx":1696
  *         def __get__(self): return self.iterdata.seq_len
  * 
  *     def addReference( self, Fastafile fastafile ):             # <<<<<<<<<<<<<<
@@ -15786,17 +15829,17 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject
  *        add reference sequences in *fastafile* to iterator.'''
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
-static char __pyx_doc_9csamtools_14IteratorColumn_addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n       add reference sequences in *fastafile* to iterator.";
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
+static char __pyx_doc_9csamtools_14IteratorColumn_2addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n       add reference sequences in *fastafile* to iterator.";
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("addReference");
-  __Pyx_TraceCall("addReference", __pyx_f[0], 1634);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("addReference", __pyx_f[0], 1696);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1637
+  /* "csamtools.pyx":1699
  *        '''
  *        add reference sequences in *fastafile* to iterator.'''
  *        self.fastafile = fastafile             # <<<<<<<<<<<<<<
@@ -15809,7 +15852,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__p
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_fastafile);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1638
+  /* "csamtools.pyx":1700
  *        add reference sequences in *fastafile* to iterator.'''
  *        self.fastafile = fastafile
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)             # <<<<<<<<<<<<<<
@@ -15823,7 +15866,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__p
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1639
+  /* "csamtools.pyx":1701
  *        self.fastafile = fastafile
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)
  *        self.iterdata.tid = -1             # <<<<<<<<<<<<<<
@@ -15832,7 +15875,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__p
  */
   ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.tid = -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1640
+  /* "csamtools.pyx":1702
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)
  *        self.iterdata.tid = -1
  *        self.iterdata.fastafile = self.fastafile.fastafile             # <<<<<<<<<<<<<<
@@ -15853,7 +15896,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1642
+/* "csamtools.pyx":1704
  *        self.iterdata.fastafile = self.fastafile.fastafile
  * 
  *     def hasReference( self ):             # <<<<<<<<<<<<<<
@@ -15861,15 +15904,15 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_addReference(PyObject *__p
  *         return true if iterator is associated with a reference'''
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_14IteratorColumn_hasReference[] = "IteratorColumn.hasReference(self)\n\n        return true if iterator is associated with a reference";
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_14IteratorColumn_3hasReference[] = "IteratorColumn.hasReference(self)\n\n        return true if iterator is associated with a reference";
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("hasReference");
-  __Pyx_TraceCall("hasReference", __pyx_f[0], 1642);
+  __Pyx_TraceCall("hasReference", __pyx_f[0], 1704);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1645
+  /* "csamtools.pyx":1707
  *         '''
  *         return true if iterator is associated with a reference'''
  *         return self.fastafile             # <<<<<<<<<<<<<<
@@ -15889,7 +15932,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_hasReference(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1647
+/* "csamtools.pyx":1709
  *         return self.fastafile
  * 
  *     cdef setMask( self, mask ):             # <<<<<<<<<<<<<<
@@ -15902,19 +15945,19 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("setMask");
-  __Pyx_TraceCall("setMask", __pyx_f[0], 1647);
+  __Pyx_TraceCall("setMask", __pyx_f[0], 1709);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1652
+  /* "csamtools.pyx":1714
  *         reads with bits set in *mask* will be skipped.
  *         '''
  *         self.mask = mask             # <<<<<<<<<<<<<<
  *         bam_plp_set_mask( self.pileup_iter, self.mask )
  * 
  */
-  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_mask); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_mask); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_self->mask = __pyx_t_1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1653
+  /* "csamtools.pyx":1715
  *         '''
  *         self.mask = mask
  *         bam_plp_set_mask( self.pileup_iter, self.mask )             # <<<<<<<<<<<<<<
@@ -15935,7 +15978,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1655
+/* "csamtools.pyx":1717
  *         bam_plp_set_mask( self.pileup_iter, self.mask )
  * 
  *     cdef setupIteratorData( self,             # <<<<<<<<<<<<<<
@@ -15956,30 +15999,30 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   int __pyx_t_8;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("setupIteratorData");
-  __Pyx_TraceCall("setupIteratorData", __pyx_f[0], 1655);
+  __Pyx_TraceCall("setupIteratorData", __pyx_f[0], 1717);
   if (__pyx_optional_args) {
     if (__pyx_optional_args->__pyx_n > 0) {
       __pyx_v_reopen = __pyx_optional_args->reopen;
     }
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1662
+  /* "csamtools.pyx":1724
  *         '''setup the iterator structure'''
  * 
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )             # <<<<<<<<<<<<<<
  *         self.iterdata.samfile = self.samfile.samfile
  *         self.iterdata.iter = self.iter.iter
  */
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyInt_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyInt_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
@@ -15995,16 +16038,16 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
   __Pyx_GIVEREF(__pyx_t_4);
   __Pyx_GOTREF(__pyx_v_self->iter);
   __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
   __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1663
+  /* "csamtools.pyx":1725
  * 
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
  *         self.iterdata.samfile = self.samfile.samfile             # <<<<<<<<<<<<<<
@@ -16013,7 +16056,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
  */
   __pyx_v_self->iterdata.samfile = __pyx_v_self->samfile->samfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1664
+  /* "csamtools.pyx":1726
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
  *         self.iterdata.samfile = self.samfile.samfile
  *         self.iterdata.iter = self.iter.iter             # <<<<<<<<<<<<<<
@@ -16022,7 +16065,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
  */
   __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1665
+  /* "csamtools.pyx":1727
  *         self.iterdata.samfile = self.samfile.samfile
  *         self.iterdata.iter = self.iter.iter
  *         self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
@@ -16031,7 +16074,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
  */
   __pyx_v_self->iterdata.seq = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1666
+  /* "csamtools.pyx":1728
  *         self.iterdata.iter = self.iter.iter
  *         self.iterdata.seq = NULL
  *         self.iterdata.tid = -1             # <<<<<<<<<<<<<<
@@ -16040,20 +16083,20 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
  */
   __pyx_v_self->iterdata.tid = -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1668
+  /* "csamtools.pyx":1730
  *         self.iterdata.tid = -1
  * 
  *         if self.fastafile != None:             # <<<<<<<<<<<<<<
  *             self.iterdata.fastafile = self.fastafile.fastafile
  *         else:
  */
-  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_self->fastafile), Py_None, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_self->fastafile), Py_None, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1669
+    /* "csamtools.pyx":1731
  * 
  *         if self.fastafile != None:
  *             self.iterdata.fastafile = self.fastafile.fastafile             # <<<<<<<<<<<<<<
@@ -16065,7 +16108,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1671
+    /* "csamtools.pyx":1733
  *             self.iterdata.fastafile = self.fastafile.fastafile
  *         else:
  *             self.iterdata.fastafile = NULL             # <<<<<<<<<<<<<<
@@ -16076,21 +16119,21 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1673
+  /* "csamtools.pyx":1735
  *             self.iterdata.fastafile = NULL
  * 
  *         if self.stepper == None or self.stepper == "all":             # <<<<<<<<<<<<<<
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
  *         elif self.stepper == "samtools":
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, Py_None, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, Py_None, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (!__pyx_t_6) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_8 = __pyx_t_7;
   } else {
@@ -16098,7 +16141,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   }
   if (__pyx_t_8) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1674
+    /* "csamtools.pyx":1736
  * 
  *         if self.stepper == None or self.stepper == "all":
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )             # <<<<<<<<<<<<<<
@@ -16109,20 +16152,20 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
     goto __pyx_L4;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1675
+  /* "csamtools.pyx":1737
  *         if self.stepper == None or self.stepper == "all":
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
  *         elif self.stepper == "samtools":             # <<<<<<<<<<<<<<
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
  *         else:
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_8) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1676
+    /* "csamtools.pyx":1738
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
  *         elif self.stepper == "samtools":
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )             # <<<<<<<<<<<<<<
@@ -16134,33 +16177,54 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1678
+    /* "csamtools.pyx":1740
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
  *         else:
  *             raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)             # <<<<<<<<<<<<<<
  * 
- *         bam_plp_set_mask( self.pileup_iter, self.mask )
+ *         if self.max_depth:
  */
-    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_57), __pyx_v_self->stepper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_114), __pyx_v_self->stepper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L4:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1680
+  /* "csamtools.pyx":1742
  *             raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
  * 
- *         bam_plp_set_mask( self.pileup_iter, self.mask )             # <<<<<<<<<<<<<<
+ *         if self.max_depth:             # <<<<<<<<<<<<<<
+ *             bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
+ * 
+ */
+  if (__pyx_v_self->max_depth) {
+
+    /* "csamtools.pyx":1743
+ * 
+ *         if self.max_depth:
+ *             bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )             # <<<<<<<<<<<<<<
+ * 
+ *         bam_plp_set_mask( self.pileup_iter, self.mask )
+ */
+    bam_plp_set_maxcnt(__pyx_v_self->pileup_iter, __pyx_v_self->max_depth);
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "csamtools.pyx":1745
+ *             bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
+ * 
+ *         bam_plp_set_mask( self.pileup_iter, self.mask )             # <<<<<<<<<<<<<<
  * 
  *     cdef reset( self, tid, start, end ):
  */
@@ -16183,7 +16247,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct _
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1682
+/* "csamtools.pyx":1747
  *         bam_plp_set_mask( self.pileup_iter, self.mask )
  * 
  *     cdef reset( self, tid, start, end ):             # <<<<<<<<<<<<<<
@@ -16199,17 +16263,17 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
   int __pyx_t_4;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("reset");
-  __Pyx_TraceCall("reset", __pyx_f[0], 1682);
+  __Pyx_TraceCall("reset", __pyx_f[0], 1747);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1688
+  /* "csamtools.pyx":1753
  *         having to incur the full set-up costs.
  *         '''
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 )             # <<<<<<<<<<<<<<
  *         self.iterdata.iter = self.iter.iter
  * 
  */
-  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
@@ -16222,12 +16286,12 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
   __Pyx_INCREF(__pyx_v_end);
   PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_end);
   __Pyx_GIVEREF(__pyx_v_end);
-  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_GOTREF(__pyx_v_self->iter);
@@ -16235,7 +16299,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
   __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_3);
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1689
+  /* "csamtools.pyx":1754
  *         '''
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 )
  *         self.iterdata.iter = self.iter.iter             # <<<<<<<<<<<<<<
@@ -16244,23 +16308,23 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
  */
   __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1692
+  /* "csamtools.pyx":1757
  * 
  *         # invalidate sequence if different tid
  *         if self.tid != tid:             # <<<<<<<<<<<<<<
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )
  *             self.iterdata.seq = NULL
  */
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_tid, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_tid, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1693
+    /* "csamtools.pyx":1758
  *         # invalidate sequence if different tid
  *         if self.tid != tid:
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )             # <<<<<<<<<<<<<<
@@ -16274,7 +16338,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
     }
     __pyx_L4:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1694
+    /* "csamtools.pyx":1759
  *         if self.tid != tid:
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )
  *             self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
@@ -16283,7 +16347,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
  */
     __pyx_v_self->iterdata.seq = NULL;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1695
+    /* "csamtools.pyx":1760
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )
  *             self.iterdata.seq = NULL
  *             self.iterdata.tid = -1             # <<<<<<<<<<<<<<
@@ -16295,7 +16359,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1698
+  /* "csamtools.pyx":1763
  * 
  *         # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata )
  *         bam_plp_reset(self.pileup_iter)             # <<<<<<<<<<<<<<
@@ -16319,7 +16383,7 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1700
+/* "csamtools.pyx":1765
  *         bam_plp_reset(self.pileup_iter)
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -16327,14 +16391,14 @@ static  PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9cs
  *         # not been fully consumed
  */
 
-static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self) {
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1700);
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1765);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1703
+  /* "csamtools.pyx":1768
  *         # reset in order to avoid memory leak messages for iterators that have
  *         # not been fully consumed
  *         if self.pileup_iter != <bam_plp_t>NULL:             # <<<<<<<<<<<<<<
@@ -16344,7 +16408,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter != ((bam_plp_t)NULL));
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1704
+    /* "csamtools.pyx":1769
  *         # not been fully consumed
  *         if self.pileup_iter != <bam_plp_t>NULL:
  *             bam_plp_reset(self.pileup_iter)             # <<<<<<<<<<<<<<
@@ -16353,7 +16417,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
  */
     bam_plp_reset(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1705
+    /* "csamtools.pyx":1770
  *         if self.pileup_iter != <bam_plp_t>NULL:
  *             bam_plp_reset(self.pileup_iter)
  *             bam_plp_destroy(self.pileup_iter)             # <<<<<<<<<<<<<<
@@ -16362,7 +16426,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
  */
     bam_plp_destroy(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1706
+    /* "csamtools.pyx":1771
  *             bam_plp_reset(self.pileup_iter)
  *             bam_plp_destroy(self.pileup_iter)
  *             self.pileup_iter = <bam_plp_t>NULL             # <<<<<<<<<<<<<<
@@ -16374,7 +16438,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1708
+  /* "csamtools.pyx":1773
  *             self.pileup_iter = <bam_plp_t>NULL
  * 
  *         if self.iterdata.seq != NULL:             # <<<<<<<<<<<<<<
@@ -16384,7 +16448,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
   __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1709
+    /* "csamtools.pyx":1774
  * 
  *         if self.iterdata.seq != NULL:
  *             free(self.iterdata.seq)             # <<<<<<<<<<<<<<
@@ -16393,7 +16457,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
  */
     free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1710
+    /* "csamtools.pyx":1775
  *         if self.iterdata.seq != NULL:
  *             free(self.iterdata.seq)
  *             self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
@@ -16409,7 +16473,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn___dealloc__(PyObject *__pyx_v_s
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1715
+/* "csamtools.pyx":1780
  *     '''iterates over a region only.
  *     '''
  *     def __cinit__(self, Samfile samfile,             # <<<<<<<<<<<<<<
@@ -16430,7 +16494,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1715);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1780);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
   __Pyx_GOTREF(__pyx_v_kwargs);
   if (unlikely(__pyx_kwds)) {
@@ -16466,32 +16530,32 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     if (values[1]) {
-      __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_tid = ((int)0);
     }
     if (values[2]) {
-      __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_start = ((int)0);
     }
     if (values[3]) {
-      __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
-      __pyx_v_end = __pyx_k_58;
+      __pyx_v_end = __pyx_k_115;
     }
   } else {
     __pyx_v_tid = ((int)0);
     __pyx_v_start = ((int)0);
-    __pyx_v_end = __pyx_k_58;
+    __pyx_v_end = __pyx_k_115;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  4: __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      case  3: __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1717; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      case  2: __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  4: __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  3: __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  2: __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       case  1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
       break;
       default: goto __pyx_L5_argtuple_error;
@@ -16499,16 +16563,16 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs);
   __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1722
+  /* "csamtools.pyx":1787
  * 
  *         # initialize iterator
  *         self.setupIteratorData( tid, start, end, 1 )             # <<<<<<<<<<<<<<
@@ -16517,7 +16581,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_
  */
   __pyx_t_2.__pyx_n = 1;
   __pyx_t_2.reopen = 1;
-  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_tid, __pyx_v_start, __pyx_v_end, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_tid, __pyx_v_start, __pyx_v_end, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -16534,7 +16598,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1724
+/* "csamtools.pyx":1789
  *         self.setupIteratorData( tid, start, end, 1 )
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -16542,19 +16606,18 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_20IteratorColumnRegion___next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion___next__;
-static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__;
+static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1724);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1789);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1728
+  /* "csamtools.pyx":1793
  *         """
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -16564,7 +16627,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
   while (1) {
     if (!1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1729
+    /* "csamtools.pyx":1794
  * 
  *         while 1:
  *             self.cnext()             # <<<<<<<<<<<<<<
@@ -16573,7 +16636,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
  */
     ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1730
+    /* "csamtools.pyx":1795
  *         while 1:
  *             self.cnext()
  *             if self.n_plp < 0:             # <<<<<<<<<<<<<<
@@ -16583,29 +16646,23 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
     __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp < 0);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1731
+      /* "csamtools.pyx":1796
  *             self.cnext()
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
  * 
  *             if self.plp == NULL:
  */
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_59));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1733
+    /* "csamtools.pyx":1798
  *                 raise ValueError("error during iteration" )
  * 
  *             if self.plp == NULL:             # <<<<<<<<<<<<<<
@@ -16615,7 +16672,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
     __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp == NULL);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1734
+      /* "csamtools.pyx":1799
  * 
  *             if self.plp == NULL:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -16623,12 +16680,12 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
  *             return makePileupProxy( <bam_pileup1_t*>self.plp,
  */
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1736
+    /* "csamtools.pyx":1801
  *                 raise StopIteration
  * 
  *             return makePileupProxy( <bam_pileup1_t*>self.plp,             # <<<<<<<<<<<<<<
@@ -16637,17 +16694,17 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
  */
     __Pyx_XDECREF(__pyx_r);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1739
+    /* "csamtools.pyx":1804
  *                                      self.tid,
  *                                      self.pos,
  *                                      self.n_plp )             # <<<<<<<<<<<<<<
  * 
  * cdef class IteratorColumnAllRefs(IteratorColumn):
  */
-    __pyx_t_3 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_r = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_r = __pyx_t_2;
+    __pyx_t_2 = 0;
     goto __pyx_L0;
   }
 
@@ -16655,7 +16712,6 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__next__");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -16665,7 +16721,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion___next__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1745
+/* "csamtools.pyx":1810
  *     """
  * 
  *     def __cinit__(self,             # <<<<<<<<<<<<<<
@@ -16685,7 +16741,7 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1745);
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1810);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
   __Pyx_GOTREF(__pyx_v_kwargs);
   if (unlikely(__pyx_kwds)) {
@@ -16703,7 +16759,7 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx
       else goto __pyx_L5_argtuple_error;
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
   } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
@@ -16713,35 +16769,35 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs);
   __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1750
+  /* "csamtools.pyx":1815
  * 
  *         # no iteration over empty files
  *         if not samfile.nreferences: raise StopIteration             # <<<<<<<<<<<<<<
  * 
  *         # initialize iterator
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_3 = (!__pyx_t_2);
   if (__pyx_t_3) {
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1753
+  /* "csamtools.pyx":1818
  * 
  *         # initialize iterator
  *         self.setupIteratorData( self.tid, 0, max_pos, 1 )             # <<<<<<<<<<<<<<
@@ -16750,7 +16806,7 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx
  */
   __pyx_t_4.__pyx_n = 1;
   __pyx_t_4.reopen = 1;
-  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -16767,7 +16823,7 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1755
+/* "csamtools.pyx":1820
  *         self.setupIteratorData( self.tid, 0, max_pos, 1 )
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -16775,10 +16831,10 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_21IteratorColumnAllRefs___next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs___next__;
-static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__;
+static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
@@ -16787,9 +16843,9 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
   struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 1755);
+  __Pyx_TraceCall("__next__", __pyx_f[0], 1820);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1759
+  /* "csamtools.pyx":1824
  *         """
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -16799,7 +16855,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
   while (1) {
     if (!1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1760
+    /* "csamtools.pyx":1825
  * 
  *         while 1:
  *             self.cnext()             # <<<<<<<<<<<<<<
@@ -16808,7 +16864,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
  */
     ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1762
+    /* "csamtools.pyx":1827
  *             self.cnext()
  * 
  *             if self.n_plp < 0:             # <<<<<<<<<<<<<<
@@ -16818,29 +16874,23 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
     __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp < 0);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1763
+      /* "csamtools.pyx":1828
  * 
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
  * 
  *             # return result, if within same reference
  */
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_59));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1766
+    /* "csamtools.pyx":1831
  * 
  *             # return result, if within same reference
  *             if self.plp != NULL:             # <<<<<<<<<<<<<<
@@ -16850,7 +16900,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
     __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp != NULL);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1767
+      /* "csamtools.pyx":1832
  *             # return result, if within same reference
  *             if self.plp != NULL:
  *                 return makePileupProxy( <bam_pileup1_t*>self.plp,             # <<<<<<<<<<<<<<
@@ -16859,51 +16909,51 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
  */
       __Pyx_XDECREF(__pyx_r);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1770
+      /* "csamtools.pyx":1835
  *                                          self.tid,
  *                                          self.pos,
  *                                          self.n_plp )             # <<<<<<<<<<<<<<
  * 
  *             # otherwise, proceed to next reference or stop
  */
-      __pyx_t_3 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_r = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_r = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L0;
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1773
+    /* "csamtools.pyx":1838
  * 
  *             # otherwise, proceed to next reference or stop
  *             self.tid += 1             # <<<<<<<<<<<<<<
  *             if self.tid < self.samfile.nreferences:
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )
  */
-    ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid += 1;
+    ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid + 1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1774
+    /* "csamtools.pyx":1839
  *             # otherwise, proceed to next reference or stop
  *             self.tid += 1
  *             if self.tid < self.samfile.nreferences:             # <<<<<<<<<<<<<<
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )
  *             else:
  */
-    __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1775
+      /* "csamtools.pyx":1840
  *             self.tid += 1
  *             if self.tid < self.samfile.nreferences:
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )             # <<<<<<<<<<<<<<
@@ -16912,14 +16962,14 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
  */
       __pyx_t_5.__pyx_n = 1;
       __pyx_t_5.reopen = 0;
-      __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       goto __pyx_L9;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1777
+      /* "csamtools.pyx":1842
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )
  *             else:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -16927,7 +16977,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
  * ##-------------------------------------------------------------------
  */
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L9:;
   }
@@ -16947,7 +16997,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__(PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1782
+/* "csamtools.pyx":1847
  * ##-------------------------------------------------------------------
  * ##-------------------------------------------------------------------
  * cdef inline int32_t query_start(bam1_t *src) except -1:             # <<<<<<<<<<<<<<
@@ -16967,9 +17017,9 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
   int __pyx_t_4;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("query_start");
-  __Pyx_TraceCall("query_start", __pyx_f[0], 1782);
+  __Pyx_TraceCall("query_start", __pyx_f[0], 1847);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1785
+  /* "csamtools.pyx":1850
  *     cdef uint32_t * cigar_p, op
  *     cdef uint32_t k
  *     cdef uint32_t start_offset = 0             # <<<<<<<<<<<<<<
@@ -16978,7 +17028,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
  */
   __pyx_v_start_offset = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1787
+  /* "csamtools.pyx":1852
  *     cdef uint32_t start_offset = 0
  * 
  *     if src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -16987,7 +17037,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
  */
   if (__pyx_v_src->core.n_cigar) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1788
+    /* "csamtools.pyx":1853
  * 
  *     if src.core.n_cigar:
  *         cigar_p = bam1_cigar(src);             # <<<<<<<<<<<<<<
@@ -16996,7 +17046,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
  */
     __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1789
+    /* "csamtools.pyx":1854
  *     if src.core.n_cigar:
  *         cigar_p = bam1_cigar(src);
  *         for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -17006,7 +17056,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
     __pyx_t_1 = __pyx_v_src->core.n_cigar;
     for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1790
+      /* "csamtools.pyx":1855
  *         cigar_p = bam1_cigar(src);
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -17015,17 +17065,25 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
  */
       __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1791
+      /* "csamtools.pyx":1860
+ *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
+ *                     return -1
+ *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
+ *                 start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
+ *             else:
+ */
+      switch (__pyx_v_op) {
+
+        /* "csamtools.pyx":1856
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:             # <<<<<<<<<<<<<<
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  */
-      switch (__pyx_v_op) {
         case 5:
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1792
+        /* "csamtools.pyx":1857
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:             # <<<<<<<<<<<<<<
@@ -17041,16 +17099,16 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
         }
         if (__pyx_t_4) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1793
+          /* "csamtools.pyx":1858
  *             if op==BAM_CHARD_CLIP:
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')             # <<<<<<<<<<<<<<
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  */
-          PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_60);
+          PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_119);
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1794
+          /* "csamtools.pyx":1859
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1             # <<<<<<<<<<<<<<
@@ -17064,7 +17122,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
         __pyx_L6:;
         break;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1795
+        /* "csamtools.pyx":1860
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
@@ -17073,18 +17131,18 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
  */
         case 4:
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1796
+        /* "csamtools.pyx":1861
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  *                 start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  *             else:
  *                 break
  */
-        __pyx_v_start_offset += ((__pyx_v_cigar_p[__pyx_v_k]) >> 4);
+        __pyx_v_start_offset = (__pyx_v_start_offset + ((__pyx_v_cigar_p[__pyx_v_k]) >> 4));
         break;
         default:
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1798
+        /* "csamtools.pyx":1863
  *                 start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
  *             else:
  *                 break             # <<<<<<<<<<<<<<
@@ -17100,7 +17158,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1800
+  /* "csamtools.pyx":1865
  *                 break
  * 
  *     return start_offset             # <<<<<<<<<<<<<<
@@ -17117,7 +17175,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1805
+/* "csamtools.pyx":1870
  * ##-------------------------------------------------------------------
  * ##-------------------------------------------------------------------
  * cdef inline int32_t query_end(bam1_t *src) except -1:             # <<<<<<<<<<<<<<
@@ -17136,9 +17194,9 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   int __pyx_t_3;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("query_end");
-  __Pyx_TraceCall("query_end", __pyx_f[0], 1805);
+  __Pyx_TraceCall("query_end", __pyx_f[0], 1870);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1808
+  /* "csamtools.pyx":1873
  *     cdef uint32_t * cigar_p, op
  *     cdef uint32_t k
  *     cdef uint32_t end_offset = src.core.l_qseq             # <<<<<<<<<<<<<<
@@ -17147,7 +17205,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
  */
   __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1810
+  /* "csamtools.pyx":1875
  *     cdef uint32_t end_offset = src.core.l_qseq
  * 
  *     if src.core.n_cigar>1:             # <<<<<<<<<<<<<<
@@ -17157,7 +17215,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   __pyx_t_1 = (__pyx_v_src->core.n_cigar > 1);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1811
+    /* "csamtools.pyx":1876
  * 
  *     if src.core.n_cigar>1:
  *         cigar_p = bam1_cigar(src);             # <<<<<<<<<<<<<<
@@ -17166,7 +17224,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
  */
     __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1812
+    /* "csamtools.pyx":1877
  *     if src.core.n_cigar>1:
  *         cigar_p = bam1_cigar(src);
  *         for k from src.core.n_cigar > k >= 1:             # <<<<<<<<<<<<<<
@@ -17175,7 +17233,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
  */
     for (__pyx_v_k = __pyx_v_src->core.n_cigar-1; __pyx_v_k >= 1; __pyx_v_k--) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1813
+      /* "csamtools.pyx":1878
  *         cigar_p = bam1_cigar(src);
  *         for k from src.core.n_cigar > k >= 1:
  *             op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -17184,17 +17242,25 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
  */
       __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1814
+      /* "csamtools.pyx":1883
+ *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
+ *                     return -1
+ *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
+ *                 end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
+ *             else:
+ */
+      switch (__pyx_v_op) {
+
+        /* "csamtools.pyx":1879
  *         for k from src.core.n_cigar > k >= 1:
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:             # <<<<<<<<<<<<<<
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  */
-      switch (__pyx_v_op) {
         case 5:
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1815
+        /* "csamtools.pyx":1880
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:             # <<<<<<<<<<<<<<
@@ -17210,16 +17276,16 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
         }
         if (__pyx_t_3) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1816
+          /* "csamtools.pyx":1881
  *             if op==BAM_CHARD_CLIP:
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')             # <<<<<<<<<<<<<<
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  */
-          PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_60);
+          PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_119);
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1817
+          /* "csamtools.pyx":1882
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1             # <<<<<<<<<<<<<<
@@ -17233,7 +17299,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
         __pyx_L6:;
         break;
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1818
+        /* "csamtools.pyx":1883
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
@@ -17242,18 +17308,18 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
  */
         case 4:
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1819
+        /* "csamtools.pyx":1884
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  *                 end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  *             else:
  *                 break
  */
-        __pyx_v_end_offset -= ((__pyx_v_cigar_p[__pyx_v_k]) >> 4);
+        __pyx_v_end_offset = (__pyx_v_end_offset - ((__pyx_v_cigar_p[__pyx_v_k]) >> 4));
         break;
         default:
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1821
+        /* "csamtools.pyx":1886
  *                 end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
  *             else:
  *                 break             # <<<<<<<<<<<<<<
@@ -17269,7 +17335,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1823
+  /* "csamtools.pyx":1888
  *                 break
  * 
  *     if end_offset==0:             # <<<<<<<<<<<<<<
@@ -17279,7 +17345,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   __pyx_t_3 = (__pyx_v_end_offset == 0);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1824
+    /* "csamtools.pyx":1889
  * 
  *     if end_offset==0:
  *         end_offset = src.core.l_qseq             # <<<<<<<<<<<<<<
@@ -17291,7 +17357,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1826
+  /* "csamtools.pyx":1891
  *         end_offset = src.core.l_qseq
  * 
  *     return end_offset             # <<<<<<<<<<<<<<
@@ -17308,7 +17374,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1829
+/* "csamtools.pyx":1894
  * 
  * 
  * cdef inline object get_seq_range(bam1_t *src, uint32_t start, uint32_t end):             # <<<<<<<<<<<<<<
@@ -17327,10 +17393,10 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
   uint32_t __pyx_t_3;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("get_seq_range");
-  __Pyx_TraceCall("get_seq_range", __pyx_f[0], 1829);
+  __Pyx_TraceCall("get_seq_range", __pyx_f[0], 1894);
   __pyx_v_seq = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1834
+  /* "csamtools.pyx":1899
  *     cdef char * s
  * 
  *     if not src.core.l_qseq:             # <<<<<<<<<<<<<<
@@ -17340,7 +17406,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
   __pyx_t_1 = (!__pyx_v_src->core.l_qseq);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1835
+    /* "csamtools.pyx":1900
  * 
  *     if not src.core.l_qseq:
  *         return None             # <<<<<<<<<<<<<<
@@ -17355,20 +17421,20 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1837
+  /* "csamtools.pyx":1902
  *         return None
  * 
  *     seq = PyString_FromStringAndSize(NULL, end-start)             # <<<<<<<<<<<<<<
  *     s   = PyString_AS_STRING(seq)
  *     p   = bam1_seq(src)
  */
-  __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_seq);
   __pyx_v_seq = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1838
+  /* "csamtools.pyx":1903
  * 
  *     seq = PyString_FromStringAndSize(NULL, end-start)
  *     s   = PyString_AS_STRING(seq)             # <<<<<<<<<<<<<<
@@ -17377,7 +17443,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
  */
   __pyx_v_s = PyString_AS_STRING(__pyx_v_seq);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1839
+  /* "csamtools.pyx":1904
  *     seq = PyString_FromStringAndSize(NULL, end-start)
  *     s   = PyString_AS_STRING(seq)
  *     p   = bam1_seq(src)             # <<<<<<<<<<<<<<
@@ -17386,7 +17452,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
  */
   __pyx_v_p = bam1_seq(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1841
+  /* "csamtools.pyx":1906
  *     p   = bam1_seq(src)
  * 
  *     for k from start <= k < end:             # <<<<<<<<<<<<<<
@@ -17396,7 +17462,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
   __pyx_t_3 = __pyx_v_end;
   for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1844
+    /* "csamtools.pyx":1909
  *         # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c)
  *         # note: do not use string literal as it will be a python string
  *         s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf]             # <<<<<<<<<<<<<<
@@ -17406,7 +17472,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
     (__pyx_v_s[(__pyx_v_k - __pyx_v_start)]) = (__pyx_v_9csamtools_bam_nt16_rev_table[(((__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) >> (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))) & 0xf)]);
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1846
+  /* "csamtools.pyx":1911
  *         s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf]
  * 
  *     return seq             # <<<<<<<<<<<<<<
@@ -17432,7 +17498,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1849
+/* "csamtools.pyx":1914
  * 
  * 
  * cdef inline object get_qual_range(bam1_t *src, uint32_t start, uint32_t end):             # <<<<<<<<<<<<<<
@@ -17451,10 +17517,10 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   uint32_t __pyx_t_3;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("get_qual_range");
-  __Pyx_TraceCall("get_qual_range", __pyx_f[0], 1849);
+  __Pyx_TraceCall("get_qual_range", __pyx_f[0], 1914);
   __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1854
+  /* "csamtools.pyx":1919
  *     cdef char * q
  * 
  *     p = bam1_qual(src)             # <<<<<<<<<<<<<<
@@ -17463,7 +17529,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
  */
   __pyx_v_p = bam1_qual(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1855
+  /* "csamtools.pyx":1920
  * 
  *     p = bam1_qual(src)
  *     if p[0] == 0xff:             # <<<<<<<<<<<<<<
@@ -17473,7 +17539,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   __pyx_t_1 = ((__pyx_v_p[0]) == 0xff);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1856
+    /* "csamtools.pyx":1921
  *     p = bam1_qual(src)
  *     if p[0] == 0xff:
  *         return None             # <<<<<<<<<<<<<<
@@ -17488,20 +17554,20 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   }
   __pyx_L3:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1858
+  /* "csamtools.pyx":1923
  *         return None
  * 
  *     qual = PyString_FromStringAndSize(NULL, end-start)             # <<<<<<<<<<<<<<
  *     q    = PyString_AS_STRING(qual)
  * 
  */
-  __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_qual);
   __pyx_v_qual = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1859
+  /* "csamtools.pyx":1924
  * 
  *     qual = PyString_FromStringAndSize(NULL, end-start)
  *     q    = PyString_AS_STRING(qual)             # <<<<<<<<<<<<<<
@@ -17510,7 +17576,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
  */
   __pyx_v_q = PyString_AS_STRING(__pyx_v_qual);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1861
+  /* "csamtools.pyx":1926
  *     q    = PyString_AS_STRING(qual)
  * 
  *     for k from start <= k < end:             # <<<<<<<<<<<<<<
@@ -17520,7 +17586,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   __pyx_t_3 = __pyx_v_end;
   for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1863
+    /* "csamtools.pyx":1928
  *     for k from start <= k < end:
  *         ## equivalent to t[i] + 33 (see bam.c)
  *         q[k-start] = p[k] + 33             # <<<<<<<<<<<<<<
@@ -17530,7 +17596,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
     (__pyx_v_q[(__pyx_v_k - __pyx_v_start)]) = ((__pyx_v_p[__pyx_v_k]) + 33);
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1865
+  /* "csamtools.pyx":1930
  *         q[k-start] = p[k] + 33
  * 
  *     return qual             # <<<<<<<<<<<<<<
@@ -17556,7 +17622,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1890
+/* "csamtools.pyx":1955
  * 
  *     # Now only called when instances are created from Python
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -17569,12 +17635,12 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, Py
   int __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__init__");
-  __Pyx_TraceCall("__init__", __pyx_f[0], 1890);
+  __Pyx_TraceCall("__init__", __pyx_f[0], 1955);
   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1892
+  /* "csamtools.pyx":1957
  *     def __init__(self):
  *         # see bam_init1
  *         self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) )             # <<<<<<<<<<<<<<
@@ -17583,7 +17649,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, Py
  */
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1896
+  /* "csamtools.pyx":1961
  *         # If size is 0, calloc does not return a pointer that can be passed to free()
  *         # so allocate 40 bytes for a new read
  *         self._delegate.m_data = 40             # <<<<<<<<<<<<<<
@@ -17592,7 +17658,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, Py
  */
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data = 40;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1897
+  /* "csamtools.pyx":1962
  *         # so allocate 40 bytes for a new read
  *         self._delegate.m_data = 40
  *         self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )             # <<<<<<<<<<<<<<
@@ -17601,7 +17667,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, Py
  */
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data = ((uint8_t *)calloc(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data, 1));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1898
+  /* "csamtools.pyx":1963
  *         self._delegate.m_data = 40
  *         self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
  *         self._delegate.data_len = 0             # <<<<<<<<<<<<<<
@@ -17616,7 +17682,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1900
+/* "csamtools.pyx":1965
  *         self._delegate.data_len = 0
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -17624,13 +17690,13 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, Py
  * 
  */
 
-static void __pyx_pf_9csamtools_11AlignedRead___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_11AlignedRead___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1900);
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1965);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1901
+  /* "csamtools.pyx":1966
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self._delegate)             # <<<<<<<<<<<<<<
@@ -17643,7 +17709,7 @@ static void __pyx_pf_9csamtools_11AlignedRead___dealloc__(PyObject *__pyx_v_self
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1903
+/* "csamtools.pyx":1968
  *         bam_destroy1(self._delegate)
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -17651,10 +17717,10 @@ static void __pyx_pf_9csamtools_11AlignedRead___dealloc__(PyObject *__pyx_v_self
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead___str__[] = "return string representation of alignment.\n\n        The representation is an approximate :term:`sam` format.\n\n        An aligned read might not be associated with a :term:`Samfile`.\n        As a result :term:`tid` is shown instead of the reference name.\n\n        Similarly, the tags field is returned in its parsed state.\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead___str__;
-static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_2__str__[] = "return string representation of alignment.\n\n        The representation is an approximate :term:`sam` format.\n\n        An aligned read might not be associated with a :term:`Samfile`.\n        As a result :term:`tid` is shown instead of the reference name.\n\n        Similarly, the tags field is returned in its parsed state.\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__;
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -17672,9 +17738,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_sel
   PyObject *__pyx_t_14 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__str__");
-  __Pyx_TraceCall("__str__", __pyx_f[0], 1903);
+  __Pyx_TraceCall("__str__", __pyx_f[0], 1968);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1915
+  /* "csamtools.pyx":1980
  *         # sam-parsing is done in sam.c/bam_format1_core which
  *         # requires a valid header.
  *         return "\t".join(map(str, (self.qname,             # <<<<<<<<<<<<<<
@@ -17682,122 +17748,122 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_sel
  *                                    self.rname,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1916
+  /* "csamtools.pyx":1981
  *         # requires a valid header.
  *         return "\t".join(map(str, (self.qname,
  *                                    self.flag,             # <<<<<<<<<<<<<<
  *                                    self.rname,
  *                                    self.pos,
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1917
+  /* "csamtools.pyx":1982
  *         return "\t".join(map(str, (self.qname,
  *                                    self.flag,
  *                                    self.rname,             # <<<<<<<<<<<<<<
  *                                    self.pos,
  *                                    self.mapq,
  */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1918
+  /* "csamtools.pyx":1983
  *                                    self.flag,
  *                                    self.rname,
  *                                    self.pos,             # <<<<<<<<<<<<<<
  *                                    self.mapq,
  *                                    self.cigar,
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1919
+  /* "csamtools.pyx":1984
  *                                    self.rname,
  *                                    self.pos,
  *                                    self.mapq,             # <<<<<<<<<<<<<<
  *                                    self.cigar,
  *                                    self.mrnm,
  */
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapq); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapq); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1920
+  /* "csamtools.pyx":1985
  *                                    self.pos,
  *                                    self.mapq,
  *                                    self.cigar,             # <<<<<<<<<<<<<<
  *                                    self.mrnm,
  *                                    self.mpos,
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cigar); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cigar); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1921
+  /* "csamtools.pyx":1986
  *                                    self.mapq,
  *                                    self.cigar,
  *                                    self.mrnm,             # <<<<<<<<<<<<<<
  *                                    self.mpos,
  *                                    self.rlen,
  */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mrnm); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mrnm); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1922
+  /* "csamtools.pyx":1987
  *                                    self.cigar,
  *                                    self.mrnm,
  *                                    self.mpos,             # <<<<<<<<<<<<<<
  *                                    self.rlen,
  *                                    self.seq,
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mpos); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mpos); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1923
+  /* "csamtools.pyx":1988
  *                                    self.mrnm,
  *                                    self.mpos,
  *                                    self.rlen,             # <<<<<<<<<<<<<<
  *                                    self.seq,
  *                                    self.qual,
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1924
+  /* "csamtools.pyx":1989
  *                                    self.mpos,
  *                                    self.rlen,
  *                                    self.seq,             # <<<<<<<<<<<<<<
  *                                    self.qual,
  *                                    self.tags )))
  */
-  __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seq); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seq); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_11);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1925
+  /* "csamtools.pyx":1990
  *                                    self.rlen,
  *                                    self.seq,
  *                                    self.qual,             # <<<<<<<<<<<<<<
  *                                    self.tags )))
  * 
  */
-  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qual); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qual); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1926
+  /* "csamtools.pyx":1991
  *                                    self.seq,
  *                                    self.qual,
  *                                    self.tags )))             # <<<<<<<<<<<<<<
  * 
  *     def compare(self, AlignedRead other):
  */
-  __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tags); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tags); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = PyTuple_New(12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_14);
+  __pyx_t_14 = PyTuple_New(12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
   PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3);
@@ -17834,26 +17900,26 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_sel
   __pyx_t_11 = 0;
   __pyx_t_12 = 0;
   __pyx_t_13 = 0;
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __Pyx_GIVEREF(__pyx_t_14);
+  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_t_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
   __pyx_t_14 = 0;
-  __pyx_t_14 = PyObject_Call(__pyx_builtin_map, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14);
   __Pyx_GIVEREF(__pyx_t_14);
   __pyx_t_14 = 0;
-  __pyx_t_14 = PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
   __pyx_r = __pyx_t_14;
   __pyx_t_14 = 0;
   goto __pyx_L0;
@@ -17884,7 +17950,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1928
+/* "csamtools.pyx":1993
  *                                    self.tags )))
  * 
  *     def compare(self, AlignedRead other):             # <<<<<<<<<<<<<<
@@ -17892,9 +17958,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead___str__(PyObject *__pyx_v_sel
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_3compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
   int __pyx_v_retval;
   bam1_t *__pyx_v_t;
   bam1_t *__pyx_v_o;
@@ -17906,10 +17972,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
   int __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("compare");
-  __Pyx_TraceCall("compare", __pyx_f[0], 1928);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("compare", __pyx_f[0], 1993);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1934
+  /* "csamtools.pyx":1999
  *         cdef bam1_t *t, *o
  * 
  *         t = self._delegate             # <<<<<<<<<<<<<<
@@ -17918,7 +17984,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  */
   __pyx_v_t = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1935
+  /* "csamtools.pyx":2000
  * 
  *         t = self._delegate
  *         o = other._delegate             # <<<<<<<<<<<<<<
@@ -17927,7 +17993,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  */
   __pyx_v_o = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1947
+  /* "csamtools.pyx":2012
  * 
  *         # Fast-path test for object identity
  *         if t==o:             # <<<<<<<<<<<<<<
@@ -17937,7 +18003,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
   __pyx_t_1 = (__pyx_v_t == __pyx_v_o);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1948
+    /* "csamtools.pyx":2013
  *         # Fast-path test for object identity
  *         if t==o:
  *             return 0             # <<<<<<<<<<<<<<
@@ -17952,7 +18018,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1950
+  /* "csamtools.pyx":2015
  *             return 0
  * 
  *         retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))             # <<<<<<<<<<<<<<
@@ -17961,7 +18027,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  */
   __pyx_v_retval = memcmp((&__pyx_v_t->core), (&__pyx_v_o->core), (sizeof(bam1_core_t)));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1952
+  /* "csamtools.pyx":2017
  *         retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))
  * 
  *         if retval: return retval             # <<<<<<<<<<<<<<
@@ -17970,7 +18036,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  */
   if (__pyx_v_retval) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -17979,33 +18045,33 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1953
+  /* "csamtools.pyx":2018
  * 
  *         if retval: return retval
  *         retval = cmp(t.data_len, o.data_len)             # <<<<<<<<<<<<<<
  *         if retval: return retval
  *         return memcmp(t.data, o.data, t.data_len)
  */
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_t->data_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_t->data_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_o->data_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(__pyx_v_o->data_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_v_retval = __pyx_t_5;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1954
+  /* "csamtools.pyx":2019
  *         if retval: return retval
  *         retval = cmp(t.data_len, o.data_len)
  *         if retval: return retval             # <<<<<<<<<<<<<<
@@ -18014,7 +18080,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  */
   if (__pyx_v_retval) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_r = __pyx_t_3;
     __pyx_t_3 = 0;
@@ -18023,7 +18089,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1955
+  /* "csamtools.pyx":2020
  *         retval = cmp(t.data_len, o.data_len)
  *         if retval: return retval
  *         return memcmp(t.data, o.data, t.data_len)             # <<<<<<<<<<<<<<
@@ -18031,7 +18097,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  *     # Disabled so long as __cmp__ is a special method
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -18052,7 +18118,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1958
+/* "csamtools.pyx":2023
  * 
  *     # Disabled so long as __cmp__ is a special method
  *     def __hash__(self):             # <<<<<<<<<<<<<<
@@ -18060,14 +18126,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_compare(PyObject *__pyx_v_sel
  * 
  */
 
-static long __pyx_pf_9csamtools_11AlignedRead___hash__(PyObject *__pyx_v_self); /*proto*/
-static long __pyx_pf_9csamtools_11AlignedRead___hash__(PyObject *__pyx_v_self) {
+static long __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self); /*proto*/
+static long __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self) {
   long __pyx_r;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__hash__");
-  __Pyx_TraceCall("__hash__", __pyx_f[0], 1958);
+  __Pyx_TraceCall("__hash__", __pyx_f[0], 2023);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1959
+  /* "csamtools.pyx":2024
  *     # Disabled so long as __cmp__ is a special method
  *     def __hash__(self):
  *         return _Py_HashPointer(<void *>self)             # <<<<<<<<<<<<<<
@@ -18085,7 +18151,7 @@ static long __pyx_pf_9csamtools_11AlignedRead___hash__(PyObject *__pyx_v_self) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1963
+/* "csamtools.pyx":2028
  *     property qname:
  *         """the query name (None if not present)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -18101,9 +18167,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__py
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1963);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2028);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1965
+  /* "csamtools.pyx":2030
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18112,7 +18178,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__py
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1966
+  /* "csamtools.pyx":2031
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if src.core.l_qname == 0: return None             # <<<<<<<<<<<<<<
@@ -18129,7 +18195,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__py
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1967
+  /* "csamtools.pyx":2032
  *             src = self._delegate
  *             if src.core.l_qname == 0: return None
  *             return <char *>bam1_qname( src )             # <<<<<<<<<<<<<<
@@ -18137,7 +18203,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__py
  *         def __set__(self, qname ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString(bam1_qname(__pyx_v_src)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(bam1_qname(__pyx_v_src)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
@@ -18156,7 +18222,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1969
+/* "csamtools.pyx":2034
  *             return <char *>bam1_qname( src )
  * 
  *         def __set__(self, qname ):             # <<<<<<<<<<<<<<
@@ -18164,8 +18230,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__py
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
+static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
   bam1_t *__pyx_v_src;
   int __pyx_v_l;
   char *__pyx_v_p;
@@ -18178,21 +18244,21 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
   char *__pyx_t_6;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 1969);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2034);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1970
+  /* "csamtools.pyx":2035
  * 
  *         def __set__(self, qname ):
  *             if qname == None or len(qname) == 0: return             # <<<<<<<<<<<<<<
  *             cdef bam1_t * src
  *             cdef int l
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
-    __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (__pyx_t_3 == 0);
     __pyx_t_5 = __pyx_t_4;
   } else {
@@ -18205,7 +18271,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1975
+  /* "csamtools.pyx":2040
  *             cdef char * p
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18214,7 +18280,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1976
+  /* "csamtools.pyx":2041
  * 
  *             src = self._delegate
  *             p = bam1_qname( src )             # <<<<<<<<<<<<<<
@@ -18223,17 +18289,17 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
  */
   __pyx_v_p = bam1_qname(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1979
+  /* "csamtools.pyx":2044
  * 
  *             # the qname is \0 terminated
  *             l = len(qname) + 1             # <<<<<<<<<<<<<<
  *             pysam_bam_update( src,
  *                               src.core.l_qname,
  */
-  __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_l = (__pyx_t_3 + 1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1983
+  /* "csamtools.pyx":2048
  *                               src.core.l_qname,
  *                               l,
  *                               <uint8_t*>p )             # <<<<<<<<<<<<<<
@@ -18242,7 +18308,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
  */
   pysam_bam_update(__pyx_v_src, __pyx_v_src->core.l_qname, __pyx_v_l, ((uint8_t *)__pyx_v_p));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1985
+  /* "csamtools.pyx":2050
  *                               <uint8_t*>p )
  * 
  *             src.core.l_qname = l             # <<<<<<<<<<<<<<
@@ -18251,7 +18317,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
  */
   __pyx_v_src->core.l_qname = __pyx_v_l;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1989
+  /* "csamtools.pyx":2054
  *             # re-acquire pointer to location in memory
  *             # as it might have moved
  *             p = bam1_qname(src)             # <<<<<<<<<<<<<<
@@ -18260,14 +18326,14 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
  */
   __pyx_v_p = bam1_qname(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1991
+  /* "csamtools.pyx":2056
  *             p = bam1_qname(src)
  * 
  *             strncpy( p, qname, l )             # <<<<<<<<<<<<<<
  * 
  *     property cigar:
  */
-  __pyx_t_6 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   strncpy(__pyx_v_p, __pyx_t_6, __pyx_v_l);
 
   __pyx_r = 0;
@@ -18282,7 +18348,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname___set__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1996
+/* "csamtools.pyx":2061
  *         """the :term:`cigar` alignment (None if not present).
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -18305,12 +18371,12 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
   PyObject *__pyx_t_4 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 1996);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2061);
   __pyx_v_op = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_cigar = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2002
+  /* "csamtools.pyx":2067
  *             cdef int k
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18319,7 +18385,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2003
+  /* "csamtools.pyx":2068
  * 
  *             src = self._delegate
  *             if src.core.n_cigar == 0: return None             # <<<<<<<<<<<<<<
@@ -18336,20 +18402,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2005
+  /* "csamtools.pyx":2070
  *             if src.core.n_cigar == 0: return None
  * 
  *             cigar = []             # <<<<<<<<<<<<<<
  *             cigar_p = bam1_cigar(src);
  *             for k from 0 <= k < src.core.n_cigar:
  */
-  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(__pyx_v_cigar);
   __pyx_v_cigar = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2006
+  /* "csamtools.pyx":2071
  * 
  *             cigar = []
  *             cigar_p = bam1_cigar(src);             # <<<<<<<<<<<<<<
@@ -18358,7 +18424,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2007
+  /* "csamtools.pyx":2072
  *             cigar = []
  *             cigar_p = bam1_cigar(src);
  *             for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -18368,54 +18434,54 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
   __pyx_t_3 = __pyx_v_src->core.n_cigar;
   for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2008
+    /* "csamtools.pyx":2073
  *             cigar_p = bam1_cigar(src);
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 cigar.append((op, l))
  */
-    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) & 15)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) & 15)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_op);
     __pyx_v_op = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2009
+    /* "csamtools.pyx":2074
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  *                 cigar.append((op, l))
  *             return cigar
  */
-    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_l);
     __pyx_v_l = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2010
+    /* "csamtools.pyx":2075
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 cigar.append((op, l))             # <<<<<<<<<<<<<<
  *             return cigar
  * 
  */
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_op);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_op);
     __Pyx_GIVEREF(__pyx_v_op);
     __Pyx_INCREF(__pyx_v_l);
     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_l);
     __Pyx_GIVEREF(__pyx_v_l);
-    __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_cigar, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_cigar, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2011
+  /* "csamtools.pyx":2076
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 cigar.append((op, l))
  *             return cigar             # <<<<<<<<<<<<<<
@@ -18444,7 +18510,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2013
+/* "csamtools.pyx":2078
  *             return cigar
  * 
  *         def __set__(self, values ):             # <<<<<<<<<<<<<<
@@ -18452,8 +18518,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__py
  *             cdef uint32_t * p
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
+static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
   uint32_t *__pyx_v_p;
   bam1_t *__pyx_v_src;
   PyObject *__pyx_v_op;
@@ -18472,23 +18538,23 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
   uint32_t __pyx_t_10;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2013);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2078);
   __pyx_v_op = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2014
+  /* "csamtools.pyx":2079
  * 
  *         def __set__(self, values ):
  *             if values == None or len(values) == 0: return             # <<<<<<<<<<<<<<
  *             cdef uint32_t * p
  *             cdef bam1_t * src
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
-    __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (__pyx_t_3 == 0);
     __pyx_t_5 = __pyx_t_4;
   } else {
@@ -18501,7 +18567,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2020
+  /* "csamtools.pyx":2085
  *             cdef int k
  * 
  *             k = 0             # <<<<<<<<<<<<<<
@@ -18510,7 +18576,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
  */
   __pyx_v_k = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2022
+  /* "csamtools.pyx":2087
  *             k = 0
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18519,7 +18585,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2025
+  /* "csamtools.pyx":2090
  * 
  *             # get location of cigar string
  *             p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -18528,16 +18594,16 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
  */
   __pyx_v_p = bam1_cigar(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2030
+  /* "csamtools.pyx":2095
  *             pysam_bam_update( src,
  *                               src.core.n_cigar * 4,
  *                               len(values) * 4,             # <<<<<<<<<<<<<<
  *                               <uint8_t*>p )
  * 
  */
-  __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2031
+  /* "csamtools.pyx":2096
  *                               src.core.n_cigar * 4,
  *                               len(values) * 4,
  *                               <uint8_t*>p )             # <<<<<<<<<<<<<<
@@ -18546,17 +18612,17 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
  */
   pysam_bam_update(__pyx_v_src, (__pyx_v_src->core.n_cigar * 4), (__pyx_t_3 * 4), ((uint8_t *)__pyx_v_p));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2034
+  /* "csamtools.pyx":2099
  * 
  *             # length is number of cigar operations, not bytes
  *             src.core.n_cigar = len(values)             # <<<<<<<<<<<<<<
  * 
  *             # re-acquire pointer to location in memory
  */
-  __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_src->core.n_cigar = __pyx_t_3;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2038
+  /* "csamtools.pyx":2103
  *             # re-acquire pointer to location in memory
  *             # as it might have moved
  *             p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -18565,7 +18631,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
  */
   __pyx_v_p = bam1_cigar(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2041
+  /* "csamtools.pyx":2106
  * 
  *             # insert cigar operations
  *             for op, l in values:             # <<<<<<<<<<<<<<
@@ -18575,7 +18641,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
   if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
     __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1);
   } else {
-    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
   }
   for (;;) {
@@ -18588,7 +18654,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
     } else {
       __pyx_t_6 = PyIter_Next(__pyx_t_1);
       if (!__pyx_t_6) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
       __Pyx_GOTREF(__pyx_t_6);
@@ -18605,14 +18671,14 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
       __pyx_v_l = __pyx_t_8;
       __pyx_t_8 = 0;
     } else {
-      __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_v_op);
       __pyx_v_op = __pyx_t_7;
@@ -18622,34 +18688,34 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
       __pyx_t_8 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2042
+    /* "csamtools.pyx":2107
  *             # insert cigar operations
  *             for op, l in values:
  *                 p[k] = l << BAM_CIGAR_SHIFT | op             # <<<<<<<<<<<<<<
  *                 k += 1
  * 
  */
-    __pyx_t_6 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_8 = PyNumber_Or(__pyx_t_6, __pyx_v_op); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyNumber_Or(__pyx_t_6, __pyx_v_op); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_10 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     (__pyx_v_p[__pyx_v_k]) = __pyx_t_10;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2043
+    /* "csamtools.pyx":2108
  *             for op, l in values:
  *                 p[k] = l << BAM_CIGAR_SHIFT | op
  *                 k += 1             # <<<<<<<<<<<<<<
  * 
  *             ## setting the cigar string also updates the "bin" attribute
  */
-    __pyx_v_k += 1;
+    __pyx_v_k = (__pyx_v_k + 1);
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2046
+  /* "csamtools.pyx":2111
  * 
  *             ## setting the cigar string also updates the "bin" attribute
  *             src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, p))             # <<<<<<<<<<<<<<
@@ -18676,7 +18742,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2050
+/* "csamtools.pyx":2115
  *     property seq:
  *         """read sequence bases, including :term:`soft clipped` bases (None if not present)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -18692,9 +18758,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2050);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2115);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2053
+  /* "csamtools.pyx":2118
  *             cdef bam1_t * src
  *             cdef char * s
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18703,7 +18769,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2055
+  /* "csamtools.pyx":2120
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
@@ -18720,7 +18786,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2057
+  /* "csamtools.pyx":2122
  *             if src.core.l_qseq == 0: return None
  * 
  *             return get_seq_range(src, 0, src.core.l_qseq)             # <<<<<<<<<<<<<<
@@ -18728,7 +18794,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_
  *         def __set__(self,seq):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -18747,7 +18813,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2059
+/* "csamtools.pyx":2124
  *             return get_seq_range(src, 0, src.core.l_qseq)
  * 
  *         def __set__(self,seq):             # <<<<<<<<<<<<<<
@@ -18755,8 +18821,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_
  *             # if no quality information is present, the first byte says 0xff.
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) {
+static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_p;
   char *__pyx_v_s;
@@ -18772,23 +18838,24 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
   int __pyx_t_5;
   int __pyx_t_6;
   char *__pyx_t_7;
+  long __pyx_t_8;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2059);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2124);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2063
+  /* "csamtools.pyx":2128
  *             # if no quality information is present, the first byte says 0xff.
  * 
  *             if seq == None or len(seq) == 0: return             # <<<<<<<<<<<<<<
  *             cdef bam1_t * src
  *             cdef uint8_t * p
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
-    __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (__pyx_t_3 == 0);
     __pyx_t_5 = __pyx_t_4;
   } else {
@@ -18801,7 +18868,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2069
+  /* "csamtools.pyx":2134
  *             cdef int l, k, nbytes_new, nbytes_old
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18810,17 +18877,17 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2071
+  /* "csamtools.pyx":2136
  *             src = self._delegate
  * 
  *             l = len(seq)             # <<<<<<<<<<<<<<
  * 
  *             # as the sequence is stored in half-bytes, the total length (sequence
  */
-  __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_l = __pyx_t_3;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2075
+  /* "csamtools.pyx":2140
  *             # as the sequence is stored in half-bytes, the total length (sequence
  *             # plus quality scores) is (l+1)/2 + l
  *             nbytes_new = (l+1)/2 + l             # <<<<<<<<<<<<<<
@@ -18829,7 +18896,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_nbytes_new = (__Pyx_div_long((__pyx_v_l + 1), 2) + __pyx_v_l);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2076
+  /* "csamtools.pyx":2141
  *             # plus quality scores) is (l+1)/2 + l
  *             nbytes_new = (l+1)/2 + l
  *             nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq             # <<<<<<<<<<<<<<
@@ -18838,7 +18905,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_nbytes_old = (__Pyx_div_long((__pyx_v_src->core.l_qseq + 1), 2) + __pyx_v_src->core.l_qseq);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2078
+  /* "csamtools.pyx":2143
  *             nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq
  *             # acquire pointer to location in memory
  *             p = bam1_seq( src )             # <<<<<<<<<<<<<<
@@ -18847,7 +18914,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_p = bam1_seq(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2079
+  /* "csamtools.pyx":2144
  *             # acquire pointer to location in memory
  *             p = bam1_seq( src )
  *             src.core.l_qseq = l             # <<<<<<<<<<<<<<
@@ -18856,7 +18923,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_src->core.l_qseq = __pyx_v_l;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2084
+  /* "csamtools.pyx":2149
  *                               nbytes_old,
  *                               nbytes_new,
  *                               p)             # <<<<<<<<<<<<<<
@@ -18865,7 +18932,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   pysam_bam_update(__pyx_v_src, __pyx_v_nbytes_old, __pyx_v_nbytes_new, __pyx_v_p);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2087
+  /* "csamtools.pyx":2152
  *             # re-acquire pointer to location in memory
  *             # as it might have moved
  *             p = bam1_seq( src )             # <<<<<<<<<<<<<<
@@ -18874,7 +18941,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_p = bam1_seq(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2088
+  /* "csamtools.pyx":2153
  *             # as it might have moved
  *             p = bam1_seq( src )
  *             for k from 0 <= k < nbytes_new: p[k] = 0             # <<<<<<<<<<<<<<
@@ -18886,17 +18953,17 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
     (__pyx_v_p[__pyx_v_k]) = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2090
+  /* "csamtools.pyx":2155
  *             for k from 0 <= k < nbytes_new: p[k] = 0
  *             # convert to C string
  *             s = seq             # <<<<<<<<<<<<<<
  *             for k from 0 <= k < l:
  *                 p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
  */
-  __pyx_t_7 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_s = __pyx_t_7;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2091
+  /* "csamtools.pyx":2156
  *             # convert to C string
  *             s = seq
  *             for k from 0 <= k < l:             # <<<<<<<<<<<<<<
@@ -18906,17 +18973,18 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
   __pyx_t_6 = __pyx_v_l;
   for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2092
+    /* "csamtools.pyx":2157
  *             s = seq
  *             for k from 0 <= k < l:
  *                 p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)             # <<<<<<<<<<<<<<
  * 
  *             # erase qualities
  */
-    (__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) |= (pysam_translate_sequence((__pyx_v_s[__pyx_v_k])) << (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2))));
+    __pyx_t_8 = __Pyx_div_long(__pyx_v_k, 2);
+    (__pyx_v_p[__pyx_t_8]) = ((__pyx_v_p[__pyx_t_8]) | (pysam_translate_sequence((__pyx_v_s[__pyx_v_k])) << (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))));
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2095
+  /* "csamtools.pyx":2160
  * 
  *             # erase qualities
  *             p = bam1_qual( src )             # <<<<<<<<<<<<<<
@@ -18925,7 +18993,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
  */
   __pyx_v_p = bam1_qual(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2096
+  /* "csamtools.pyx":2161
  *             # erase qualities
  *             p = bam1_qual( src )
  *             p[0] = 0xff             # <<<<<<<<<<<<<<
@@ -18946,7 +19014,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2101
+/* "csamtools.pyx":2166
  *     property qual:
  *         """read sequence base qualities, including :term:`soft clipped` bases (None if not present)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -18962,9 +19030,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2101);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2166);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2106
+  /* "csamtools.pyx":2171
  *             cdef char * q
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -18973,7 +19041,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2108
+  /* "csamtools.pyx":2173
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
@@ -18990,7 +19058,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2110
+  /* "csamtools.pyx":2175
  *             if src.core.l_qseq == 0: return None
  * 
  *             return get_qual_range(src, 0, src.core.l_qseq)             # <<<<<<<<<<<<<<
@@ -18998,7 +19066,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx
  *         def __set__(self,qual):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -19017,7 +19085,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2112
+/* "csamtools.pyx":2177
  *             return get_qual_range(src, 0, src.core.l_qseq)
  * 
  *         def __set__(self,qual):             # <<<<<<<<<<<<<<
@@ -19025,8 +19093,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
+static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_p;
   char *__pyx_v_q;
@@ -19044,9 +19112,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
   int __pyx_t_9;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2112);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2177);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2119
+  /* "csamtools.pyx":2184
  *             cdef int k
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -19055,7 +19123,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2120
+  /* "csamtools.pyx":2185
  * 
  *             src = self._delegate
  *             p = bam1_qual( src )             # <<<<<<<<<<<<<<
@@ -19064,19 +19132,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
  */
   __pyx_v_p = bam1_qual(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2121
+  /* "csamtools.pyx":2186
  *             src = self._delegate
  *             p = bam1_qual( src )
  *             if qual == None or len(qual) == 0:             # <<<<<<<<<<<<<<
  *                 # if absent - set to 0xff
  *                 p[0] = 0xff
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
-    __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (__pyx_t_3 == 0);
     __pyx_t_5 = __pyx_t_4;
   } else {
@@ -19084,7 +19152,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
   }
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2123
+    /* "csamtools.pyx":2188
  *             if qual == None or len(qual) == 0:
  *                 # if absent - set to 0xff
  *                 p[0] = 0xff             # <<<<<<<<<<<<<<
@@ -19093,7 +19161,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
  */
     (__pyx_v_p[0]) = 0xff;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2124
+    /* "csamtools.pyx":2189
  *                 # if absent - set to 0xff
  *                 p[0] = 0xff
  *                 return             # <<<<<<<<<<<<<<
@@ -19106,27 +19174,27 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2127
+  /* "csamtools.pyx":2192
  *             cdef int l
  *             # convert to C string
  *             q = qual             # <<<<<<<<<<<<<<
  *             l = len(qual)
  *             if src.core.l_qseq != l:
  */
-  __pyx_t_6 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_q = __pyx_t_6;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2128
+  /* "csamtools.pyx":2193
  *             # convert to C string
  *             q = qual
  *             l = len(qual)             # <<<<<<<<<<<<<<
  *             if src.core.l_qseq != l:
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  */
-  __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_l = __pyx_t_3;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2129
+  /* "csamtools.pyx":2194
  *             q = qual
  *             l = len(qual)
  *             if src.core.l_qseq != l:             # <<<<<<<<<<<<<<
@@ -19136,58 +19204,58 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
   __pyx_t_5 = (__pyx_v_src->core.l_qseq != __pyx_v_l);
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2130
+    /* "csamtools.pyx":2195
  *             l = len(qual)
  *             if src.core.l_qseq != l:
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))             # <<<<<<<<<<<<<<
  *             assert src.core.l_qseq == l
  *             for k from 0 <= k < l:
  */
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = __Pyx_PyInt_to_py_int32_t(__pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyInt_to_py_int32_t(__pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
     __pyx_t_1 = 0;
     __pyx_t_7 = 0;
-    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_120), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
     __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
     __Pyx_Raise(__pyx_t_7, 0, 0);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2131
+  /* "csamtools.pyx":2196
  *             if src.core.l_qseq != l:
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  *             assert src.core.l_qseq == l             # <<<<<<<<<<<<<<
  *             for k from 0 <= k < l:
  *                 p[k] = <uint8_t>q[k] - 33
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   if (unlikely(!(__pyx_v_src->core.l_qseq == __pyx_v_l))) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2132
+  /* "csamtools.pyx":2197
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  *             assert src.core.l_qseq == l
  *             for k from 0 <= k < l:             # <<<<<<<<<<<<<<
@@ -19197,7 +19265,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
   __pyx_t_9 = __pyx_v_l;
   for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_9; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2133
+    /* "csamtools.pyx":2198
  *             assert src.core.l_qseq == l
  *             for k from 0 <= k < l:
  *                 p[k] = <uint8_t>q[k] - 33             # <<<<<<<<<<<<<<
@@ -19221,7 +19289,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2145
+/* "csamtools.pyx":2210
  *         were not considered for alignment may have been retained."""
  * 
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -19240,9 +19308,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__py
   PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2145);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2210);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2150
+  /* "csamtools.pyx":2215
  *             cdef char * s
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -19251,7 +19319,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__py
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2152
+  /* "csamtools.pyx":2217
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
@@ -19268,27 +19336,27 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__py
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2154
+  /* "csamtools.pyx":2219
  *             if src.core.l_qseq == 0: return None
  * 
  *             start = query_start(src)             # <<<<<<<<<<<<<<
  *             end   = query_end(src)
  * 
  */
-  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_start = __pyx_t_2;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2155
+  /* "csamtools.pyx":2220
  * 
  *             start = query_start(src)
  *             end   = query_end(src)             # <<<<<<<<<<<<<<
  * 
  *             return get_seq_range(src, start, end)
  */
-  __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_end = __pyx_t_2;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2157
+  /* "csamtools.pyx":2222
  *             end   = query_end(src)
  * 
  *             return get_seq_range(src, start, end)             # <<<<<<<<<<<<<<
@@ -19296,7 +19364,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__py
  *     property qqual:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -19315,7 +19383,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2161
+/* "csamtools.pyx":2226
  *     property qqual:
  *         """aligned query sequence quality values (None if not present)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -19334,9 +19402,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__py
   PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2161);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2226);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2166
+  /* "csamtools.pyx":2231
  *             cdef char * q
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -19345,7 +19413,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__py
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2168
+  /* "csamtools.pyx":2233
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
@@ -19362,27 +19430,27 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__py
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2170
+  /* "csamtools.pyx":2235
  *             if src.core.l_qseq == 0: return None
  * 
  *             start = query_start(src)             # <<<<<<<<<<<<<<
  *             end   = query_end(src)
  * 
  */
-  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_start = __pyx_t_2;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2171
+  /* "csamtools.pyx":2236
  * 
  *             start = query_start(src)
  *             end   = query_end(src)             # <<<<<<<<<<<<<<
  * 
  *             return get_qual_range(src, start, end)
  */
-  __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_end = __pyx_t_2;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2173
+  /* "csamtools.pyx":2238
  *             end   = query_end(src)
  * 
  *             return get_qual_range(src, start, end)             # <<<<<<<<<<<<<<
@@ -19390,7 +19458,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__py
  *     property qstart:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -19409,7 +19477,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2177
+/* "csamtools.pyx":2242
  *     property qstart:
  *         """start index of the aligned query portion of the sequence (0-based, inclusive)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -19424,9 +19492,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__p
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2177);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2242);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2178
+  /* "csamtools.pyx":2243
  *         """start index of the aligned query portion of the sequence (0-based, inclusive)"""
  *         def __get__(self):
  *             return query_start(self._delegate)             # <<<<<<<<<<<<<<
@@ -19434,8 +19502,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__p
  *     property qend:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_query_start(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_query_start(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -19454,7 +19522,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2182
+/* "csamtools.pyx":2247
  *     property qend:
  *         """end index of the aligned query portion of the sequence (0-based, exclusive)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -19469,9 +19537,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2182);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2247);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2183
+  /* "csamtools.pyx":2248
  *         """end index of the aligned query portion of the sequence (0-based, exclusive)"""
  *         def __get__(self):
  *             return query_end(self._delegate)             # <<<<<<<<<<<<<<
@@ -19479,8 +19547,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx
  *     property qlen:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_query_end(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_query_end(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -19499,7 +19567,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2187
+/* "csamtools.pyx":2252
  *     property qlen:
  *         """Length of the aligned query sequence"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -19516,9 +19584,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx
   PyObject *__pyx_t_3 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2187);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2252);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2189
+  /* "csamtools.pyx":2254
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -19527,7 +19595,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2190
+  /* "csamtools.pyx":2255
  *             cdef bam1_t * src
  *             src = self._delegate
  *             return query_end(src)-query_start(src)             # <<<<<<<<<<<<<<
@@ -19535,9 +19603,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx
  *     property tags:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -19556,8 +19624,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2204
- * 
+/* "csamtools.pyx":2272
+ *         multiple times.
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
  *             cdef char * ctag
@@ -19583,38 +19651,40 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
   int __pyx_t_8;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2204);
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2272);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2211
+  /* "csamtools.pyx":2279
  *             cdef char auxtype
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
- *             if src.l_aux == 0: return None
+ *             if src.l_aux == 0: return []
  * 
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2212
+  /* "csamtools.pyx":2280
  * 
  *             src = self._delegate
- *             if src.l_aux == 0: return None             # <<<<<<<<<<<<<<
+ *             if src.l_aux == 0: return []             # <<<<<<<<<<<<<<
  * 
  *             s = bam1_aux( src )
  */
   __pyx_t_1 = (__pyx_v_src->l_aux == 0);
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(Py_None);
-    __pyx_r = Py_None;
+    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_r = ((PyObject *)__pyx_t_2);
+    __pyx_t_2 = 0;
     goto __pyx_L0;
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2214
- *             if src.l_aux == 0: return None
+  /* "csamtools.pyx":2282
+ *             if src.l_aux == 0: return []
  * 
  *             s = bam1_aux( src )             # <<<<<<<<<<<<<<
  *             result = []
@@ -19622,20 +19692,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  */
   __pyx_v_s = bam1_aux(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2215
+  /* "csamtools.pyx":2283
  * 
  *             s = bam1_aux( src )
  *             result = []             # <<<<<<<<<<<<<<
  *             auxtag[2] = 0
  *             while s < (src.data + src.data_len):
  */
-  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_v_result));
   __pyx_v_result = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2216
+  /* "csamtools.pyx":2284
  *             s = bam1_aux( src )
  *             result = []
  *             auxtag[2] = 0             # <<<<<<<<<<<<<<
@@ -19644,7 +19714,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  */
   (__pyx_v_auxtag[2]) = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2217
+  /* "csamtools.pyx":2285
  *             result = []
  *             auxtag[2] = 0
  *             while s < (src.data + src.data_len):             # <<<<<<<<<<<<<<
@@ -19655,7 +19725,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len));
     if (!__pyx_t_1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2219
+    /* "csamtools.pyx":2287
  *             while s < (src.data + src.data_len):
  *                 # get tag
  *                 auxtag[0] = s[0]             # <<<<<<<<<<<<<<
@@ -19664,7 +19734,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  */
     (__pyx_v_auxtag[0]) = (__pyx_v_s[0]);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2220
+    /* "csamtools.pyx":2288
  *                 # get tag
  *                 auxtag[0] = s[0]
  *                 auxtag[1] = s[1]             # <<<<<<<<<<<<<<
@@ -19673,16 +19743,16 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  */
     (__pyx_v_auxtag[1]) = (__pyx_v_s[1]);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2221
+    /* "csamtools.pyx":2289
  *                 auxtag[0] = s[0]
  *                 auxtag[1] = s[1]
  *                 s += 2             # <<<<<<<<<<<<<<
  *                 auxtype = s[0]
  * 
  */
-    __pyx_v_s += 2;
+    __pyx_v_s = (__pyx_v_s + 2);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2222
+    /* "csamtools.pyx":2290
  *                 auxtag[1] = s[1]
  *                 s += 2
  *                 auxtype = s[0]             # <<<<<<<<<<<<<<
@@ -19691,7 +19761,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  */
     __pyx_v_auxtype = (__pyx_v_s[0]);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2224
+    /* "csamtools.pyx":2292
  *                 auxtype = s[0]
  * 
  *                 if auxtype in ('c', 'C'):             # <<<<<<<<<<<<<<
@@ -19709,31 +19779,31 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = __pyx_t_5;
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2225
+      /* "csamtools.pyx":2293
  * 
  *                 if auxtype in ('c', 'C'):
  *                     value = <int>bam_aux2i(s)             # <<<<<<<<<<<<<<
  *                     s += 1
  *                 elif auxtype in ('s', 'S'):
  */
-      __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2226
+      /* "csamtools.pyx":2294
  *                 if auxtype in ('c', 'C'):
  *                     value = <int>bam_aux2i(s)
  *                     s += 1             # <<<<<<<<<<<<<<
  *                 elif auxtype in ('s', 'S'):
  *                     value = <int>bam_aux2i(s)
  */
-      __pyx_v_s += 1;
+      __pyx_v_s = (__pyx_v_s + 1);
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2227
+    /* "csamtools.pyx":2295
  *                     value = <int>bam_aux2i(s)
  *                     s += 1
  *                 elif auxtype in ('s', 'S'):             # <<<<<<<<<<<<<<
@@ -19751,31 +19821,31 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = __pyx_t_4;
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2228
+      /* "csamtools.pyx":2296
  *                     s += 1
  *                 elif auxtype in ('s', 'S'):
  *                     value = <int>bam_aux2i(s)             # <<<<<<<<<<<<<<
  *                     s += 2
  *                 elif auxtype in ('i', 'I'):
  */
-      __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2229
+      /* "csamtools.pyx":2297
  *                 elif auxtype in ('s', 'S'):
  *                     value = <int>bam_aux2i(s)
  *                     s += 2             # <<<<<<<<<<<<<<
  *                 elif auxtype in ('i', 'I'):
  *                     value = <float>bam_aux2i(s)
  */
-      __pyx_v_s += 2;
+      __pyx_v_s = (__pyx_v_s + 2);
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2230
+    /* "csamtools.pyx":2298
  *                     value = <int>bam_aux2i(s)
  *                     s += 2
  *                 elif auxtype in ('i', 'I'):             # <<<<<<<<<<<<<<
@@ -19793,31 +19863,31 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = __pyx_t_5;
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2231
+      /* "csamtools.pyx":2299
  *                     s += 2
  *                 elif auxtype in ('i', 'I'):
  *                     value = <float>bam_aux2i(s)             # <<<<<<<<<<<<<<
  *                     s += 4
  *                 elif auxtype == 'f':
  */
-      __pyx_t_2 = PyFloat_FromDouble(((float)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyFloat_FromDouble(((float)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2232
+      /* "csamtools.pyx":2300
  *                 elif auxtype in ('i', 'I'):
  *                     value = <float>bam_aux2i(s)
  *                     s += 4             # <<<<<<<<<<<<<<
  *                 elif auxtype == 'f':
  *                     value = <float>bam_aux2f(s)
  */
-      __pyx_v_s += 4;
+      __pyx_v_s = (__pyx_v_s + 4);
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2233
+    /* "csamtools.pyx":2301
  *                     value = <float>bam_aux2i(s)
  *                     s += 4
  *                 elif auxtype == 'f':             # <<<<<<<<<<<<<<
@@ -19827,31 +19897,31 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = (__pyx_v_auxtype == 'f');
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2234
+      /* "csamtools.pyx":2302
  *                     s += 4
  *                 elif auxtype == 'f':
  *                     value = <float>bam_aux2f(s)             # <<<<<<<<<<<<<<
  *                     s += 4
  *                 elif auxtype == 'd':
  */
-      __pyx_t_2 = PyFloat_FromDouble(bam_aux2f(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyFloat_FromDouble(bam_aux2f(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2235
+      /* "csamtools.pyx":2303
  *                 elif auxtype == 'f':
  *                     value = <float>bam_aux2f(s)
  *                     s += 4             # <<<<<<<<<<<<<<
  *                 elif auxtype == 'd':
  *                     value = <double>bam_aux2d(s)
  */
-      __pyx_v_s += 4;
+      __pyx_v_s = (__pyx_v_s + 4);
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2236
+    /* "csamtools.pyx":2304
  *                     value = <float>bam_aux2f(s)
  *                     s += 4
  *                 elif auxtype == 'd':             # <<<<<<<<<<<<<<
@@ -19861,31 +19931,31 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = (__pyx_v_auxtype == 'd');
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2237
+      /* "csamtools.pyx":2305
  *                     s += 4
  *                 elif auxtype == 'd':
  *                     value = <double>bam_aux2d(s)             # <<<<<<<<<<<<<<
  *                     s += 8
  *                 elif auxtype == 'A':
  */
-      __pyx_t_2 = PyFloat_FromDouble(bam_aux2d(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyFloat_FromDouble(bam_aux2d(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2238
+      /* "csamtools.pyx":2306
  *                 elif auxtype == 'd':
  *                     value = <double>bam_aux2d(s)
  *                     s += 8             # <<<<<<<<<<<<<<
  *                 elif auxtype == 'A':
  *                     value = "%c" % <char>bam_aux2A(s)
  */
-      __pyx_v_s += 8;
+      __pyx_v_s = (__pyx_v_s + 8);
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2239
+    /* "csamtools.pyx":2307
  *                     value = <double>bam_aux2d(s)
  *                     s += 8
  *                 elif auxtype == 'A':             # <<<<<<<<<<<<<<
@@ -19895,34 +19965,34 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = (__pyx_v_auxtype == 'A');
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2240
+      /* "csamtools.pyx":2308
  *                     s += 8
  *                 elif auxtype == 'A':
  *                     value = "%c" % <char>bam_aux2A(s)             # <<<<<<<<<<<<<<
  *                     s += 1
  *                 elif auxtype in ('Z', 'H'):
  */
-      __pyx_t_2 = PyInt_FromLong(bam_aux2A(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong(bam_aux2A(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = ((PyObject *)__pyx_t_6);
       __pyx_t_6 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2241
+      /* "csamtools.pyx":2309
  *                 elif auxtype == 'A':
  *                     value = "%c" % <char>bam_aux2A(s)
  *                     s += 1             # <<<<<<<<<<<<<<
  *                 elif auxtype in ('Z', 'H'):
  *                     value = <char*>bam_aux2Z(s)
  */
-      __pyx_v_s += 1;
+      __pyx_v_s = (__pyx_v_s + 1);
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2242
+    /* "csamtools.pyx":2310
  *                     value = "%c" % <char>bam_aux2A(s)
  *                     s += 1
  *                 elif auxtype in ('Z', 'H'):             # <<<<<<<<<<<<<<
@@ -19940,42 +20010,42 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
     __pyx_t_1 = __pyx_t_4;
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2243
+      /* "csamtools.pyx":2311
  *                     s += 1
  *                 elif auxtype in ('Z', 'H'):
  *                     value = <char*>bam_aux2Z(s)             # <<<<<<<<<<<<<<
  *                     # +1 for NULL terminated string
  *                     s += len(value) + 1
  */
-      __pyx_t_6 = PyBytes_FromString(bam_aux2Z(__pyx_v_s)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyBytes_FromString(bam_aux2Z(__pyx_v_s)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = ((PyObject *)__pyx_t_6);
       __pyx_t_6 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2245
+      /* "csamtools.pyx":2313
  *                     value = <char*>bam_aux2Z(s)
  *                     # +1 for NULL terminated string
  *                     s += len(value) + 1             # <<<<<<<<<<<<<<
  *                  #
  *                 s += 1
  */
-      __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_s += (__pyx_t_7 + 1);
+      __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_s = (__pyx_v_s + (__pyx_t_7 + 1));
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2247
+    /* "csamtools.pyx":2315
  *                     s += len(value) + 1
  *                  #
  *                 s += 1             # <<<<<<<<<<<<<<
  * 
  *                 result.append( (auxtag, value) )
  */
-    __pyx_v_s += 1;
+    __pyx_v_s = (__pyx_v_s + 1);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2249
+    /* "csamtools.pyx":2317
  *                 s += 1
  * 
  *                 result.append( (auxtag, value) )             # <<<<<<<<<<<<<<
@@ -19983,23 +20053,23 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  *             return result
  */
     if (unlikely(__pyx_v_result == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_6 = PyBytes_FromString(__pyx_v_auxtag); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyBytes_FromString(__pyx_v_auxtag); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
     __pyx_t_6 = 0;
-    __pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_2); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_8 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2251
+  /* "csamtools.pyx":2319
  *                 result.append( (auxtag, value) )
  * 
  *             return result             # <<<<<<<<<<<<<<
@@ -20027,7 +20097,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2253
+/* "csamtools.pyx":2321
  *             return result
  * 
  *         def __set__(self, tags):             # <<<<<<<<<<<<<<
@@ -20035,8 +20105,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) {
+static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_s;
   char *__pyx_v_temp;
@@ -20063,15 +20133,15 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
   char *__pyx_t_11;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2253);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2321);
   __pyx_v_buffer = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_pytag = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_t = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_fmt = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2262
+  /* "csamtools.pyx":2330
  *             cdef int max_size, size, offset
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -20080,7 +20150,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2263
+  /* "csamtools.pyx":2331
  * 
  *             src = self._delegate
  *             max_size = 4000             # <<<<<<<<<<<<<<
@@ -20089,7 +20159,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
   __pyx_v_max_size = 4000;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2264
+  /* "csamtools.pyx":2332
  *             src = self._delegate
  *             max_size = 4000
  *             offset = 0             # <<<<<<<<<<<<<<
@@ -20098,47 +20168,47 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
   __pyx_v_offset = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2266
+  /* "csamtools.pyx":2334
  *             offset = 0
  * 
  *             if tags != None:             # <<<<<<<<<<<<<<
  * 
  *                 # map samtools code to python.struct code and byte size
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2269
+    /* "csamtools.pyx":2337
  * 
  *                 # map samtools code to python.struct code and byte size
  *                 buffer = ctypes.create_string_buffer(max_size)             # <<<<<<<<<<<<<<
  * 
  *                 for pytag, value in tags:
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_63); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_122); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_v_buffer);
     __pyx_v_buffer = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2271
+    /* "csamtools.pyx":2339
  *                 buffer = ctypes.create_string_buffer(max_size)
  * 
  *                 for pytag, value in tags:             # <<<<<<<<<<<<<<
@@ -20148,7 +20218,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
     if (PyList_CheckExact(__pyx_v_tags) || PyTuple_CheckExact(__pyx_v_tags)) {
       __pyx_t_5 = 0; __pyx_t_1 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_1);
     } else {
-      __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
     }
     for (;;) {
@@ -20161,7 +20231,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
       } else {
         __pyx_t_4 = PyIter_Next(__pyx_t_1);
         if (!__pyx_t_4) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
         __Pyx_GOTREF(__pyx_t_4);
@@ -20178,14 +20248,14 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
         __pyx_v_value = __pyx_t_6;
         __pyx_t_6 = 0;
       } else {
-        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_v_pytag);
         __pyx_v_pytag = __pyx_t_3;
@@ -20195,7 +20265,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
         __pyx_t_6 = 0;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2272
+      /* "csamtools.pyx":2340
  * 
  *                 for pytag, value in tags:
  *                     t = type(value)             # <<<<<<<<<<<<<<
@@ -20204,35 +20274,35 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
       __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value)));
       __Pyx_DECREF(((PyObject *)__pyx_v_t));
-      __pyx_v_t = ((PyObject *)((PyObject *)Py_TYPE(__pyx_v_value)));
+      __pyx_v_t = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_value)));
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2273
+      /* "csamtools.pyx":2341
  *                 for pytag, value in tags:
  *                     t = type(value)
  *                     if t == types.FloatType:             # <<<<<<<<<<<<<<
  *                         fmt, pytype = "<cccf", 'f'
  *                     elif t == types.IntType:
  */
-      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__FloatType); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__FloatType); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), __pyx_t_6, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), __pyx_t_6, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       if (__pyx_t_2) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2274
+        /* "csamtools.pyx":2342
  *                     t = type(value)
  *                     if t == types.FloatType:
  *                         fmt, pytype = "<cccf", 'f'             # <<<<<<<<<<<<<<
  *                     elif t == types.IntType:
  *                         if value < 0:
  */
-        __pyx_t_4 = ((PyObject *)__pyx_kp_s_64);
+        __pyx_t_4 = ((PyObject *)__pyx_kp_s_123);
         __Pyx_INCREF(__pyx_t_4);
         __pyx_t_6 = ((PyObject *)__pyx_n_s__f);
         __Pyx_INCREF(__pyx_t_6);
@@ -20245,51 +20315,51 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
         goto __pyx_L8;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2275
+      /* "csamtools.pyx":2343
  *                     if t == types.FloatType:
  *                         fmt, pytype = "<cccf", 'f'
  *                     elif t == types.IntType:             # <<<<<<<<<<<<<<
  *                         if value < 0:
  *                             if value >= -127: fmt, pytype = "<cccb", 'c'
  */
-      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__IntType); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__IntType); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_t), __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_t), __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       if (__pyx_t_2) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2276
+        /* "csamtools.pyx":2344
  *                         fmt, pytype = "<cccf", 'f'
  *                     elif t == types.IntType:
  *                         if value < 0:             # <<<<<<<<<<<<<<
  *                             if value >= -127: fmt, pytype = "<cccb", 'c'
  *                             elif value >= -32767: fmt, pytype = "<ccch", 's'
  */
-        __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         if (__pyx_t_2) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2277
+          /* "csamtools.pyx":2345
  *                     elif t == types.IntType:
  *                         if value < 0:
  *                             if value >= -127: fmt, pytype = "<cccb", 'c'             # <<<<<<<<<<<<<<
  *                             elif value >= -32767: fmt, pytype = "<ccch", 's'
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  */
-          __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           if (__pyx_t_2) {
-            __pyx_t_6 = ((PyObject *)__pyx_kp_s_65);
+            __pyx_t_6 = ((PyObject *)__pyx_kp_s_124);
             __Pyx_INCREF(__pyx_t_6);
             __pyx_t_4 = ((PyObject *)__pyx_n_s__c);
             __Pyx_INCREF(__pyx_t_4);
@@ -20302,19 +20372,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
             goto __pyx_L10;
           }
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2278
+          /* "csamtools.pyx":2346
  *                         if value < 0:
  *                             if value >= -127: fmt, pytype = "<cccb", 'c'
  *                             elif value >= -32767: fmt, pytype = "<ccch", 's'             # <<<<<<<<<<<<<<
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "<ccci", 'i'[0]
  */
-          __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_4);
-          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
           if (__pyx_t_2) {
-            __pyx_t_4 = ((PyObject *)__pyx_kp_s_66);
+            __pyx_t_4 = ((PyObject *)__pyx_kp_s_125);
             __Pyx_INCREF(__pyx_t_4);
             __pyx_t_6 = ((PyObject *)__pyx_n_s__s);
             __Pyx_INCREF(__pyx_t_6);
@@ -20327,45 +20397,45 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
             goto __pyx_L10;
           }
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2279
+          /* "csamtools.pyx":2347
  *                             if value >= -127: fmt, pytype = "<cccb", 'c'
  *                             elif value >= -32767: fmt, pytype = "<ccch", 's'
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )             # <<<<<<<<<<<<<<
  *                             else: fmt, pytype = "<ccci", 'i'[0]
  *                         else:
  */
-          __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           if (__pyx_t_2) {
-            __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-            __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_4);
+            __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_4));
             PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
             __pyx_t_6 = 0;
-            __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_6);
-            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
             __Pyx_Raise(__pyx_t_6, 0, 0);
             __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             goto __pyx_L10;
           }
           /*else*/ {
 
-            /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2280
+            /* "csamtools.pyx":2348
  *                             elif value >= -32767: fmt, pytype = "<ccch", 's'
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "<ccci", 'i'[0]             # <<<<<<<<<<<<<<
  *                         else:
  *                             if value <= 255: fmt, pytype = "<cccB", 'C'
  */
-            __pyx_t_6 = ((PyObject *)__pyx_kp_s_68);
+            __pyx_t_6 = ((PyObject *)__pyx_kp_s_127);
             __Pyx_INCREF(__pyx_t_6);
-            __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_n_s__i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_n_s__i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_4);
             __Pyx_DECREF(__pyx_v_fmt);
             __pyx_v_fmt = __pyx_t_6;
@@ -20379,19 +20449,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2282
+          /* "csamtools.pyx":2350
  *                             else: fmt, pytype = "<ccci", 'i'[0]
  *                         else:
  *                             if value <= 255: fmt, pytype = "<cccB", 'C'             # <<<<<<<<<<<<<<
  *                             elif value <= 65535: fmt, pytype = "<cccH", 'S'
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  */
-          __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_4);
-          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
           if (__pyx_t_2) {
-            __pyx_t_4 = ((PyObject *)__pyx_kp_s_69);
+            __pyx_t_4 = ((PyObject *)__pyx_kp_s_128);
             __Pyx_INCREF(__pyx_t_4);
             __pyx_t_6 = ((PyObject *)__pyx_n_s__C);
             __Pyx_INCREF(__pyx_t_6);
@@ -20404,19 +20474,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
             goto __pyx_L11;
           }
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2283
+          /* "csamtools.pyx":2351
  *                         else:
  *                             if value <= 255: fmt, pytype = "<cccB", 'C'
  *                             elif value <= 65535: fmt, pytype = "<cccH", 'S'             # <<<<<<<<<<<<<<
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "<cccI", 'I'
  */
-          __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           if (__pyx_t_2) {
-            __pyx_t_6 = ((PyObject *)__pyx_kp_s_70);
+            __pyx_t_6 = ((PyObject *)__pyx_kp_s_129);
             __Pyx_INCREF(__pyx_t_6);
             __pyx_t_4 = ((PyObject *)__pyx_n_s__S);
             __Pyx_INCREF(__pyx_t_4);
@@ -20429,43 +20499,43 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
             goto __pyx_L11;
           }
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2284
+          /* "csamtools.pyx":2352
  *                             if value <= 255: fmt, pytype = "<cccB", 'C'
  *                             elif value <= 65535: fmt, pytype = "<cccH", 'S'
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )             # <<<<<<<<<<<<<<
  *                             else: fmt, pytype = "<cccI", 'I'
  *                     else:
  */
-          __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_4);
-          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
           if (__pyx_t_2) {
-            __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-            __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_6);
+            __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_6));
             PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
             __pyx_t_4 = 0;
-            __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_t_4);
-            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
             __Pyx_Raise(__pyx_t_4, 0, 0);
             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             goto __pyx_L11;
           }
           /*else*/ {
 
-            /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2285
+            /* "csamtools.pyx":2353
  *                             elif value <= 65535: fmt, pytype = "<cccH", 'S'
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "<cccI", 'I'             # <<<<<<<<<<<<<<
  *                     else:
  *                         # Note: hex strings (H) are not supported yet
  */
-            __pyx_t_4 = ((PyObject *)__pyx_kp_s_71);
+            __pyx_t_4 = ((PyObject *)__pyx_kp_s_130);
             __Pyx_INCREF(__pyx_t_4);
             __pyx_t_6 = ((PyObject *)__pyx_n_s__I);
             __Pyx_INCREF(__pyx_t_6);
@@ -20483,25 +20553,25 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2288
+        /* "csamtools.pyx":2356
  *                     else:
  *                         # Note: hex strings (H) are not supported yet
  *                         if len(value) == 1:             # <<<<<<<<<<<<<<
  *                             fmt, pytype = "<cccc", 'A'
  *                         else:
  */
-        __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_2 = (__pyx_t_8 == 1);
         if (__pyx_t_2) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2289
+          /* "csamtools.pyx":2357
  *                         # Note: hex strings (H) are not supported yet
  *                         if len(value) == 1:
  *                             fmt, pytype = "<cccc", 'A'             # <<<<<<<<<<<<<<
  *                         else:
  *                             fmt, pytype = "<ccc%is" % (len(value)+1), 'Z'
  */
-          __pyx_t_6 = ((PyObject *)__pyx_kp_s_72);
+          __pyx_t_6 = ((PyObject *)__pyx_kp_s_131);
           __Pyx_INCREF(__pyx_t_6);
           __pyx_t_4 = ((PyObject *)__pyx_n_s__A);
           __Pyx_INCREF(__pyx_t_4);
@@ -20515,17 +20585,17 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2291
+          /* "csamtools.pyx":2359
  *                             fmt, pytype = "<cccc", 'A'
  *                         else:
  *                             fmt, pytype = "<ccc%is" % (len(value)+1), 'Z'             # <<<<<<<<<<<<<<
  * 
  *                     size = struct.calcsize(fmt)
  */
-          __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_4 = PyInt_FromSsize_t((__pyx_t_8 + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_4 = PyInt_FromSsize_t((__pyx_t_8 + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_4);
-          __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_73), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_132), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
           __pyx_t_4 = ((PyObject *)__pyx_n_s__Z);
@@ -20541,32 +20611,32 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
       }
       __pyx_L8:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2293
+      /* "csamtools.pyx":2361
  *                             fmt, pytype = "<ccc%is" % (len(value)+1), 'Z'
  * 
  *                     size = struct.calcsize(fmt)             # <<<<<<<<<<<<<<
  *                     if offset + size > max_size:
  *                         raise NotImplementedError("tags field too large")
  */
-      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_INCREF(__pyx_v_fmt);
       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fmt);
       __Pyx_GIVEREF(__pyx_v_fmt);
-      __pyx_t_3 = PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __pyx_v_size = __pyx_t_9;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2294
+      /* "csamtools.pyx":2362
  * 
  *                     size = struct.calcsize(fmt)
  *                     if offset + size > max_size:             # <<<<<<<<<<<<<<
@@ -20576,88 +20646,82 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
       __pyx_t_2 = ((__pyx_v_offset + __pyx_v_size) > __pyx_v_max_size);
       if (__pyx_t_2) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2295
+        /* "csamtools.pyx":2363
  *                     size = struct.calcsize(fmt)
  *                     if offset + size > max_size:
  *                         raise NotImplementedError("tags field too large")             # <<<<<<<<<<<<<<
  * 
  *                     struct.pack_into( fmt,
  */
-        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_74));
-        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_74));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_74));
-        __pyx_t_4 = PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __Pyx_Raise(__pyx_t_3, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_Raise(__pyx_t_4, 0, 0);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L13;
       }
       __pyx_L13:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2297
+      /* "csamtools.pyx":2365
  *                         raise NotImplementedError("tags field too large")
  * 
  *                     struct.pack_into( fmt,             # <<<<<<<<<<<<<<
  *                                       buffer,
  *                                       offset,
  */
-      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2299
+      /* "csamtools.pyx":2367
  *                     struct.pack_into( fmt,
  *                                       buffer,
  *                                       offset,             # <<<<<<<<<<<<<<
  *                                       pytag[0],
  *                                       pytag[1],
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2300
+      /* "csamtools.pyx":2368
  *                                       buffer,
  *                                       offset,
  *                                       pytag[0],             # <<<<<<<<<<<<<<
  *                                       pytag[1],
  *                                       pytype,
  */
-      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pytag, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pytag, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2301
+      /* "csamtools.pyx":2369
  *                                       offset,
  *                                       pytag[0],
  *                                       pytag[1],             # <<<<<<<<<<<<<<
  *                                       pytype,
  *                                       value )
  */
-      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_pytag, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_pytag, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2303
+      /* "csamtools.pyx":2371
  *                                       pytag[1],
  *                                       pytype,
  *                                       value )             # <<<<<<<<<<<<<<
  *                     offset += size
  * 
  */
-      __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_fmt);
       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fmt);
       __Pyx_GIVEREF(__pyx_v_fmt);
       __Pyx_INCREF(__pyx_v_buffer);
       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_buffer);
       __Pyx_GIVEREF(__pyx_v_buffer);
-      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
+      __Pyx_GIVEREF(__pyx_t_3);
       PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_6);
       __Pyx_GIVEREF(__pyx_t_6);
       PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_7);
@@ -20668,30 +20732,30 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
       __Pyx_INCREF(__pyx_v_value);
       PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_v_value);
       __Pyx_GIVEREF(__pyx_v_value);
-      __pyx_t_4 = 0;
+      __pyx_t_3 = 0;
       __pyx_t_6 = 0;
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2304
+      /* "csamtools.pyx":2372
  *                                       pytype,
  *                                       value )
  *                     offset += size             # <<<<<<<<<<<<<<
  * 
  *             # delete the old data and allocate new
  */
-      __pyx_v_offset += __pyx_v_size;
+      __pyx_v_offset = (__pyx_v_offset + __pyx_v_size);
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2312
+  /* "csamtools.pyx":2380
  *                               src.l_aux,
  *                               offset,
  *                               bam1_aux( src ) )             # <<<<<<<<<<<<<<
@@ -20700,7 +20764,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
   pysam_bam_update(__pyx_v_src, __pyx_v_src->l_aux, __pyx_v_offset, bam1_aux(__pyx_v_src));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2314
+  /* "csamtools.pyx":2382
  *                               bam1_aux( src ) )
  * 
  *             src.l_aux = offset             # <<<<<<<<<<<<<<
@@ -20709,7 +20773,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
   __pyx_v_src->l_aux = __pyx_v_offset;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2317
+  /* "csamtools.pyx":2385
  * 
  *             # copy data only if there is any
  *             if offset != 0:             # <<<<<<<<<<<<<<
@@ -20719,7 +20783,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
   __pyx_t_2 = (__pyx_v_offset != 0);
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2320
+    /* "csamtools.pyx":2388
  * 
  *                 # get location of new data
  *                 s = bam1_aux( src )             # <<<<<<<<<<<<<<
@@ -20728,20 +20792,20 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
  */
     __pyx_v_s = bam1_aux(__pyx_v_src);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2323
+    /* "csamtools.pyx":2391
  * 
  *                 # check if there is direct path from buffer.raw to tmp
  *                 temp = buffer.raw             # <<<<<<<<<<<<<<
  *                 memcpy( s, temp, offset )
  * 
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_11 = PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_v_temp = __pyx_t_11;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2324
+    /* "csamtools.pyx":2392
  *                 # check if there is direct path from buffer.raw to tmp
  *                 temp = buffer.raw
  *                 memcpy( s, temp, offset )             # <<<<<<<<<<<<<<
@@ -20776,7 +20840,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2328
+/* "csamtools.pyx":2396
  *     property flag:
  *         """properties flag"""
  *         def __get__(self): return self._delegate.core.flag             # <<<<<<<<<<<<<<
@@ -20790,9 +20854,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2328);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2396);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -20811,7 +20875,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2329
+/* "csamtools.pyx":2397
  *         """properties flag"""
  *         def __get__(self): return self._delegate.core.flag
  *         def __set__(self, flag): self._delegate.core.flag = flag             # <<<<<<<<<<<<<<
@@ -20819,14 +20883,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx
  *     property rname:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4flag___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_4flag___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) {
+static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) {
   int __pyx_r;
   uint32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2329);
-  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_flag); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2397);
+  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_flag); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = __pyx_t_1;
 
   __pyx_r = 0;
@@ -20840,7 +20904,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4flag___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2347
+/* "csamtools.pyx":2415
  * 
  *         """
  *         def __get__(self): return self._delegate.core.tid             # <<<<<<<<<<<<<<
@@ -20854,9 +20918,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__py
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2347);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2415);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -20875,7 +20939,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2348
+/* "csamtools.pyx":2416
  *         """
  *         def __get__(self): return self._delegate.core.tid
  *         def __set__(self, tid): self._delegate.core.tid = tid             # <<<<<<<<<<<<<<
@@ -20883,14 +20947,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__py
  *     property tid:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5rname___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_5rname___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
+static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
   int __pyx_r;
   int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2348);
-  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2416);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1;
 
   __pyx_r = 0;
@@ -20904,7 +20968,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5rname___set__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2361
+/* "csamtools.pyx":2429
  * 
  *         """
  *         def __get__(self): return self._delegate.core.tid             # <<<<<<<<<<<<<<
@@ -20918,9 +20982,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2361);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2429);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -20939,7 +21003,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2362
+/* "csamtools.pyx":2430
  *         """
  *         def __get__(self): return self._delegate.core.tid
  *         def __set__(self, tid): self._delegate.core.tid = tid             # <<<<<<<<<<<<<<
@@ -20947,14 +21011,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_
  *     property pos:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3tid___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_3tid___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
+static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
   int __pyx_r;
   int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2362);
-  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2430);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1;
 
   __pyx_r = 0;
@@ -20968,7 +21032,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3tid___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2366
+/* "csamtools.pyx":2434
  *     property pos:
  *         """0-based leftmost coordinate"""
  *         def __get__(self): return self._delegate.core.pos             # <<<<<<<<<<<<<<
@@ -20982,9 +21046,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2366);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2434);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21003,7 +21067,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2367
+/* "csamtools.pyx":2435
  *         """0-based leftmost coordinate"""
  *         def __get__(self): return self._delegate.core.pos
  *         def __set__(self, pos):             # <<<<<<<<<<<<<<
@@ -21011,16 +21075,16 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) {
+static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) {
   bam1_t *__pyx_v_src;
   int __pyx_r;
   int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2367);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2435);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2370
+  /* "csamtools.pyx":2438
  *             ## setting the cigar string also updates the "bin" attribute
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -21029,7 +21093,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2371
+  /* "csamtools.pyx":2439
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -21038,7 +21102,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self
  */
   if (__pyx_v_src->core.n_cigar) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2372
+    /* "csamtools.pyx":2440
  *             src = self._delegate
  *             if src.core.n_cigar:
  *                 src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )             # <<<<<<<<<<<<<<
@@ -21050,7 +21114,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2374
+    /* "csamtools.pyx":2442
  *                 src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
  *             else:
  *                 src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)             # <<<<<<<<<<<<<<
@@ -21061,14 +21125,14 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2375
+  /* "csamtools.pyx":2443
  *             else:
  *                 src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
  *             self._delegate.core.pos = pos             # <<<<<<<<<<<<<<
  *     property bin:
  *         """properties bin"""
  */
-  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_pos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_pos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos = __pyx_t_1;
 
   __pyx_r = 0;
@@ -21082,7 +21146,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2378
+/* "csamtools.pyx":2446
  *     property bin:
  *         """properties bin"""
  *         def __get__(self): return self._delegate.core.bin             # <<<<<<<<<<<<<<
@@ -21096,9 +21160,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2378);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2446);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21117,7 +21181,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2379
+/* "csamtools.pyx":2447
  *         """properties bin"""
  *         def __get__(self): return self._delegate.core.bin
  *         def __set__(self, bin): self._delegate.core.bin = bin             # <<<<<<<<<<<<<<
@@ -21125,14 +21189,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_
  *         '''length of the read (read only). Returns 0 if not given.'''
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3bin___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_3bin___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) {
+static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) {
   int __pyx_r;
   uint32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2379);
-  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_bin); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2447);
+  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_bin); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin = __pyx_t_1;
 
   __pyx_r = 0;
@@ -21146,12 +21210,12 @@ static int __pyx_pf_9csamtools_11AlignedRead_3bin___set__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2382
+/* "csamtools.pyx":2450
  *     property rlen:
  *         '''length of the read (read only). Returns 0 if not given.'''
  *         def __get__(self): return self._delegate.core.l_qseq             # <<<<<<<<<<<<<<
  *     property aend:
- *         '''aligned end position of the read (read only).  Returns
+ *         '''aligned end position of the read on the reference genome.  Returns
  */
 
 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self); /*proto*/
@@ -21160,9 +21224,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2382);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2450);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21181,8 +21245,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2386
- *         '''aligned end position of the read (read only).  Returns
+/* "csamtools.pyx":2454
+ *         '''aligned end position of the read on the reference genome.  Returns
  *         None if not available.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
  *             cdef bam1_t * src
@@ -21200,9 +21264,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx
   int __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2386);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2454);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2388
+  /* "csamtools.pyx":2456
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -21211,19 +21275,19 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2389
+  /* "csamtools.pyx":2457
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:             # <<<<<<<<<<<<<<
  *                 return None
  *             return bam_calend(&src.core, bam1_cigar(src))
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (!__pyx_t_3) {
     __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
@@ -21233,7 +21297,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx
   }
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2390
+    /* "csamtools.pyx":2458
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None             # <<<<<<<<<<<<<<
@@ -21248,15 +21312,15 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2391
+  /* "csamtools.pyx":2459
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  *             return bam_calend(&src.core, bam1_cigar(src))             # <<<<<<<<<<<<<<
  *     property alen:
- *         '''aligned length of the read (read only).  Returns None if
+ *         '''aligned length of the read on the reference genome.  Returns None if
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -21276,8 +21340,8 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2395
- *         '''aligned length of the read (read only).  Returns None if
+/* "csamtools.pyx":2463
+ *         '''aligned length of the read on the reference genome.  Returns None if
  *         not available.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
  *             cdef bam1_t * src
@@ -21295,9 +21359,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx
   int __pyx_t_5;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2395);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2463);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2397
+  /* "csamtools.pyx":2465
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -21306,19 +21370,19 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2398
+  /* "csamtools.pyx":2466
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:             # <<<<<<<<<<<<<<
  *                 return None
  *             return bam_calend(&src.core,
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (!__pyx_t_3) {
     __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
@@ -21328,7 +21392,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx
   }
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2399
+    /* "csamtools.pyx":2467
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None             # <<<<<<<<<<<<<<
@@ -21343,7 +21407,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2400
+  /* "csamtools.pyx":2468
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  *             return bam_calend(&src.core,             # <<<<<<<<<<<<<<
@@ -21352,14 +21416,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx
  */
   __Pyx_XDECREF(__pyx_r);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2402
+  /* "csamtools.pyx":2470
  *             return bam_calend(&src.core,
  *                                bam1_cigar(src)) - \
  *                                self._delegate.core.pos             # <<<<<<<<<<<<<<
  * 
  *     property mapq:
  */
-  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -21379,7 +21443,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2406
+/* "csamtools.pyx":2474
  *     property mapq:
  *         """mapping quality"""
  *         def __get__(self): return self._delegate.core.qual             # <<<<<<<<<<<<<<
@@ -21393,9 +21457,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2406);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2474);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21414,22 +21478,22 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2407
+/* "csamtools.pyx":2475
  *         """mapping quality"""
  *         def __get__(self): return self._delegate.core.qual
  *         def __set__(self, qual): self._delegate.core.qual = qual             # <<<<<<<<<<<<<<
  *     property mrnm:
- *         """the :term:`reference` id of the mate """
+ *         """the :term:`reference` id of the mate
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4mapq___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_4mapq___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
+static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
   int __pyx_r;
   uint32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2407);
-  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_qual); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2475);
+  __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_qual); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual = __pyx_t_1;
 
   __pyx_r = 0;
@@ -21443,12 +21507,12 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mapq___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2410
- *     property mrnm:
- *         """the :term:`reference` id of the mate """
+/* "csamtools.pyx":2480
+ *         deprecated, use RNEXT instead.
+ *         """
  *         def __get__(self): return self._delegate.core.mtid             # <<<<<<<<<<<<<<
  *         def __set__(self, mtid): self._delegate.core.mtid = mtid
- *     property mpos:
+ *     property rnext:
  */
 
 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self); /*proto*/
@@ -21457,9 +21521,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2410);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2480);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21478,22 +21542,22 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2411
- *         """the :term:`reference` id of the mate """
+/* "csamtools.pyx":2481
+ *         """
  *         def __get__(self): return self._delegate.core.mtid
  *         def __set__(self, mtid): self._delegate.core.mtid = mtid             # <<<<<<<<<<<<<<
- *     property mpos:
- *         """the position of the mate"""
+ *     property rnext:
+ *         """the :term:`reference` id of the mate """
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4mrnm___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_4mrnm___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
+static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
   int __pyx_r;
   int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2411);
-  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2481);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1;
 
   __pyx_r = 0;
@@ -21507,23 +21571,23 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mrnm___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2414
+/* "csamtools.pyx":2484
+ *     property rnext:
+ *         """the :term:`reference` id of the mate """
+ *         def __get__(self): return self._delegate.core.mtid             # <<<<<<<<<<<<<<
+ *         def __set__(self, mtid): self._delegate.core.mtid = mtid
  *     property mpos:
- *         """the position of the mate"""
- *         def __get__(self): return self._delegate.core.mpos             # <<<<<<<<<<<<<<
- *         def __set__(self, mpos): self._delegate.core.mpos = mpos
- *     property isize:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2414);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2484);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21533,7 +21597,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__get__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21542,28 +21606,28 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2415
- *         """the position of the mate"""
- *         def __get__(self): return self._delegate.core.mpos
- *         def __set__(self, mpos): self._delegate.core.mpos = mpos             # <<<<<<<<<<<<<<
- *     property isize:
- *         """the insert size"""
+/* "csamtools.pyx":2485
+ *         """the :term:`reference` id of the mate """
+ *         def __get__(self): return self._delegate.core.mtid
+ *         def __set__(self, mtid): self._delegate.core.mtid = mtid             # <<<<<<<<<<<<<<
+ *     property mpos:
+ *         """the position of the mate
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4mpos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_4mpos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
+static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
   int __pyx_r;
   int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2415);
-  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2485);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__set__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__set__");
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -21571,23 +21635,23 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mpos___set__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2418
- *     property isize:
- *         """the insert size"""
- *         def __get__(self): return self._delegate.core.isize             # <<<<<<<<<<<<<<
- *         def __set__(self, isize): self._delegate.core.isize = isize
- *     property is_paired:
+/* "csamtools.pyx":2489
+ *         """the position of the mate
+ *         deprecated, use PNEXT instead."""
+ *         def __get__(self): return self._delegate.core.mpos             # <<<<<<<<<<<<<<
+ *         def __set__(self, mpos): self._delegate.core.mpos = mpos
+ *     property pnext:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2418);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2489);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21597,7 +21661,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.AlignedRead.isize.__get__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21606,28 +21670,28 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2419
- *         """the insert size"""
- *         def __get__(self): return self._delegate.core.isize
- *         def __set__(self, isize): self._delegate.core.isize = isize             # <<<<<<<<<<<<<<
- *     property is_paired:
- *         """true if read is paired in sequencing"""
+/* "csamtools.pyx":2490
+ *         deprecated, use PNEXT instead."""
+ *         def __get__(self): return self._delegate.core.mpos
+ *         def __set__(self, mpos): self._delegate.core.mpos = mpos             # <<<<<<<<<<<<<<
+ *     property pnext:
+ *         """the position of the mate"""
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5isize___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_5isize___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
+static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
   int __pyx_r;
   int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2419);
-  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2490);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.AlignedRead.isize.__set__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__set__");
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -21635,23 +21699,23 @@ static int __pyx_pf_9csamtools_11AlignedRead_5isize___set__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2422
- *     property is_paired:
- *         """true if read is paired in sequencing"""
- *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0             # <<<<<<<<<<<<<<
- *         def __set__(self,val):
- *             if val: self._delegate.core.flag |= BAM_FPAIRED
+/* "csamtools.pyx":2493
+ *     property pnext:
+ *         """the position of the mate"""
+ *         def __get__(self): return self._delegate.core.mpos             # <<<<<<<<<<<<<<
+ *         def __set__(self, mpos): self._delegate.core.mpos = mpos
+ *     property isize:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2422);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2493);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong(((((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -21661,7 +21725,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__get__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21670,51 +21734,28 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2423
- *         """true if read is paired in sequencing"""
- *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
- *         def __set__(self,val):             # <<<<<<<<<<<<<<
- *             if val: self._delegate.core.flag |= BAM_FPAIRED
- *             else: self._delegate.core.flag &= ~BAM_FPAIRED
+/* "csamtools.pyx":2494
+ *         """the position of the mate"""
+ *         def __get__(self): return self._delegate.core.mpos
+ *         def __set__(self, mpos): self._delegate.core.mpos = mpos             # <<<<<<<<<<<<<<
+ *     property isize:
+ *         """the insert size
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_9is_paired___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_9is_paired___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
   int __pyx_r;
-  int __pyx_t_1;
+  int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2423);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2424
- *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
- *         def __set__(self,val):
- *             if val: self._delegate.core.flag |= BAM_FPAIRED             # <<<<<<<<<<<<<<
- *             else: self._delegate.core.flag &= ~BAM_FPAIRED
- *     property is_proper_pair:
- */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 1;
-    goto __pyx_L5;
-  }
-  /*else*/ {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2425
- *         def __set__(self,val):
- *             if val: self._delegate.core.flag |= BAM_FPAIRED
- *             else: self._delegate.core.flag &= ~BAM_FPAIRED             # <<<<<<<<<<<<<<
- *     property is_proper_pair:
- *         """true if read is mapped in a proper pair"""
- */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~1);
-  }
-  __pyx_L5:;
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2494);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__set__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__set__");
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -21722,31 +21763,24 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_paired___set__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2428
- *     property is_proper_pair:
- *         """true if read is mapped in a proper pair"""
- *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0             # <<<<<<<<<<<<<<
- *         def __set__(self,val):
- *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
+/* "csamtools.pyx":2498
+ *         """the insert size
+ *         deprecated: use tlen instead"""
+ *         def __get__(self): return self._delegate.core.isize             # <<<<<<<<<<<<<<
+ *         def __set__(self, isize): self._delegate.core.isize = isize
+ *     property tlen:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2428);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2498);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -21755,8 +21789,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyOb
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__get__");
+  __Pyx_AddTraceback("csamtools.AlignedRead.isize.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21765,44 +21798,267 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2429
- *         """true if read is mapped in a proper pair"""
- *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
- *         def __set__(self,val):             # <<<<<<<<<<<<<<
- *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
- *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
+/* "csamtools.pyx":2499
+ *         deprecated: use tlen instead"""
+ *         def __get__(self): return self._delegate.core.isize
+ *         def __set__(self, isize): self._delegate.core.isize = isize             # <<<<<<<<<<<<<<
+ *     property tlen:
+ *         """the insert size"""
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
   int __pyx_r;
-  int __pyx_t_1;
+  int32_t __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2429);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2430
- *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
- *         def __set__(self,val):
- *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR             # <<<<<<<<<<<<<<
- *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
- *     property is_unmapped:
- */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 2;
-    goto __pyx_L5;
-  }
-  /*else*/ {
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2499);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2431
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("csamtools.AlignedRead.isize.__set__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_TraceReturn(Py_None);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":2502
+ *     property tlen:
+ *         """the insert size"""
+ *         def __get__(self): return self._delegate.core.isize             # <<<<<<<<<<<<<<
+ *         def __set__(self, isize): self._delegate.core.isize = isize
+ *     property is_paired:
+ */
+
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__get__");
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2502);
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":2503
+ *         """the insert size"""
+ *         def __get__(self): return self._delegate.core.isize
+ *         def __set__(self, isize): self._delegate.core.isize = isize             # <<<<<<<<<<<<<<
+ *     property is_paired:
+ *         """true if read is paired in sequencing"""
+ */
+
+static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
+  int __pyx_r;
+  int32_t __pyx_t_1;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__set__");
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2503);
+  __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__set__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_TraceReturn(Py_None);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":2506
+ *     property is_paired:
+ *         """true if read is paired in sequencing"""
+ *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0             # <<<<<<<<<<<<<<
+ *         def __set__(self,val):
+ *             if val: self._delegate.core.flag |= BAM_FPAIRED
+ */
+
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__get__");
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2506);
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyBool_FromLong(((((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":2507
+ *         """true if read is paired in sequencing"""
+ *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
+ *         def __set__(self,val):             # <<<<<<<<<<<<<<
+ *             if val: self._delegate.core.flag |= BAM_FPAIRED
+ *             else: self._delegate.core.flag &= ~BAM_FPAIRED
+ */
+
+static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+  int __pyx_r;
+  int __pyx_t_1;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__set__");
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2507);
+
+  /* "csamtools.pyx":2508
+ *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
+ *         def __set__(self,val):
+ *             if val: self._delegate.core.flag |= BAM_FPAIRED             # <<<<<<<<<<<<<<
+ *             else: self._delegate.core.flag &= ~BAM_FPAIRED
+ *     property is_proper_pair:
+ */
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_1) {
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1);
+    goto __pyx_L5;
+  }
+  /*else*/ {
+
+    /* "csamtools.pyx":2509
+ *         def __set__(self,val):
+ *             if val: self._delegate.core.flag |= BAM_FPAIRED
+ *             else: self._delegate.core.flag &= ~BAM_FPAIRED             # <<<<<<<<<<<<<<
+ *     property is_proper_pair:
+ *         """true if read is mapped in a proper pair"""
+ */
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1));
+  }
+  __pyx_L5:;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__set__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_TraceReturn(Py_None);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":2512
+ *     property is_proper_pair:
+ *         """true if read is mapped in a proper pair"""
+ *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0             # <<<<<<<<<<<<<<
+ *         def __set__(self,val):
+ *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
+ */
+
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__get__");
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2512);
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "csamtools.pyx":2513
+ *         """true if read is mapped in a proper pair"""
+ *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
+ *         def __set__(self,val):             # <<<<<<<<<<<<<<
+ *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
+ *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
+ */
+
+static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+  int __pyx_r;
+  int __pyx_t_1;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__set__");
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2513);
+
+  /* "csamtools.pyx":2514
+ *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
+ *         def __set__(self,val):
+ *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR             # <<<<<<<<<<<<<<
+ *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
+ *     property is_unmapped:
+ */
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_1) {
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 2);
+    goto __pyx_L5;
+  }
+  /*else*/ {
+
+    /* "csamtools.pyx":2515
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
  *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR             # <<<<<<<<<<<<<<
  *     property is_unmapped:
  *         """true if read itself is unmapped"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~2);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~2));
   }
   __pyx_L5:;
 
@@ -21817,7 +22073,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___set__(PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2434
+/* "csamtools.pyx":2518
  *     property is_unmapped:
  *         """true if read itself is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0             # <<<<<<<<<<<<<<
@@ -21832,14 +22088,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObjec
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2434);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2518);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -21860,7 +22116,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2435
+/* "csamtools.pyx":2519
  *         """true if read itself is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -21868,36 +22124,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObjec
  *             else: self._delegate.core.flag &= ~BAM_FUNMAP
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2435);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2519);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2436
+  /* "csamtools.pyx":2520
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FUNMAP             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FUNMAP
  *     property mate_is_unmapped:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 4;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 4);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2437
+    /* "csamtools.pyx":2521
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FUNMAP
  *             else: self._delegate.core.flag &= ~BAM_FUNMAP             # <<<<<<<<<<<<<<
  *     property mate_is_unmapped:
  *         """true if the mate is unmapped"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~4);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~4));
   }
   __pyx_L5:;
 
@@ -21912,7 +22168,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___set__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2440
+/* "csamtools.pyx":2524
  *     property mate_is_unmapped:
  *         """true if the mate is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0             # <<<<<<<<<<<<<<
@@ -21927,14 +22183,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(Py
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2440);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2524);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -21955,7 +22211,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2441
+/* "csamtools.pyx":2525
  *         """true if the mate is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -21963,36 +22219,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(Py
  *             else: self._delegate.core.flag &= ~BAM_FMUNMAP
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2441);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2525);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2442
+  /* "csamtools.pyx":2526
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMUNMAP             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FMUNMAP
  *     property is_reverse:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 8;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 8);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2443
+    /* "csamtools.pyx":2527
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMUNMAP
  *             else: self._delegate.core.flag &= ~BAM_FMUNMAP             # <<<<<<<<<<<<<<
  *     property is_reverse:
  *         """true if read is mapped to reverse strand"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~8);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~8));
   }
   __pyx_L5:;
 
@@ -22007,7 +22263,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___set__(PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2446
+/* "csamtools.pyx":2530
  *     property is_reverse:
  *         """true if read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0             # <<<<<<<<<<<<<<
@@ -22022,14 +22278,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2446);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2530);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22050,7 +22306,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2447
+/* "csamtools.pyx":2531
  *         """true if read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22058,36 +22314,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FREVERSE
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2447);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2531);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2448
+  /* "csamtools.pyx":2532
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREVERSE             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FREVERSE
  *     property mate_is_reverse:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 16;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 16);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2449
+    /* "csamtools.pyx":2533
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREVERSE
  *             else: self._delegate.core.flag &= ~BAM_FREVERSE             # <<<<<<<<<<<<<<
  *     property mate_is_reverse:
  *         """true is read is mapped to reverse strand"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~16);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~16));
   }
   __pyx_L5:;
 
@@ -22102,7 +22358,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse___set__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2452
+/* "csamtools.pyx":2536
  *     property mate_is_reverse:
  *         """true is read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0             # <<<<<<<<<<<<<<
@@ -22117,14 +22373,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyO
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2452);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2536);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22145,7 +22401,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2453
+/* "csamtools.pyx":2537
  *         """true is read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22153,36 +22409,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyO
  *             else: self._delegate.core.flag &= ~BAM_FMREVERSE
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2453);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2537);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2454
+  /* "csamtools.pyx":2538
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMREVERSE             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FMREVERSE
  *     property is_read1:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 32;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 32);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2455
+    /* "csamtools.pyx":2539
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMREVERSE
  *             else: self._delegate.core.flag &= ~BAM_FMREVERSE             # <<<<<<<<<<<<<<
  *     property is_read1:
  *         """true if this is read1"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~32);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~32));
   }
   __pyx_L5:;
 
@@ -22197,7 +22453,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___set__(PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2458
+/* "csamtools.pyx":2542
  *     property is_read1:
  *         """true if this is read1"""
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0             # <<<<<<<<<<<<<<
@@ -22212,14 +22468,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *_
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2458);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2542);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22240,7 +22496,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2459
+/* "csamtools.pyx":2543
  *         """true if this is read1"""
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22248,36 +22504,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *_
  *             else: self._delegate.core.flag &= ~BAM_FREAD1
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read1___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read1___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2459);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2543);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2460
+  /* "csamtools.pyx":2544
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD1             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FREAD1
  *     property is_read2:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 64;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 64);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2461
+    /* "csamtools.pyx":2545
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD1
  *             else: self._delegate.core.flag &= ~BAM_FREAD1             # <<<<<<<<<<<<<<
  *     property is_read2:
  *         """true if this is read2"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~64);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~64));
   }
   __pyx_L5:;
 
@@ -22292,7 +22548,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read1___set__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2464
+/* "csamtools.pyx":2548
  *     property is_read2:
  *         """true if this is read2"""
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0             # <<<<<<<<<<<<<<
@@ -22307,14 +22563,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *_
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2464);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2548);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22335,7 +22591,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2465
+/* "csamtools.pyx":2549
  *         """true if this is read2"""
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22343,36 +22599,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *_
  *             else: self._delegate.core.flag &= ~BAM_FREAD2
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read2___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read2___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2465);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2549);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2466
+  /* "csamtools.pyx":2550
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD2             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FREAD2
  *     property is_secondary:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 128;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 128);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2467
+    /* "csamtools.pyx":2551
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD2
  *             else: self._delegate.core.flag &= ~BAM_FREAD2             # <<<<<<<<<<<<<<
  *     property is_secondary:
  *         """true if not primary alignment"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~128);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~128));
   }
   __pyx_L5:;
 
@@ -22387,7 +22643,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read2___set__(PyObject *__pyx_v
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2470
+/* "csamtools.pyx":2554
  *     property is_secondary:
  *         """true if not primary alignment"""
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0             # <<<<<<<<<<<<<<
@@ -22402,14 +22658,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObje
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2470);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2554);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22430,7 +22686,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2471
+/* "csamtools.pyx":2555
  *         """true if not primary alignment"""
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22438,36 +22694,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObje
  *             else: self._delegate.core.flag &= ~BAM_FSECONDARY
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2471);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2555);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2472
+  /* "csamtools.pyx":2556
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FSECONDARY             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FSECONDARY
  *     property is_qcfail:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 256;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 256);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2473
+    /* "csamtools.pyx":2557
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FSECONDARY
  *             else: self._delegate.core.flag &= ~BAM_FSECONDARY             # <<<<<<<<<<<<<<
  *     property is_qcfail:
  *         """true if QC failure"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~256);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~256));
   }
   __pyx_L5:;
 
@@ -22482,7 +22738,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary___set__(PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2476
+/* "csamtools.pyx":2560
  *     property is_qcfail:
  *         """true if QC failure"""
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0             # <<<<<<<<<<<<<<
@@ -22497,14 +22753,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2476);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2560);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_512); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_512); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22525,7 +22781,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2477
+/* "csamtools.pyx":2561
  *         """true if QC failure"""
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22533,36 +22789,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *
  *             else: self._delegate.core.flag &= ~BAM_FQCFAIL
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2477);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2561);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2478
+  /* "csamtools.pyx":2562
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FQCFAIL             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FQCFAIL
  *     property is_duplicate:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 512;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 512);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2479
+    /* "csamtools.pyx":2563
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FQCFAIL
  *             else: self._delegate.core.flag &= ~BAM_FQCFAIL             # <<<<<<<<<<<<<<
  *     property is_duplicate:
  *         """true if optical or PCR duplicate"""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~512);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~512));
   }
   __pyx_L5:;
 
@@ -22577,7 +22833,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___set__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2482
+/* "csamtools.pyx":2566
  *     property is_duplicate:
  *         """true if optical or PCR duplicate"""
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0             # <<<<<<<<<<<<<<
@@ -22592,14 +22848,14 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObje
   PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2482);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2566);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_1024); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_1024); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
@@ -22620,7 +22876,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2483
+/* "csamtools.pyx":2567
  *         """true if optical or PCR duplicate"""
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -22628,36 +22884,36 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObje
  *             else: self._delegate.core.flag &= ~BAM_FDUP
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2483);
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2567);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2484
+  /* "csamtools.pyx":2568
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FDUP             # <<<<<<<<<<<<<<
  *             else: self._delegate.core.flag &= ~BAM_FDUP
  *     property positions:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag |= 1024;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1024);
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2485
+    /* "csamtools.pyx":2569
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FDUP
  *             else: self._delegate.core.flag &= ~BAM_FDUP             # <<<<<<<<<<<<<<
  *     property positions:
  *         """a list of reference positions that this read aligns to."""
  */
-    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag &= (~1024);
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1024));
   }
   __pyx_L5:;
 
@@ -22672,7 +22928,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___set__(PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2488
+/* "csamtools.pyx":2572
  *     property positions:
  *         """a list of reference positions that this read aligns to."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -22699,24 +22955,24 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
   int __pyx_t_6;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2488);
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2572);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2494
+  /* "csamtools.pyx":2578
  *             cdef bam1_t * src
  * 
  *             result = []             # <<<<<<<<<<<<<<
  *             src = self._delegate
  *             if src.core.n_cigar == 0: return []
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_result));
   __pyx_v_result = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2495
+  /* "csamtools.pyx":2579
  * 
  *             result = []
  *             src = self._delegate             # <<<<<<<<<<<<<<
@@ -22725,7 +22981,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2496
+  /* "csamtools.pyx":2580
  *             result = []
  *             src = self._delegate
  *             if src.core.n_cigar == 0: return []             # <<<<<<<<<<<<<<
@@ -22735,7 +22991,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
   __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0);
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __pyx_r = ((PyObject *)__pyx_t_1);
     __pyx_t_1 = 0;
@@ -22744,7 +23000,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2498
+  /* "csamtools.pyx":2582
  *             if src.core.n_cigar == 0: return []
  * 
  *             pos = src.core.pos             # <<<<<<<<<<<<<<
@@ -22753,7 +23009,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
  */
   __pyx_v_pos = __pyx_v_src->core.pos;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2500
+  /* "csamtools.pyx":2584
  *             pos = src.core.pos
  * 
  *             cigar_p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -22762,7 +23018,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2501
+  /* "csamtools.pyx":2585
  * 
  *             cigar_p = bam1_cigar(src)
  *             for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -22772,7 +23028,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
   __pyx_t_3 = __pyx_v_src->core.n_cigar;
   for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2502
+    /* "csamtools.pyx":2586
  *             cigar_p = bam1_cigar(src)
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -22781,20 +23037,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
  */
     __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2503
+    /* "csamtools.pyx":2587
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  *                 if op == BAM_CMATCH:
  *                     for i from pos <= i < pos + l:
  */
-    __pyx_t_1 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_l);
     __pyx_v_l = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2504
+    /* "csamtools.pyx":2588
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
@@ -22804,23 +23060,23 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
     __pyx_t_2 = (__pyx_v_op == 0);
     if (__pyx_t_2) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2505
+      /* "csamtools.pyx":2589
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 if op == BAM_CMATCH:
  *                     for i from pos <= i < pos + l:             # <<<<<<<<<<<<<<
  *                         result.append( i )
  * 
  */
-      __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2506
+        /* "csamtools.pyx":2590
  *                 if op == BAM_CMATCH:
  *                     for i from pos <= i < pos + l:
  *                         result.append( i )             # <<<<<<<<<<<<<<
@@ -22828,18 +23084,18 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  */
         if (unlikely(__pyx_v_result == Py_None)) {
-          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       }
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2508
+    /* "csamtools.pyx":2592
  *                         result.append( i )
  * 
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
@@ -22851,25 +23107,31 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
       case 2:
       case 3:
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2509
+      /* "csamtools.pyx":2593
  * 
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  *                     pos += l             # <<<<<<<<<<<<<<
  * 
  *             return result
  */
-      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_l); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_pos += __pyx_t_5;
+      __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_v_pos = __pyx_t_5;
       break;
     }
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2511
+  /* "csamtools.pyx":2595
  *                     pos += l
  * 
  *             return result             # <<<<<<<<<<<<<<
+ * 
  *     def overlap( self, uint32_t start, uint32_t end ):
- *         """return number of bases on reference overlapping *start* and *end*
  */
   __Pyx_XDECREF(__pyx_r);
   __Pyx_INCREF(((PyObject *)__pyx_v_result));
@@ -22892,17 +23154,17 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2512
- * 
+/* "csamtools.pyx":2597
  *             return result
+ * 
  *     def overlap( self, uint32_t start, uint32_t end ):             # <<<<<<<<<<<<<<
- *         """return number of bases on reference overlapping *start* and *end*
- *         """
+ *         """return number of aligned bases of read overlapping the interval *start* and *end*
+ *         on the reference sequence.
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_overlap[] = "AlignedRead.overlap(self, uint32_t start, uint32_t end)\nreturn number of bases on reference overlapping *start* and *end*\n        ";
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_5overlap[] = "AlignedRead.overlap(self, uint32_t start, uint32_t end)\nreturn number of aligned bases of read overlapping the interval *start* and *end*\n        on the reference sequence.\n        ";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   uint32_t __pyx_v_start;
   uint32_t __pyx_v_end;
   uint32_t __pyx_v_k;
@@ -22927,7 +23189,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("overlap");
-  __Pyx_TraceCall("overlap", __pyx_f[0], 2512);
+  __Pyx_TraceCall("overlap", __pyx_f[0], 2597);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[2] = {0,0};
@@ -22946,23 +23208,23 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(values[0]); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(values[1]); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(values[0]); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(values[1]); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     goto __pyx_L5_argtuple_error;
   } else {
-    __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.AlignedRead.overlap");
   __Pyx_RefNannyFinishContext();
@@ -22970,7 +23232,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2520
+  /* "csamtools.pyx":2606
  *         cdef bam1_t * src
  * 
  *         overlap = 0             # <<<<<<<<<<<<<<
@@ -22979,7 +23241,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
   __pyx_v_overlap = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2522
+  /* "csamtools.pyx":2608
  *         overlap = 0
  * 
  *         src = self._delegate             # <<<<<<<<<<<<<<
@@ -22988,7 +23250,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
   __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2523
+  /* "csamtools.pyx":2609
  * 
  *         src = self._delegate
  *         if src.core.n_cigar == 0: return 0             # <<<<<<<<<<<<<<
@@ -23005,7 +23267,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2524
+  /* "csamtools.pyx":2610
  *         src = self._delegate
  *         if src.core.n_cigar == 0: return 0
  *         pos = src.core.pos             # <<<<<<<<<<<<<<
@@ -23014,7 +23276,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
   __pyx_v_pos = __pyx_v_src->core.pos;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2525
+  /* "csamtools.pyx":2611
  *         if src.core.n_cigar == 0: return 0
  *         pos = src.core.pos
  *         o = 0             # <<<<<<<<<<<<<<
@@ -23023,7 +23285,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
   __pyx_v_o = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2527
+  /* "csamtools.pyx":2613
  *         o = 0
  * 
  *         cigar_p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -23032,7 +23294,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2528
+  /* "csamtools.pyx":2614
  * 
  *         cigar_p = bam1_cigar(src)
  *         for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -23042,7 +23304,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
   __pyx_t_2 = __pyx_v_src->core.n_cigar;
   for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2529
+    /* "csamtools.pyx":2615
  *         cigar_p = bam1_cigar(src)
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -23051,20 +23313,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
     __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2530
+    /* "csamtools.pyx":2616
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  * 
  *             if op == BAM_CMATCH:
  */
-    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_v_l);
     __pyx_v_l = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2532
+    /* "csamtools.pyx":2618
  *             l = cigar_p[k] >> BAM_CIGAR_SHIFT
  * 
  *             if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
@@ -23074,7 +23336,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
     __pyx_t_1 = (__pyx_v_op == 0);
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2533
+      /* "csamtools.pyx":2619
  * 
  *             if op == BAM_CMATCH:
  *                 o = min( pos + l, end) - max( pos, start )             # <<<<<<<<<<<<<<
@@ -23082,20 +23344,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  * 
  */
       __pyx_t_4 = __pyx_v_end;
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_1) {
-        __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_3 = __pyx_t_7;
         __pyx_t_7 = 0;
@@ -23111,17 +23373,17 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
       } else {
         __pyx_t_9 = __pyx_t_8;
       }
-      __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_v_o = __pyx_t_10;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2534
+      /* "csamtools.pyx":2620
  *             if op == BAM_CMATCH:
  *                 o = min( pos + l, end) - max( pos, start )
  *                 if o > 0: overlap += o             # <<<<<<<<<<<<<<
@@ -23130,7 +23392,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  */
       __pyx_t_1 = (__pyx_v_o > 0);
       if (__pyx_t_1) {
-        __pyx_v_overlap += __pyx_v_o;
+        __pyx_v_overlap = (__pyx_v_overlap + __pyx_v_o);
         goto __pyx_L10;
       }
       __pyx_L10:;
@@ -23138,7 +23400,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2536
+    /* "csamtools.pyx":2622
  *                 if o > 0: overlap += o
  * 
  *             if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
@@ -23150,20 +23412,26 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
       case 2:
       case 3:
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2537
+      /* "csamtools.pyx":2623
  * 
  *             if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  *                 pos += l             # <<<<<<<<<<<<<<
  * 
  *         return overlap
  */
-      __pyx_t_9 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_l); if (unlikely((__pyx_t_9 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_pos += __pyx_t_9;
+      __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_9 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_v_pos = __pyx_t_9;
       break;
     }
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2539
+  /* "csamtools.pyx":2625
  *                 pos += l
  * 
  *         return overlap             # <<<<<<<<<<<<<<
@@ -23171,10 +23439,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  *     def opt(self, tag):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_r = __pyx_t_7;
-  __pyx_t_7 = 0;
+  __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -23194,7 +23462,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2541
+/* "csamtools.pyx":2627
  *         return overlap
  * 
  *     def opt(self, tag):             # <<<<<<<<<<<<<<
@@ -23202,9 +23470,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_overlap(PyObject *__pyx_v_sel
  *         #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_6opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
   uint8_t *__pyx_v_v;
   PyObject *__pyx_v_type;
   PyObject *__pyx_r = NULL;
@@ -23218,20 +23486,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
   int __pyx_t_8;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("opt");
-  __Pyx_TraceCall("opt", __pyx_f[0], 2541);
+  __Pyx_TraceCall("opt", __pyx_f[0], 2627);
   __pyx_v_type = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2545
+  /* "csamtools.pyx":2631
  *         #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
  *         cdef uint8_t * v
  *         v = bam_aux_get(self._delegate, tag)             # <<<<<<<<<<<<<<
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )
  *         type = chr(v[0])
  */
-  __pyx_t_1 = PyBytes_AsString(__pyx_v_tag); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyBytes_AsString(__pyx_v_tag); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_v = bam_aux_get(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate, __pyx_t_1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2546
+  /* "csamtools.pyx":2632
  *         cdef uint8_t * v
  *         v = bam_aux_get(self._delegate, tag)
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )             # <<<<<<<<<<<<<<
@@ -23240,69 +23508,69 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  */
   __pyx_t_2 = (__pyx_v_v == NULL);
   if (__pyx_t_2) {
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_75), __pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_135), __pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2547
+  /* "csamtools.pyx":2633
  *         v = bam_aux_get(self._delegate, tag)
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )
  *         type = chr(v[0])             # <<<<<<<<<<<<<<
  *         if type == 'c' or type == 'C' or type == 's' or type == 'S':
  *             return <int>bam_aux2i(v)
  */
-  __pyx_t_3 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_chr, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_v_type);
   __pyx_v_type = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2548
+  /* "csamtools.pyx":2634
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )
  *         type = chr(v[0])
  *         if type == 'c' or type == 'C' or type == 's' or type == 'S':             # <<<<<<<<<<<<<<
  *             return <int>bam_aux2i(v)
  *         elif type == 'i' or type == 'I':
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (!__pyx_t_2) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__C), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__C), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (!__pyx_t_5) {
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__s), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__s), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       if (!__pyx_t_6) {
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __pyx_t_8 = __pyx_t_7;
       } else {
@@ -23318,7 +23586,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
   }
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2549
+    /* "csamtools.pyx":2635
  *         type = chr(v[0])
  *         if type == 'c' or type == 'C' or type == 's' or type == 'S':
  *             return <int>bam_aux2i(v)             # <<<<<<<<<<<<<<
@@ -23326,7 +23594,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *             return <int32_t>bam_aux2i(v)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_r = __pyx_t_3;
     __pyx_t_3 = 0;
@@ -23334,21 +23602,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2550
+  /* "csamtools.pyx":2636
  *         if type == 'c' or type == 'C' or type == 's' or type == 'S':
  *             return <int>bam_aux2i(v)
  *         elif type == 'i' or type == 'I':             # <<<<<<<<<<<<<<
  *             return <int32_t>bam_aux2i(v)
  *         elif type == 'f' or type == 'F':
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (!__pyx_t_5) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_6 = __pyx_t_2;
   } else {
@@ -23356,7 +23624,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
   }
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2551
+    /* "csamtools.pyx":2637
  *             return <int>bam_aux2i(v)
  *         elif type == 'i' or type == 'I':
  *             return <int32_t>bam_aux2i(v)             # <<<<<<<<<<<<<<
@@ -23364,7 +23632,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *             return <float>bam_aux2f(v)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(bam_aux2i(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(bam_aux2i(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_r = __pyx_t_3;
     __pyx_t_3 = 0;
@@ -23372,21 +23640,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2552
+  /* "csamtools.pyx":2638
  *         elif type == 'i' or type == 'I':
  *             return <int32_t>bam_aux2i(v)
  *         elif type == 'f' or type == 'F':             # <<<<<<<<<<<<<<
  *             return <float>bam_aux2f(v)
  *         elif type == 'd' or type == 'D':
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (!__pyx_t_6) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__F), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__F), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_2 = __pyx_t_5;
   } else {
@@ -23394,7 +23662,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
   }
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2553
+    /* "csamtools.pyx":2639
  *             return <int32_t>bam_aux2i(v)
  *         elif type == 'f' or type == 'F':
  *             return <float>bam_aux2f(v)             # <<<<<<<<<<<<<<
@@ -23402,7 +23670,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *             return <double>bam_aux2d(v)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyFloat_FromDouble(bam_aux2f(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyFloat_FromDouble(bam_aux2f(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_r = __pyx_t_3;
     __pyx_t_3 = 0;
@@ -23410,21 +23678,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2554
+  /* "csamtools.pyx":2640
  *         elif type == 'f' or type == 'F':
  *             return <float>bam_aux2f(v)
  *         elif type == 'd' or type == 'D':             # <<<<<<<<<<<<<<
  *             return <double>bam_aux2d(v)
  *         elif type == 'A':
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__d), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__d), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (!__pyx_t_2) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_5 = __pyx_t_6;
   } else {
@@ -23432,7 +23700,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
   }
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2555
+    /* "csamtools.pyx":2641
  *             return <float>bam_aux2f(v)
  *         elif type == 'd' or type == 'D':
  *             return <double>bam_aux2d(v)             # <<<<<<<<<<<<<<
@@ -23440,7 +23708,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *             # there might a more efficient way
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyFloat_FromDouble(bam_aux2d(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyFloat_FromDouble(bam_aux2d(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_r = __pyx_t_3;
     __pyx_t_3 = 0;
@@ -23448,20 +23716,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2556
+  /* "csamtools.pyx":2642
  *         elif type == 'd' or type == 'D':
  *             return <double>bam_aux2d(v)
  *         elif type == 'A':             # <<<<<<<<<<<<<<
  *             # there might a more efficient way
  *             # to convert a char into a string
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2559
+    /* "csamtools.pyx":2645
  *             # there might a more efficient way
  *             # to convert a char into a string
  *             return '%c' % <char>bam_aux2A(v)             # <<<<<<<<<<<<<<
@@ -23469,9 +23737,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *             return <char*>bam_aux2Z(v)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyInt_FromLong(bam_aux2A(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(bam_aux2A(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_r = ((PyObject *)__pyx_t_4);
@@ -23480,20 +23748,20 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2560
+  /* "csamtools.pyx":2646
  *             # to convert a char into a string
  *             return '%c' % <char>bam_aux2A(v)
  *         elif type == 'Z':             # <<<<<<<<<<<<<<
  *             return <char*>bam_aux2Z(v)
  * 
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2561
+    /* "csamtools.pyx":2647
  *             return '%c' % <char>bam_aux2A(v)
  *         elif type == 'Z':
  *             return <char*>bam_aux2Z(v)             # <<<<<<<<<<<<<<
@@ -23501,7 +23769,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *     def fancy_str (self):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_4 = PyBytes_FromString(bam_aux2Z(__pyx_v_v)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyBytes_FromString(bam_aux2Z(__pyx_v_v)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __pyx_r = ((PyObject *)__pyx_t_4);
     __pyx_t_4 = 0;
@@ -23525,7 +23793,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2563
+/* "csamtools.pyx":2649
  *             return <char*>bam_aux2Z(v)
  * 
  *     def fancy_str (self):             # <<<<<<<<<<<<<<
@@ -23533,9 +23801,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_opt(PyObject *__pyx_v_self, P
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n        ";
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_7fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n        ";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_v_ret_string;
   PyObject *__pyx_v_field_names;
   PyObject *__pyx_v_fields_names_in_order;
@@ -23553,64 +23821,64 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
   int __pyx_t_10;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("fancy_str");
-  __Pyx_TraceCall("fancy_str", __pyx_f[0], 2563);
-  __pyx_v_ret_string = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
-  __pyx_v_field_names = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
-  __pyx_v_fields_names_in_order = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("fancy_str", __pyx_f[0], 2649);
+  __pyx_v_ret_string = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_field_names = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_fields_names_in_order = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2566
+  /* "csamtools.pyx":2652
  *         """returns list of fieldnames/values in pretty format for debugging
  *         """
  *         ret_string = []             # <<<<<<<<<<<<<<
  *         field_names = {
  *            "tid":           "Contig index",
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_ret_string));
   __pyx_v_ret_string = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2567
+  /* "csamtools.pyx":2653
  *         """
  *         ret_string = []
  *         field_names = {             # <<<<<<<<<<<<<<
  *            "tid":           "Contig index",
  *            "pos":           "Mapped position on contig",
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tid), ((PyObject *)__pyx_kp_s_76)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_kp_s_77)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mtid), ((PyObject *)__pyx_kp_s_78)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mpos), ((PyObject *)__pyx_kp_s_79)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__isize), ((PyObject *)__pyx_kp_s_80)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__flag), ((PyObject *)__pyx_kp_s_81)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__n_cigar), ((PyObject *)__pyx_kp_s_82)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__cigar), ((PyObject *)__pyx_kp_s_83)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_kp_s_84)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bin), ((PyObject *)__pyx_kp_s_85)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qname), ((PyObject *)__pyx_kp_s_86)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qname), ((PyObject *)__pyx_kp_s_87)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qseq), ((PyObject *)__pyx_kp_s_88)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qseq), ((PyObject *)__pyx_kp_s_89)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bqual), ((PyObject *)__pyx_kp_s_90)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_aux), ((PyObject *)__pyx_kp_s_91)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__m_data), ((PyObject *)__pyx_kp_s_92)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__data_len), ((PyObject *)__pyx_kp_s_93)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tid), ((PyObject *)__pyx_kp_s_136)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_kp_s_137)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mtid), ((PyObject *)__pyx_kp_s_138)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mpos), ((PyObject *)__pyx_kp_s_139)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__isize), ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__flag), ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__n_cigar), ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__cigar), ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bin), ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qname), ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qname), ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qseq), ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qseq), ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bqual), ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_aux), ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__m_data), ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__data_len), ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_v_field_names));
   __pyx_v_field_names = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2587
+  /* "csamtools.pyx":2673
  *            "data_len":      "Current data length",
  *            }
  *         fields_names_in_order = ["tid", "pos", "mtid", "mpos", "isize", "flag",             # <<<<<<<<<<<<<<
  *                                  "n_cigar", "cigar", "qual", "bin", "l_qname", "qname",
  *                                  "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
  */
-  __pyx_t_1 = PyList_New(18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__tid));
   PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tid));
@@ -23670,18 +23938,17 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
   __pyx_v_fields_names_in_order = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2591
+  /* "csamtools.pyx":2677
  *                                  "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
  * 
  *         for f in fields_names_in_order:             # <<<<<<<<<<<<<<
  *             if not f in self.__dict__:
  *                 continue
  */
-  if (likely(((PyObject *)__pyx_v_fields_names_in_order) != Py_None)) {
-    __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields_names_in_order); __Pyx_INCREF(__pyx_t_1);
-  } else {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__pyx_v_fields_names_in_order == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
+  __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields_names_in_order); __Pyx_INCREF(__pyx_t_1);
   for (;;) {
     if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
     __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
@@ -23689,21 +23956,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
     __pyx_v_f = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2592
+    /* "csamtools.pyx":2678
  * 
  *         for f in fields_names_in_order:
  *             if not f in self.__dict__:             # <<<<<<<<<<<<<<
  *                 continue
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_v_f))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_v_f))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_5 = (!__pyx_t_4);
     if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2593
+      /* "csamtools.pyx":2679
  *         for f in fields_names_in_order:
  *             if not f in self.__dict__:
  *                 continue             # <<<<<<<<<<<<<<
@@ -23715,7 +23982,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2594
+    /* "csamtools.pyx":2680
  *             if not f in self.__dict__:
  *                 continue
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))             # <<<<<<<<<<<<<<
@@ -23723,28 +23990,28 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
  *         for f in self.__dict__:
  */
     if (unlikely(__pyx_v_ret_string == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_field_names), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_field_names), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_95), __pyx_v_f); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_155), __pyx_v_f); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_7 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_96)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_156)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     __Pyx_INCREF(__pyx_v_f);
     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
     __Pyx_GIVEREF(__pyx_v_f);
-    __pyx_t_9 = PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
@@ -23754,28 +24021,28 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
     __pyx_t_3 = 0;
     __pyx_t_7 = 0;
     __pyx_t_9 = 0;
-    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_94), __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_154), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_ret_string), ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __pyx_L5_continue:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2596
+  /* "csamtools.pyx":2682
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
  * 
  *         for f in self.__dict__:             # <<<<<<<<<<<<<<
  *             if not f in field_names:
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
     __pyx_t_2 = 0; __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9);
   } else {
-    __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -23789,7 +24056,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
     } else {
       __pyx_t_1 = PyIter_Next(__pyx_t_9);
       if (!__pyx_t_1) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
       __Pyx_GOTREF(__pyx_t_1);
@@ -23798,22 +24065,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
     __pyx_v_f = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2597
+    /* "csamtools.pyx":2683
  * 
  *         for f in self.__dict__:
  *             if not f in field_names:             # <<<<<<<<<<<<<<
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  *         return ret_string
  */
-    if (unlikely(((PyObject *)__pyx_v_field_names) == Py_None)) {
-      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {
-      __pyx_t_5 = ((PyDict_Contains(((PyObject *)__pyx_v_field_names), __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_v_field_names == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
+    __pyx_t_5 = ((PyDict_Contains(((PyObject *)__pyx_v_field_names), __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (!__pyx_t_5);
     if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2598
+      /* "csamtools.pyx":2684
  *         for f in self.__dict__:
  *             if not f in field_names:
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))             # <<<<<<<<<<<<<<
@@ -23821,34 +24087,34 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
  * 
  */
       if (unlikely(__pyx_v_ret_string == Py_None)) {
-        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
-      __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
+      PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_12));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
       PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_94), __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_154), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_ret_string), ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+      __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       goto __pyx_L10;
     }
@@ -23856,7 +24122,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
   }
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2599
+  /* "csamtools.pyx":2685
  *             if not f in field_names:
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  *         return ret_string             # <<<<<<<<<<<<<<
@@ -23890,7 +24156,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_fancy_str(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2623
+/* "csamtools.pyx":2709
  *     cdef int n_pu
  * 
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -23902,38 +24168,30 @@ static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, Py
 static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_r;
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__init__");
-  __Pyx_TraceCall("__init__", __pyx_f[0], 2623);
+  __Pyx_TraceCall("__init__", __pyx_f[0], 2709);
   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2624
+  /* "csamtools.pyx":2710
  * 
  *     def __init__(self):
  *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
  * 
  *     def __str__(self):
  */
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_158), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_97));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_97));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_97));
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_Raise(__pyx_t_1, 0, 0);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_Raise(__pyx_t_2, 0, 0);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_AddTraceback("csamtools.PileupProxy.__init__");
   __pyx_r = -1;
   __pyx_L0:;
@@ -23942,7 +24200,7 @@ static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2626
+/* "csamtools.pyx":2712
  *         raise TypeError("This class cannot be instantiated from Python")
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -23950,8 +24208,8 @@ static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, Py
  *             "\n" +\
  */
 
-static PyObject *__pyx_pf_9csamtools_11PileupProxy___str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_11PileupProxy___str__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -23960,9 +24218,9 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy___str__(PyObject *__pyx_v_sel
   PyObject *__pyx_t_5 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__str__");
-  __Pyx_TraceCall("__str__", __pyx_f[0], 2626);
+  __Pyx_TraceCall("__str__", __pyx_f[0], 2712);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2627
+  /* "csamtools.pyx":2713
  * 
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
@@ -23971,31 +24229,31 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy___str__(PyObject *__pyx_v_sel
  */
   __Pyx_XDECREF(__pyx_r);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2628
+  /* "csamtools.pyx":2714
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" +\             # <<<<<<<<<<<<<<
  *             "\n".join( map(str, self.pileups) )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2627
+  /* "csamtools.pyx":2713
  * 
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
  *             "\n" +\
  *             "\n".join( map(str, self.pileups) )
  */
-  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
@@ -24005,62 +24263,62 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy___str__(PyObject *__pyx_v_sel
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_builtin_map, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2629
+  /* "csamtools.pyx":2715
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" +\
  *             "\n".join( map(str, self.pileups) )             # <<<<<<<<<<<<<<
  * 
  *     property tid:
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_builtin_map, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -24085,7 +24343,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy___str__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2633
+/* "csamtools.pyx":2719
  *     property tid:
  *         '''the chromosome ID as is defined in the header'''
  *         def __get__(self): return self.tid             # <<<<<<<<<<<<<<
@@ -24099,9 +24357,9 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2633);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2719);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24120,7 +24378,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2637
+/* "csamtools.pyx":2723
  *     property n:
  *         '''number of reads mapping to this column.'''
  *         def __get__(self): return self.n_pu             # <<<<<<<<<<<<<<
@@ -24134,9 +24392,9 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2637);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2723);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24155,7 +24413,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2638
+/* "csamtools.pyx":2724
  *         '''number of reads mapping to this column.'''
  *         def __get__(self): return self.n_pu
  *         def __set__(self, n): self.n_pu = n             # <<<<<<<<<<<<<<
@@ -24163,14 +24421,14 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_
  *     property pos:
  */
 
-static int __pyx_pf_9csamtools_11PileupProxy_1n___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
-static int __pyx_pf_9csamtools_11PileupProxy_1n___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
+static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
+static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
   int __pyx_r;
   int __pyx_t_1;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_TraceCall("__set__", __pyx_f[0], 2638);
-  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_n); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_TraceCall("__set__", __pyx_f[0], 2724);
+  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_n); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu = __pyx_t_1;
 
   __pyx_r = 0;
@@ -24184,7 +24442,7 @@ static int __pyx_pf_9csamtools_11PileupProxy_1n___set__(PyObject *__pyx_v_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2641
+/* "csamtools.pyx":2727
  * 
  *     property pos:
  *         def __get__(self): return self.pos             # <<<<<<<<<<<<<<
@@ -24198,9 +24456,9 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2641);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2727);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24219,7 +24477,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2645
+/* "csamtools.pyx":2731
  *     property pileups:
  *         '''list of reads (:class:`pysam.PileupRead`) aligned to this column'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24237,23 +24495,23 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__
   int __pyx_t_3;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2645);
-  __pyx_v_pileups = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2731);
+  __pyx_v_pileups = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2647
+  /* "csamtools.pyx":2733
  *         def __get__(self):
  *             cdef int x
  *             pileups = []             # <<<<<<<<<<<<<<
  *             # warning: there could be problems if self.n and self.buf are
  *             # out of sync.
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_pileups));
   __pyx_v_pileups = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2650
+  /* "csamtools.pyx":2736
  *             # warning: there could be problems if self.n and self.buf are
  *             # out of sync.
  *             for x from 0 <= x < self.n_pu:             # <<<<<<<<<<<<<<
@@ -24263,7 +24521,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__
   __pyx_t_2 = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2651
+    /* "csamtools.pyx":2737
  *             # out of sync.
  *             for x from 0 <= x < self.n_pu:
  *                 pileups.append( makePileupRead( &(self.plp[x])) )             # <<<<<<<<<<<<<<
@@ -24271,15 +24529,15 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__
  * 
  */
     if (unlikely(__pyx_v_pileups == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->plp[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->plp[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_pileups), __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyList_Append(__pyx_v_pileups, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2652
+  /* "csamtools.pyx":2738
  *             for x from 0 <= x < self.n_pu:
  *                 pileups.append( makePileupRead( &(self.plp[x])) )
  *             return pileups             # <<<<<<<<<<<<<<
@@ -24305,7 +24563,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2667
+/* "csamtools.pyx":2753
  *          uint32_t _is_tail
  * 
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -24317,38 +24575,30 @@ static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyO
 static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_r;
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__init__");
-  __Pyx_TraceCall("__init__", __pyx_f[0], 2667);
+  __Pyx_TraceCall("__init__", __pyx_f[0], 2753);
   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
     __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2668
+  /* "csamtools.pyx":2754
  * 
  *     def __init__(self):
  *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
  * 
  *     def __str__(self):
  */
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_159), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_97));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_97));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_97));
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_Raise(__pyx_t_1, 0, 0);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_Raise(__pyx_t_2, 0, 0);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_AddTraceback("csamtools.PileupRead.__init__");
   __pyx_r = -1;
   __pyx_L0:;
@@ -24357,7 +24607,7 @@ static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2670
+/* "csamtools.pyx":2756
  *         raise TypeError("This class cannot be instantiated from Python")
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -24365,8 +24615,8 @@ static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyO
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead___str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_10PileupRead___str__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -24379,9 +24629,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead___str__(PyObject *__pyx_v_self
   PyObject *__pyx_t_9 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__str__");
-  __Pyx_TraceCall("__str__", __pyx_f[0], 2670);
+  __Pyx_TraceCall("__str__", __pyx_f[0], 2756);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2671
+  /* "csamtools.pyx":2757
  * 
  *     def __str__(self):
  *         return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) )             # <<<<<<<<<<<<<<
@@ -24389,24 +24639,24 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead___str__(PyObject *__pyx_v_self
  *     property alignment:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
@@ -24428,26 +24678,26 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead___str__(PyObject *__pyx_v_self
   __pyx_t_6 = 0;
   __pyx_t_7 = 0;
   __pyx_t_8 = 0;
-  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
+  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
   __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_builtin_map, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
   __Pyx_GIVEREF(__pyx_t_9);
   __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
   __pyx_r = __pyx_t_9;
   __pyx_t_9 = 0;
   goto __pyx_L0;
@@ -24473,7 +24723,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead___str__(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2675
+/* "csamtools.pyx":2761
  *     property alignment:
  *         """a :class:`pysam.AlignedRead` object of the aligned read"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24486,9 +24736,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *_
   PyObject *__pyx_r = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2675);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2761);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2676
+  /* "csamtools.pyx":2762
  *         """a :class:`pysam.AlignedRead` object of the aligned read"""
  *         def __get__(self):
  *             return self._alignment             # <<<<<<<<<<<<<<
@@ -24508,7 +24758,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2679
+/* "csamtools.pyx":2765
  *     property qpos:
  *         """position of the read base at the pileup site, 0-based"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24522,9 +24772,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2679);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2765);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2680
+  /* "csamtools.pyx":2766
  *         """position of the read base at the pileup site, 0-based"""
  *         def __get__(self):
  *             return self._qpos             # <<<<<<<<<<<<<<
@@ -24532,7 +24782,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24551,7 +24801,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2683
+/* "csamtools.pyx":2769
  *     property indel:
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24565,9 +24815,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2683);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2769);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2684
+  /* "csamtools.pyx":2770
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
  *         def __get__(self):
  *             return self._indel             # <<<<<<<<<<<<<<
@@ -24575,7 +24825,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx
  *         """1 iff the base on the padded read is a deletion"""
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24594,7 +24844,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2687
+/* "csamtools.pyx":2773
  *     property is_del:
  *         """1 iff the base on the padded read is a deletion"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24608,9 +24858,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__py
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2687);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2773);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2688
+  /* "csamtools.pyx":2774
  *         """1 iff the base on the padded read is a deletion"""
  *         def __get__(self):
  *             return self._is_del             # <<<<<<<<<<<<<<
@@ -24618,7 +24868,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__py
  *         def __get__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24637,7 +24887,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2690
+/* "csamtools.pyx":2776
  *             return self._is_del
  *     property is_head:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24651,9 +24901,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__p
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2690);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2776);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2691
+  /* "csamtools.pyx":2777
  *     property is_head:
  *         def __get__(self):
  *             return self._is_head             # <<<<<<<<<<<<<<
@@ -24661,7 +24911,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__p
  *         def __get__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24680,7 +24930,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2693
+/* "csamtools.pyx":2779
  *             return self._is_head
  *     property is_tail:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24694,9 +24944,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__p
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2693);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2779);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2694
+  /* "csamtools.pyx":2780
  *     property is_tail:
  *         def __get__(self):
  *             return self._is_tail             # <<<<<<<<<<<<<<
@@ -24704,7 +24954,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__p
  *         def __get__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24723,7 +24973,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2696
+/* "csamtools.pyx":2782
  *             return self._is_tail
  *     property level:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24737,9 +24987,9 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2696);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2782);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2697
+  /* "csamtools.pyx":2783
  *     property level:
  *         def __get__(self):
  *             return self._level             # <<<<<<<<<<<<<<
@@ -24747,7 +24997,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx
  * class Outs:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -24766,7 +25016,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2701
+/* "csamtools.pyx":2787
  * class Outs:
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
  *     def __init__(self, id = 1):             # <<<<<<<<<<<<<<
@@ -24785,7 +25035,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObje
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__init__");
-  __Pyx_TraceCall("__init__", __pyx_f[0], 2701);
+  __Pyx_TraceCall("__init__", __pyx_f[0], 2787);
   __pyx_self = __pyx_self;
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
@@ -24809,7 +25059,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObje
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_self = values[0];
     __pyx_v_id = values[1];
@@ -24824,33 +25074,33 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObje
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Outs.__init__");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2702
+  /* "csamtools.pyx":2788
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
  *     def __init__(self, id = 1):
  *         self.streams = []             # <<<<<<<<<<<<<<
  *         self.id = id
  * 
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__streams, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__streams, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2703
+  /* "csamtools.pyx":2789
  *     def __init__(self, id = 1):
  *         self.streams = []
  *         self.id = id             # <<<<<<<<<<<<<<
  * 
  *     def setdevice(self, filename):
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -24865,7 +25115,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2705
+/* "csamtools.pyx":2791
  *         self.id = id
  * 
  *     def setdevice(self, filename):             # <<<<<<<<<<<<<<
@@ -24873,10 +25123,10 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObje
  *         fd = os.open(filename, os.O_WRONLY)
  */
 
-static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pf_9csamtools_4Outs_setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_setdevice)};
-static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_1setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_1setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pf_9csamtools_4Outs_1setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_1setdevice)};
+static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_fd;
@@ -24887,7 +25137,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObj
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("setdevice");
-  __Pyx_TraceCall("setdevice", __pyx_f[0], 2705);
+  __Pyx_TraceCall("setdevice", __pyx_f[0], 2791);
   __pyx_self = __pyx_self;
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
@@ -24907,11 +25157,11 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObj
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_self = values[0];
     __pyx_v_filename = values[1];
@@ -24923,7 +25173,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObj
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Outs.setdevice");
   __Pyx_RefNannyFinishContext();
@@ -24931,57 +25181,57 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObj
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2707
+  /* "csamtools.pyx":2793
  *     def setdevice(self, filename):
  *         '''open an existing file, like "/dev/null"'''
  *         fd = os.open(filename, os.O_WRONLY)             # <<<<<<<<<<<<<<
  *         self.setfd(fd)
  * 
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
   __Pyx_GIVEREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_v_fd);
   __pyx_v_fd = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2708
+  /* "csamtools.pyx":2794
  *         '''open an existing file, like "/dev/null"'''
  *         fd = os.open(filename, os.O_WRONLY)
  *         self.setfd(fd)             # <<<<<<<<<<<<<<
  * 
  *     def setfile(self, filename):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -25000,7 +25250,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObj
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2710
+/* "csamtools.pyx":2796
  *         self.setfd(fd)
  * 
  *     def setfile(self, filename):             # <<<<<<<<<<<<<<
@@ -25008,10 +25258,10 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setdevice(PyObject *__pyx_self, PyObj
  *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
  */
 
-static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pf_9csamtools_4Outs_setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_setfile)};
-static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_2setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_2setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pf_9csamtools_4Outs_2setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_2setfile)};
+static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_fd;
@@ -25023,7 +25273,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("setfile");
-  __Pyx_TraceCall("setfile", __pyx_f[0], 2710);
+  __Pyx_TraceCall("setfile", __pyx_f[0], 2796);
   __pyx_self = __pyx_self;
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
@@ -25043,11 +25293,11 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_self = values[0];
     __pyx_v_filename = values[1];
@@ -25059,7 +25309,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Outs.setfile");
   __Pyx_RefNannyFinishContext();
@@ -25067,34 +25317,34 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2712
+  /* "csamtools.pyx":2798
  *     def setfile(self, filename):
  *         '''open a new file.'''
  *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);             # <<<<<<<<<<<<<<
  *         self.setfd(fd)
  * 
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_CREAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_CREAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Or(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Or(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
   __Pyx_GIVEREF(__pyx_v_filename);
@@ -25104,32 +25354,32 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0660);
   __Pyx_GIVEREF(__pyx_int_0660);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_v_fd);
   __pyx_v_fd = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2713
+  /* "csamtools.pyx":2799
  *         '''open a new file.'''
  *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
  *         self.setfd(fd)             # <<<<<<<<<<<<<<
  * 
  *     def setfd(self, fd):
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -25149,7 +25399,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2715
+/* "csamtools.pyx":2801
  *         self.setfd(fd)
  * 
  *     def setfd(self, fd):             # <<<<<<<<<<<<<<
@@ -25157,10 +25407,10 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfile(PyObject *__pyx_self, PyObjec
  *         self.streams.append(ofd)
  */
 
-static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_setfd[] = "Outs.setfd(self, fd)";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pf_9csamtools_4Outs_setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_setfd)};
-static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_3setfd[] = "Outs.setfd(self, fd)";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_3setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pf_9csamtools_4Outs_3setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_3setfd)};
+static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_fd = 0;
   PyObject *__pyx_v_ofd;
@@ -25171,7 +25421,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("setfd");
-  __Pyx_TraceCall("setfd", __pyx_f[0], 2715);
+  __Pyx_TraceCall("setfd", __pyx_f[0], 2801);
   __pyx_self = __pyx_self;
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
@@ -25191,11 +25441,11 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_self = values[0];
     __pyx_v_fd = values[1];
@@ -25207,7 +25457,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools.Outs.setfd");
   __Pyx_RefNannyFinishContext();
@@ -25215,136 +25465,136 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_ofd = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2716
+  /* "csamtools.pyx":2802
  * 
  *     def setfd(self, fd):
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.             # <<<<<<<<<<<<<<
  *         self.streams.append(ofd)
  *         sys.stdout.flush()          #  Buffered data goes to old stream.
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_v_ofd);
   __pyx_v_ofd = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2717
+  /* "csamtools.pyx":2803
  *     def setfd(self, fd):
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.
  *         self.streams.append(ofd)             # <<<<<<<<<<<<<<
  *         sys.stdout.flush()          #  Buffered data goes to old stream.
  *         sys.stderr.flush()          #  Buffered data goes to old stream.
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_ofd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_ofd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2718
+  /* "csamtools.pyx":2804
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.
  *         self.streams.append(ofd)
  *         sys.stdout.flush()          #  Buffered data goes to old stream.             # <<<<<<<<<<<<<<
  *         sys.stderr.flush()          #  Buffered data goes to old stream.
  *         os.dup2(fd, self.id)        #  Open unit 1 on new stream.
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2719
+  /* "csamtools.pyx":2805
  *         self.streams.append(ofd)
  *         sys.stdout.flush()          #  Buffered data goes to old stream.
  *         sys.stderr.flush()          #  Buffered data goes to old stream.             # <<<<<<<<<<<<<<
  *         os.dup2(fd, self.id)        #  Open unit 1 on new stream.
  *         os.close(fd)                #  Close other unit (look out, caller.)
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2720
+  /* "csamtools.pyx":2806
  *         sys.stdout.flush()          #  Buffered data goes to old stream.
  *         sys.stderr.flush()          #  Buffered data goes to old stream.
  *         os.dup2(fd, self.id)        #  Open unit 1 on new stream.             # <<<<<<<<<<<<<<
  *         os.close(fd)                #  Close other unit (look out, caller.)
  * 
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dup2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dup2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2721
+  /* "csamtools.pyx":2807
  *         sys.stderr.flush()          #  Buffered data goes to old stream.
  *         os.dup2(fd, self.id)        #  Open unit 1 on new stream.
  *         os.close(fd)                #  Close other unit (look out, caller.)             # <<<<<<<<<<<<<<
  * 
  *     def restore(self):
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -25363,7 +25613,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2723
+/* "csamtools.pyx":2809
  *         os.close(fd)                #  Close other unit (look out, caller.)
  * 
  *     def restore(self):             # <<<<<<<<<<<<<<
@@ -25371,10 +25621,10 @@ static PyObject *__pyx_pf_9csamtools_4Outs_setfd(PyObject *__pyx_self, PyObject
  *         if self.streams:
  */
 
-static PyObject *__pyx_pf_9csamtools_4Outs_restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_restore[] = "Outs.restore(self)\nrestore previous output stream";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pf_9csamtools_4Outs_restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_restore)};
-static PyObject *__pyx_pf_9csamtools_4Outs_restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_4restore[] = "Outs.restore(self)\nrestore previous output stream";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_4restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pf_9csamtools_4Outs_4restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_4restore)};
+static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
@@ -25383,133 +25633,133 @@ static PyObject *__pyx_pf_9csamtools_4Outs_restore(PyObject *__pyx_self, PyObjec
   PyObject *__pyx_t_5 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("restore");
-  __Pyx_TraceCall("restore", __pyx_f[0], 2723);
+  __Pyx_TraceCall("restore", __pyx_f[0], 2809);
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2725
+  /* "csamtools.pyx":2811
  *     def restore(self):
  *         '''restore previous output stream'''
  *         if self.streams:             # <<<<<<<<<<<<<<
  *             # the following was not sufficient, hence flush both stderr and stdout
  *             # os.fsync( self.id )
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2728
+    /* "csamtools.pyx":2814
  *             # the following was not sufficient, hence flush both stderr and stdout
  *             # os.fsync( self.id )
  *             sys.stdout.flush()             # <<<<<<<<<<<<<<
  *             sys.stderr.flush()
  *             os.dup2(self.streams[-1], self.id)
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stdout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stdout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2729
+    /* "csamtools.pyx":2815
  *             # os.fsync( self.id )
  *             sys.stdout.flush()
  *             sys.stderr.flush()             # <<<<<<<<<<<<<<
  *             os.dup2(self.streams[-1], self.id)
  *             os.close(self.streams[-1])
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2730
+    /* "csamtools.pyx":2816
  *             sys.stdout.flush()
  *             sys.stderr.flush()
  *             os.dup2(self.streams[-1], self.id)             # <<<<<<<<<<<<<<
  *             os.close(self.streams[-1])
  *             del self.streams[-1]
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_4 = 0;
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2731
+    /* "csamtools.pyx":2817
  *             sys.stderr.flush()
  *             os.dup2(self.streams[-1], self.id)
  *             os.close(self.streams[-1])             # <<<<<<<<<<<<<<
  *             del self.streams[-1]
  * 
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2732
+    /* "csamtools.pyx":2818
  *             os.dup2(self.streams[-1], self.id)
  *             os.close(self.streams[-1])
  *             del self.streams[-1]             # <<<<<<<<<<<<<<
  * 
  * def _samtools_dispatch( method,
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    if (__Pyx_DelItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_DelItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     goto __pyx_L5;
   }
@@ -25531,7 +25781,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_restore(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2734
+/* "csamtools.pyx":2820
  *             del self.streams[-1]
  * 
  * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
@@ -25540,7 +25790,8 @@ static PyObject *__pyx_pf_9csamtools_4Outs_restore(PyObject *__pyx_self, PyObjec
  */
 
 static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools__samtools_dispatch[] = "_samtools_dispatch(method, args=(), catch_stdout=True, catch_stderr=False)\ncall ``method`` in samtools providing arguments in args.\n    \n    .. note:: \n       This method redirects stdout and stderr to capture it \n       from samtools. If for some reason stdout/stderr disappears\n       the reason might be in this method.\n\n    .. note::\n       The current implementation might only work on linux.\n       \n    .. note:: \n       This method captures stdout and stderr using temporary files, \n       which are then read into memory in their entirety. This method\n       is slow and might cause large memory overhead. \n\n    See http://bytes.com/topic/c/answers/487231-how-capture-stdout-temporarily\n    on the topic of redirecting stderr/stdout.\n    ";
+static char __pyx_doc_9csamtools__samtools_dispatch[] = "_samtools_dispatch(method, args=(), catch_stdout=True, catch_stderr=False)\ncall ``method`` in samtools providing arguments in args.\n    \n    .. note:: \n       This method redirects stdout and (optionally) stderr to capture it \n       from samtools. If for some reason stdout/stderr disappears\n       the reason might be in this method.\n\n    .. note::\n       The current implementation might only work on linux.\n       \n    .. note:: \n       This method captures stdout and stderr using temporary files, \n       which are then read into memory in their entirety. This method\n       is slow and might cause large memory overhead. \n\n    See http://bytes.com/topic/c/answers/487231-how-capture-stdout-temporarily\n    on the topic of redirecting stderr/stdout.\n    ";
+static PyMethodDef __pyx_mdef_9csamtools__samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pf_9csamtools__samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)};
 static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_method = 0;
   PyObject *__pyx_v_args = 0;
@@ -25571,13 +25822,13 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,&__pyx_n_s__catch_stderr,0};
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("_samtools_dispatch");
-  __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 2734);
+  __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 2820);
   __pyx_self = __pyx_self;
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[4] = {0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2735
+    /* "csamtools.pyx":2821
  * 
  * def _samtools_dispatch( method,
  *                         args = (),             # <<<<<<<<<<<<<<
@@ -25585,8 +25836,8 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
  *                         catch_stderr = False,
  */
     values[1] = ((PyObject *)__pyx_empty_tuple);
-    values[2] = __pyx_k_98;
-    values[3] = __pyx_k_99;
+    values[2] = __pyx_k_160;
+    values[3] = __pyx_k_161;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -25617,7 +25868,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2734; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_method = values[0];
     __pyx_v_args = values[1];
@@ -25625,8 +25876,8 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
     __pyx_v_catch_stderr = values[3];
   } else {
     __pyx_v_args = ((PyObject *)__pyx_empty_tuple);
-    __pyx_v_catch_stdout = __pyx_k_98;
-    __pyx_v_catch_stderr = __pyx_k_99;
+    __pyx_v_catch_stdout = __pyx_k_160;
+    __pyx_v_catch_stderr = __pyx_k_161;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  4: __pyx_v_catch_stderr = PyTuple_GET_ITEM(__pyx_args, 3);
       case  3: __pyx_v_catch_stdout = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -25638,7 +25889,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_samtools_dispatch", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2734; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("_samtools_dispatch", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("csamtools._samtools_dispatch");
   __Pyx_RefNannyFinishContext();
@@ -25654,73 +25905,73 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   __pyx_v_out_stdout = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_out_stderr = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2762
+  /* "csamtools.pyx":2848
  * 
  *     # some special cases
  *     if method == "index":             # <<<<<<<<<<<<<<
  *         if not os.path.exists( args[0] ):
  *             raise IOError( "No such file or directory: '%s'" % args[0] )
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2763
+    /* "csamtools.pyx":2849
  *     # some special cases
  *     if method == "index":
  *         if not os.path.exists( args[0] ):             # <<<<<<<<<<<<<<
  *             raise IOError( "No such file or directory: '%s'" % args[0] )
  * 
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_5 = (!__pyx_t_2);
     if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2764
+      /* "csamtools.pyx":2850
  *     if method == "index":
  *         if not os.path.exists( args[0] ):
  *             raise IOError( "No such file or directory: '%s'" % args[0] )             # <<<<<<<<<<<<<<
  * 
  *     # redirect stderr and stdout to file
  */
-      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_100), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_162), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
       PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
       __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
       __Pyx_Raise(__pyx_t_4, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L7;
     }
     __pyx_L7:;
@@ -25728,29 +25979,29 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2767
+  /* "csamtools.pyx":2853
  * 
  *     # redirect stderr and stdout to file
  *     if catch_stderr:             # <<<<<<<<<<<<<<
  *         stderr_h, stderr_f = tempfile.mkstemp()
  *         stderr_save = Outs( sys.stderr.fileno() )
  */
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2768
+    /* "csamtools.pyx":2854
  *     # redirect stderr and stdout to file
  *     if catch_stderr:
  *         stderr_h, stderr_f = tempfile.mkstemp()             # <<<<<<<<<<<<<<
  *         stderr_save = Outs( sys.stderr.fileno() )
  *         stderr_save.setfd( stderr_h )
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
@@ -25765,14 +26016,14 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
       __pyx_v_stderr_f = __pyx_t_1;
       __pyx_t_1 = 0;
     } else {
-      __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_v_stderr_h);
       __pyx_v_stderr_h = __pyx_t_3;
@@ -25782,85 +26033,85 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
       __pyx_t_1 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2769
+    /* "csamtools.pyx":2855
  *     if catch_stderr:
  *         stderr_h, stderr_f = tempfile.mkstemp()
  *         stderr_save = Outs( sys.stderr.fileno() )             # <<<<<<<<<<<<<<
  *         stderr_save.setfd( stderr_h )
  * 
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__fileno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__fileno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_stderr_save);
     __pyx_v_stderr_save = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2770
+    /* "csamtools.pyx":2856
  *         stderr_h, stderr_f = tempfile.mkstemp()
  *         stderr_save = Outs( sys.stderr.fileno() )
  *         stderr_save.setfd( stderr_h )             # <<<<<<<<<<<<<<
  * 
  *     if catch_stdout:
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_stderr_h);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stderr_h);
     __Pyx_GIVEREF(__pyx_v_stderr_h);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     goto __pyx_L8;
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2772
+  /* "csamtools.pyx":2858
  *         stderr_save.setfd( stderr_h )
  * 
  *     if catch_stdout:             # <<<<<<<<<<<<<<
  *         stdout_h, stdout_f = tempfile.mkstemp()
  *         stdout_save = Outs( sys.stdout.fileno() )
  */
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2773
+    /* "csamtools.pyx":2859
  * 
  *     if catch_stdout:
  *         stdout_h, stdout_f = tempfile.mkstemp()             # <<<<<<<<<<<<<<
  *         stdout_save = Outs( sys.stdout.fileno() )
  *         stdout_save.setfd( stdout_h )
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
@@ -25875,14 +26126,14 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
       __pyx_v_stdout_f = __pyx_t_3;
       __pyx_t_3 = 0;
     } else {
-      __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_v_stdout_h);
       __pyx_v_stdout_h = __pyx_t_1;
@@ -25892,117 +26143,111 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
       __pyx_t_3 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2774
+    /* "csamtools.pyx":2860
  *     if catch_stdout:
  *         stdout_h, stdout_f = tempfile.mkstemp()
  *         stdout_save = Outs( sys.stdout.fileno() )             # <<<<<<<<<<<<<<
  *         stdout_save.setfd( stdout_h )
  * 
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_stdout_save);
     __pyx_v_stdout_save = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2775
+    /* "csamtools.pyx":2861
  *         stdout_h, stdout_f = tempfile.mkstemp()
  *         stdout_save = Outs( sys.stdout.fileno() )
  *         stdout_save.setfd( stdout_h )             # <<<<<<<<<<<<<<
  * 
  *         # patch for `samtools view`
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(__pyx_v_stdout_h);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_h);
     __Pyx_GIVEREF(__pyx_v_stdout_h);
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2780
+    /* "csamtools.pyx":2866
  *         # samtools `view` closes stdout, from which I can not
  *         # recover. Thus redirect output to file with -o option.
  *         if method == "view":             # <<<<<<<<<<<<<<
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
  *             args = ( "-o", stdout_f ) + args
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2781
+      /* "csamtools.pyx":2867
  *         # recover. Thus redirect output to file with -o option.
  *         if method == "view":
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")             # <<<<<<<<<<<<<<
  *             args = ( "-o", stdout_f ) + args
  * 
  */
-      __pyx_t_5 = ((PySequence_Contains(__pyx_v_args, ((PyObject *)__pyx_kp_s_101)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = ((PySequence_Contains(__pyx_v_args, ((PyObject *)__pyx_kp_s_163)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_5) {
-        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_165), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_102));
-        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_102));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_102));
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_Raise(__pyx_t_4, 0, 0);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_Raise(__pyx_t_3, 0, 0);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L11;
       }
       __pyx_L11:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2782
+      /* "csamtools.pyx":2868
  *         if method == "view":
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
  *             args = ( "-o", stdout_f ) + args             # <<<<<<<<<<<<<<
  * 
- * 
+ *     # do the function call to samtools
  */
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_101));
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_101));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_101));
+      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_163));
+      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_163));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_163));
       __Pyx_INCREF(__pyx_v_stdout_f);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_stdout_f);
+      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_stdout_f);
       __Pyx_GIVEREF(__pyx_v_stdout_f);
-      __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_args); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
       __Pyx_DECREF(__pyx_v_args);
-      __pyx_v_args = __pyx_t_4;
-      __pyx_t_4 = 0;
+      __pyx_v_args = __pyx_t_3;
+      __pyx_t_3 = 0;
       goto __pyx_L10;
     }
     __pyx_L10:;
@@ -26010,17 +26255,17 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2789
+  /* "csamtools.pyx":2874
  *     cdef int i, n, retval
  * 
  *     n = len(args)             # <<<<<<<<<<<<<<
  *     # allocate two more for first (dummy) argument (contains command)
  *     cargs = <char**>calloc( n+2, sizeof( char *) )
  */
-  __pyx_t_7 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_n = __pyx_t_7;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2791
+  /* "csamtools.pyx":2876
  *     n = len(args)
  *     # allocate two more for first (dummy) argument (contains command)
  *     cargs = <char**>calloc( n+2, sizeof( char *) )             # <<<<<<<<<<<<<<
@@ -26029,7 +26274,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
  */
   __pyx_v_cargs = ((char **)calloc((__pyx_v_n + 2), (sizeof(char *))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2792
+  /* "csamtools.pyx":2877
  *     # allocate two more for first (dummy) argument (contains command)
  *     cargs = <char**>calloc( n+2, sizeof( char *) )
  *     cargs[0] = "samtools"             # <<<<<<<<<<<<<<
@@ -26038,43 +26283,43 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
  */
   (__pyx_v_cargs[0]) = __pyx_k__samtools;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2793
+  /* "csamtools.pyx":2878
  *     cargs = <char**>calloc( n+2, sizeof( char *) )
  *     cargs[0] = "samtools"
  *     cargs[1] = method             # <<<<<<<<<<<<<<
  *     for i from 0 <= i < n: cargs[i+2] = args[i]
- *     retval = pysam_dispatch(n+2, cargs)
+ * 
  */
-  __pyx_t_8 = PyBytes_AsString(__pyx_v_method); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyBytes_AsString(__pyx_v_method); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   (__pyx_v_cargs[1]) = __pyx_t_8;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2794
+  /* "csamtools.pyx":2879
  *     cargs[0] = "samtools"
  *     cargs[1] = method
  *     for i from 0 <= i < n: cargs[i+2] = args[i]             # <<<<<<<<<<<<<<
+ * 
  *     retval = pysam_dispatch(n+2, cargs)
- *     free( cargs )
  */
   __pyx_t_9 = __pyx_v_n;
   for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {
-    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_8 = PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_8 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     (__pyx_v_cargs[(__pyx_v_i + 2)]) = __pyx_t_8;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2795
- *     cargs[1] = method
+  /* "csamtools.pyx":2881
  *     for i from 0 <= i < n: cargs[i+2] = args[i]
+ * 
  *     retval = pysam_dispatch(n+2, cargs)             # <<<<<<<<<<<<<<
  *     free( cargs )
  * 
  */
   __pyx_v_retval = pysam_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2796
- *     for i from 0 <= i < n: cargs[i+2] = args[i]
+  /* "csamtools.pyx":2882
+ * 
  *     retval = pysam_dispatch(n+2, cargs)
  *     free( cargs )             # <<<<<<<<<<<<<<
  * 
@@ -26082,92 +26327,92 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
  */
   free(__pyx_v_cargs);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2800
+  /* "csamtools.pyx":2886
  *     # restore stdout/stderr. This will also flush, so
  *     # needs to be before reading back the file contents
  *     if catch_stdout:             # <<<<<<<<<<<<<<
  *         stdout_save.restore()
  *         out_stdout = open( stdout_f, "r").readlines()
  */
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2801
+    /* "csamtools.pyx":2887
  *     # needs to be before reading back the file contents
  *     if catch_stdout:
  *         stdout_save.restore()             # <<<<<<<<<<<<<<
  *         out_stdout = open( stdout_f, "r").readlines()
  *         os.remove( stdout_f )
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2802
+    /* "csamtools.pyx":2888
  *     if catch_stdout:
  *         stdout_save.restore()
  *         out_stdout = open( stdout_f, "r").readlines()             # <<<<<<<<<<<<<<
  *         os.remove( stdout_f )
  *     else:
  */
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_INCREF(__pyx_v_stdout_f);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_f);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stdout_f);
     __Pyx_GIVEREF(__pyx_v_stdout_f);
     __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r));
+    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__r));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_out_stdout);
-    __pyx_v_out_stdout = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_out_stdout = __pyx_t_3;
+    __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2803
+    /* "csamtools.pyx":2889
  *         stdout_save.restore()
  *         out_stdout = open( stdout_f, "r").readlines()
  *         os.remove( stdout_f )             # <<<<<<<<<<<<<<
  *     else:
  *         out_stdout = []
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(__pyx_v_stdout_f);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stdout_f);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_f);
     __Pyx_GIVEREF(__pyx_v_stdout_f);
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     goto __pyx_L14;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2805
+    /* "csamtools.pyx":2891
  *         os.remove( stdout_f )
  *     else:
  *         out_stdout = []             # <<<<<<<<<<<<<<
  * 
  *     if catch_stderr:
  */
-    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_DECREF(__pyx_v_out_stdout);
     __pyx_v_out_stdout = ((PyObject *)__pyx_t_1);
@@ -26175,100 +26420,100 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   }
   __pyx_L14:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2807
+  /* "csamtools.pyx":2893
  *         out_stdout = []
  * 
  *     if catch_stderr:             # <<<<<<<<<<<<<<
  *         stderr_save.restore()
  *         out_stderr = open( stderr_f, "r").readlines()
  */
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2808
+    /* "csamtools.pyx":2894
  * 
  *     if catch_stderr:
  *         stderr_save.restore()             # <<<<<<<<<<<<<<
  *         out_stderr = open( stderr_f, "r").readlines()
  *         os.remove( stderr_f )
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2809
+    /* "csamtools.pyx":2895
  *     if catch_stderr:
  *         stderr_save.restore()
  *         out_stderr = open( stderr_f, "r").readlines()             # <<<<<<<<<<<<<<
  *         os.remove( stderr_f )
  *     else:
  */
-    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(__pyx_v_stderr_f);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stderr_f);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stderr_f);
     __Pyx_GIVEREF(__pyx_v_stderr_f);
     __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__r));
+    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_out_stderr);
     __pyx_v_out_stderr = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2810
+    /* "csamtools.pyx":2896
  *         stderr_save.restore()
  *         out_stderr = open( stderr_f, "r").readlines()
  *         os.remove( stderr_f )             # <<<<<<<<<<<<<<
  *     else:
  *         out_stderr = []
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_stderr_f);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stderr_f);
     __Pyx_GIVEREF(__pyx_v_stderr_f);
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     goto __pyx_L15;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2812
+    /* "csamtools.pyx":2898
  *         os.remove( stderr_f )
  *     else:
  *         out_stderr = []             # <<<<<<<<<<<<<<
  * 
  *     return retval, out_stderr, out_stdout
  */
-    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_DECREF(__pyx_v_out_stderr);
-    __pyx_v_out_stderr = ((PyObject *)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __pyx_v_out_stderr = ((PyObject *)__pyx_t_4);
+    __pyx_t_4 = 0;
   }
   __pyx_L15:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2814
+  /* "csamtools.pyx":2900
  *         out_stderr = []
  * 
  *     return retval, out_stderr, out_stdout             # <<<<<<<<<<<<<<
@@ -26276,20 +26521,20 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
  * cdef class SNPCall:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_4 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
   __Pyx_INCREF(__pyx_v_out_stderr);
   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_out_stderr);
   __Pyx_GIVEREF(__pyx_v_out_stderr);
   __Pyx_INCREF(__pyx_v_out_stdout);
   PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_out_stdout);
   __Pyx_GIVEREF(__pyx_v_out_stdout);
-  __pyx_t_3 = 0;
-  __pyx_r = __pyx_t_1;
+  __pyx_t_4 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
   goto __pyx_L0;
 
@@ -26318,7 +26563,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2829
+/* "csamtools.pyx":2915
  *     property tid:
  *         '''the chromosome ID as is defined in the header'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -26332,9 +26577,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_sel
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2829);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2915);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2830
+  /* "csamtools.pyx":2916
  *         '''the chromosome ID as is defined in the header'''
  *         def __get__(self):
  *             return self._tid             # <<<<<<<<<<<<<<
@@ -26342,7 +26587,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_sel
  *     property pos:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26361,7 +26606,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2834
+/* "csamtools.pyx":2920
  *     property pos:
  *        '''nucleotide position of SNP.'''
  *        def __get__(self): return self._pos             # <<<<<<<<<<<<<<
@@ -26375,9 +26620,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_sel
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2834);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2920);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26396,7 +26641,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2838
+/* "csamtools.pyx":2924
  *     property reference_base:
  *        '''reference base at pos. ``N`` if no reference sequence supplied.'''
  *        def __get__(self): return PyString_FromStringAndSize( &self._reference_base, 1 )             # <<<<<<<<<<<<<<
@@ -26410,9 +26655,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2838);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2924);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26431,7 +26676,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2842
+/* "csamtools.pyx":2928
  *     property genotype:
  *        '''the genotype called.'''
  *        def __get__(self): return PyString_FromStringAndSize( &self._genotype, 1 )             # <<<<<<<<<<<<<<
@@ -26445,9 +26690,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2842);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2928);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26466,7 +26711,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2846
+/* "csamtools.pyx":2932
  *     property consensus_quality:
  *        '''the genotype quality (Phred-scaled).'''
  *        def __get__(self): return self._consensus_quality             # <<<<<<<<<<<<<<
@@ -26480,9 +26725,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObje
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2846);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2932);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26501,7 +26746,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2850
+/* "csamtools.pyx":2936
  *     property snp_quality:
  *        '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
  *        def __get__(self): return self._snp_quality             # <<<<<<<<<<<<<<
@@ -26515,9 +26760,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2850);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2936);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26536,7 +26781,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2854
+/* "csamtools.pyx":2940
  *     property mapping_quality:
  *        '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
  *        def __get__(self): return self._rms_mapping_quality             # <<<<<<<<<<<<<<
@@ -26550,9 +26795,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2854);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2940);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26571,7 +26816,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2858
+/* "csamtools.pyx":2944
  *     property coverage:
  *        '''coverage or read depth - the number of reads involved in the call.'''
  *        def __get__(self): return self._coverage             # <<<<<<<<<<<<<<
@@ -26585,9 +26830,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_
   PyObject *__pyx_t_1 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 2858);
+  __Pyx_TraceCall("__get__", __pyx_f[0], 2944);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26606,7 +26851,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2860
+/* "csamtools.pyx":2946
  *        def __get__(self): return self._coverage
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -26629,9 +26874,9 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_t_10 = NULL;
   __Pyx_TraceDeclarations
   __Pyx_RefNannySetupContext("__str__");
-  __Pyx_TraceCall("__str__", __pyx_f[0], 2860);
+  __Pyx_TraceCall("__str__", __pyx_f[0], 2946);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2862
+  /* "csamtools.pyx":2948
  *     def __str__(self):
  * 
  *         return "\t".join( map(str, (             # <<<<<<<<<<<<<<
@@ -26639,90 +26884,90 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) {
  *                     self.pos,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2863
+  /* "csamtools.pyx":2949
  * 
  *         return "\t".join( map(str, (
  *                     self.tid,             # <<<<<<<<<<<<<<
  *                     self.pos,
  *                     self.reference_base,
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2864
+  /* "csamtools.pyx":2950
  *         return "\t".join( map(str, (
  *                     self.tid,
  *                     self.pos,             # <<<<<<<<<<<<<<
  *                     self.reference_base,
  *                     self.genotype,
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2865
+  /* "csamtools.pyx":2951
  *                     self.tid,
  *                     self.pos,
  *                     self.reference_base,             # <<<<<<<<<<<<<<
  *                     self.genotype,
  *                     self.consensus_quality,
  */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2866
+  /* "csamtools.pyx":2952
  *                     self.pos,
  *                     self.reference_base,
  *                     self.genotype,             # <<<<<<<<<<<<<<
  *                     self.consensus_quality,
  *                     self.snp_quality,
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2867
+  /* "csamtools.pyx":2953
  *                     self.reference_base,
  *                     self.genotype,
  *                     self.consensus_quality,             # <<<<<<<<<<<<<<
  *                     self.snp_quality,
  *                     self.mapping_quality,
  */
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2868
+  /* "csamtools.pyx":2954
  *                     self.genotype,
  *                     self.consensus_quality,
  *                     self.snp_quality,             # <<<<<<<<<<<<<<
  *                     self.mapping_quality,
  *                     self.coverage ) ) )
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2869
+  /* "csamtools.pyx":2955
  *                     self.consensus_quality,
  *                     self.snp_quality,
  *                     self.mapping_quality,             # <<<<<<<<<<<<<<
  *                     self.coverage ) ) )
  * 
  */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2870
+  /* "csamtools.pyx":2956
  *                     self.snp_quality,
  *                     self.mapping_quality,
  *                     self.coverage ) ) )             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
@@ -26747,26 +26992,26 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) {
   __pyx_t_7 = 0;
   __pyx_t_8 = 0;
   __pyx_t_9 = 0;
-  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
+  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_t_10));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
   __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_Call(__pyx_builtin_map, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
   __Pyx_GIVEREF(__pyx_t_10);
   __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   __pyx_r = __pyx_t_10;
   __pyx_t_10 = 0;
   goto __pyx_L0;
@@ -26793,533 +27038,504 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2891
- *     cdef IteratorColumn iter
+/* "csamtools.pyx":3472
+ *     cdef int owns_samfile
+ * 
+ *     def __init__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
+ *         self.samfile = samfile
  * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   IteratorColumn iterator_column,
- *                   **kwargs ):
  */
 
-static int __pyx_pf_9csamtools_13SNPCallerBase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_13SNPCallerBase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_iterator_column = 0;
-  PyObject *__pyx_v_kwargs = 0;
+static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
+  int __pyx_v_reopen;
+  PyObject *__pyx_v_mode;
+  PyObject *__pyx_v_store;
   int __pyx_r;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  float __pyx_t_4;
-  int __pyx_t_5;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iterator_column,0};
+  char *__pyx_t_3;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 2891);
-  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
+  __Pyx_RefNannySetupContext("__init__");
+  __Pyx_TraceCall("__init__", __pyx_f[0], 3472);
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[1] = {0};
+    PyObject* values[2] = {0,0};
     switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
       case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
       case  0: break;
       default: goto __pyx_L5_argtuple_error;
     }
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterator_column);
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
       if (likely(values[0])) kw_args--;
       else goto __pyx_L5_argtuple_error;
+      case  1:
+      if (kw_args > 0) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
+        if (value) { values[1] = value; kw_args--; }
+      }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
+    if (values[1]) {
+      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    } else {
+      __pyx_v_reopen = ((int)1);
     }
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)values[0]);
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
-    goto __pyx_L5_argtuple_error;
   } else {
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)PyTuple_GET_ITEM(__pyx_args, 0));
+    __pyx_v_reopen = ((int)1);
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      case  1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
+      break;
+      default: goto __pyx_L5_argtuple_error;
+    }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_AddTraceback("csamtools.SNPCallerBase.__cinit__");
+  __Pyx_AddTraceback("csamtools.IndexedReads.__init__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterator_column), __pyx_ptype_9csamtools_IteratorColumn, 1, "iterator_column", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2895
- *                   **kwargs ):
- * 
- *         self.iter = iterator_column             # <<<<<<<<<<<<<<
- *         self.c =  bam_maqcns_init()
- * 
- */
-  __Pyx_INCREF(((PyObject *)__pyx_v_iterator_column));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_iterator_column));
-  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->iter);
-  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->iter));
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->iter = __pyx_v_iterator_column;
+  __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2896
+  /* "csamtools.pyx":3473
  * 
- *         self.iter = iterator_column
- *         self.c =  bam_maqcns_init()             # <<<<<<<<<<<<<<
+ *     def __init__(self, Samfile samfile, int reopen = True ):
+ *         self.samfile = samfile             # <<<<<<<<<<<<<<
  * 
- *         # set the default parameterization according to
+ *         if samfile.isbam: mode = "rb"
  */
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c = bam_maqcns_init();
+  __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+  ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2902
+  /* "csamtools.pyx":3475
+ *         self.samfile = samfile
  * 
- *         # new default mode for samtools >0.1.10
- *         self.c.errmod = kwargs.get( "errmod", BAM_ERRMOD_MAQ2 )             # <<<<<<<<<<<<<<
+ *         if samfile.isbam: mode = "rb"             # <<<<<<<<<<<<<<
+ *         else: mode = "r"
  * 
- *         self.c.min_baseQ = kwargs.get( "min_baseQ", 13 )
  */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  if (__pyx_v_samfile->isbam) {
+    __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
+    __Pyx_DECREF(__pyx_v_mode);
+    __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
+    goto __pyx_L6;
   }
-  __pyx_t_1 = PyInt_FromLong(BAM_ERRMOD_MAQ2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__errmod), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->errmod = __pyx_t_3;
+  /*else*/ {
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2904
- *         self.c.errmod = kwargs.get( "errmod", BAM_ERRMOD_MAQ2 )
+    /* "csamtools.pyx":3476
+ * 
+ *         if samfile.isbam: mode = "rb"
+ *         else: mode = "r"             # <<<<<<<<<<<<<<
  * 
- *         self.c.min_baseQ = kwargs.get( "min_baseQ", 13 )             # <<<<<<<<<<<<<<
- *         # self.c.capQ_thres = kwargs.get( "capQ_threshold", 60 )
- *         self.c.n_hap = kwargs.get( "n_haplotypes", 2 )
+ *         # reopen the file - note that this makes the iterator
  */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
+    __Pyx_DECREF(__pyx_v_mode);
+    __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
   }
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_baseQ), __pyx_int_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->min_baseQ = __pyx_t_3;
+  __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2906
- *         self.c.min_baseQ = kwargs.get( "min_baseQ", 13 )
- *         # self.c.capQ_thres = kwargs.get( "capQ_threshold", 60 )
- *         self.c.n_hap = kwargs.get( "n_haplotypes", 2 )             # <<<<<<<<<<<<<<
- *         self.c.het_rate = kwargs.get( "het_rate", 0.001 )
- *         self.c.theta = kwargs.get( "theta", 0.83 )
+  /* "csamtools.pyx":3480
+ *         # reopen the file - note that this makes the iterator
+ *         # slow and causes pileup to slow down significantly.
+ *         if reopen:             # <<<<<<<<<<<<<<
+ *             store = StderrStore()
+ *             self.fp = samopen( samfile._filename, mode, NULL )
  */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__n_haplotypes), __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->n_hap = __pyx_t_3;
+  if (__pyx_v_reopen) {
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2907
- *         # self.c.capQ_thres = kwargs.get( "capQ_threshold", 60 )
- *         self.c.n_hap = kwargs.get( "n_haplotypes", 2 )
- *         self.c.het_rate = kwargs.get( "het_rate", 0.001 )             # <<<<<<<<<<<<<<
- *         self.c.theta = kwargs.get( "theta", 0.83 )
- * 
+    /* "csamtools.pyx":3481
+ *         # slow and causes pileup to slow down significantly.
+ *         if reopen:
+ *             store = StderrStore()             # <<<<<<<<<<<<<<
+ *             self.fp = samopen( samfile._filename, mode, NULL )
+ *             store.release()
  */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
-  __pyx_t_2 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__het_rate), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->het_rate = __pyx_t_4;
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_store);
+    __pyx_v_store = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2908
- *         self.c.n_hap = kwargs.get( "n_haplotypes", 2 )
- *         self.c.het_rate = kwargs.get( "het_rate", 0.001 )
- *         self.c.theta = kwargs.get( "theta", 0.83 )             # <<<<<<<<<<<<<<
- * 
- *         if self.c.errmod != BAM_ERRMOD_MAQ2:
+    /* "csamtools.pyx":3482
+ *         if reopen:
+ *             store = StderrStore()
+ *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
+ *             store.release()
+ *             assert self.fp != NULL
  */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    __pyx_t_3 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL);
+
+    /* "csamtools.pyx":3483
+ *             store = StderrStore()
+ *             self.fp = samopen( samfile._filename, mode, NULL )
+ *             store.release()             # <<<<<<<<<<<<<<
+ *             assert self.fp != NULL
+ *             self.owns_samfile = True
+ */
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+    /* "csamtools.pyx":3484
+ *             self.fp = samopen( samfile._filename, mode, NULL )
+ *             store.release()
+ *             assert self.fp != NULL             # <<<<<<<<<<<<<<
+ *             self.owns_samfile = True
+ *         else:
+ */
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    if (unlikely(!(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp != NULL))) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
+
+    /* "csamtools.pyx":3485
+ *             store.release()
+ *             assert self.fp != NULL
+ *             self.owns_samfile = True             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.fp = samfile.samfile
+ */
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 1;
+    goto __pyx_L7;
   }
-  __pyx_t_1 = PyFloat_FromDouble(0.83); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__theta), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->theta = __pyx_t_4;
+  /*else*/ {
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2910
- *         self.c.theta = kwargs.get( "theta", 0.83 )
- * 
- *         if self.c.errmod != BAM_ERRMOD_MAQ2:             # <<<<<<<<<<<<<<
- *             self.c.theta += 0.02
+    /* "csamtools.pyx":3487
+ *             self.owns_samfile = True
+ *         else:
+ *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
+ *             self.owns_samfile = False
  * 
  */
-  __pyx_t_5 = (((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->errmod != BAM_ERRMOD_MAQ2);
-  if (__pyx_t_5) {
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2911
- * 
- *         if self.c.errmod != BAM_ERRMOD_MAQ2:
- *             self.c.theta += 0.02             # <<<<<<<<<<<<<<
+    /* "csamtools.pyx":3488
+ *         else:
+ *             self.fp = samfile.samfile
+ *             self.owns_samfile = False             # <<<<<<<<<<<<<<
  * 
- *         # call prepare AFTER setting parameters
+ *         assert samfile.isbam, "can only IndexReads on bam files"
  */
-    ((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c->theta += 0.02;
-    goto __pyx_L6;
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 0;
   }
-  __pyx_L6:;
+  __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2914
+  /* "csamtools.pyx":3490
+ *             self.owns_samfile = False
  * 
- *         # call prepare AFTER setting parameters
- *         bam_maqcns_prepare( self.c )             # <<<<<<<<<<<<<<
+ *         assert samfile.isbam, "can only IndexReads on bam files"             # <<<<<<<<<<<<<<
  * 
- *     def __dealloc__(self):
+ *     def build( self ):
  */
-  bam_maqcns_prepare(((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c);
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  if (unlikely(!__pyx_v_samfile->isbam)) {
+    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_167));
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("csamtools.SNPCallerBase.__cinit__");
+  __Pyx_AddTraceback("csamtools.IndexedReads.__init__");
   __pyx_r = -1;
   __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_kwargs);
+  __Pyx_DECREF(__pyx_v_mode);
+  __Pyx_DECREF(__pyx_v_store);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2916
- *         bam_maqcns_prepare( self.c )
+/* "csamtools.pyx":3492
+ *         assert samfile.isbam, "can only IndexReads on bam files"
  * 
- *     def __dealloc__(self):             # <<<<<<<<<<<<<<
- *         bam_maqcns_destroy( self.c )
+ *     def build( self ):             # <<<<<<<<<<<<<<
+ *         '''build index.'''
  * 
  */
 
-static void __pyx_pf_9csamtools_13SNPCallerBase___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_13SNPCallerBase___dealloc__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_12IndexedReads_1build[] = "IndexedReads.build(self)\nbuild index.";
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+  int __pyx_v_ret;
+  bam1_t *__pyx_v_b;
+  uint64_t __pyx_v_pos;
+  char *__pyx_v_qname;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 2916);
+  __Pyx_RefNannySetupContext("build");
+  __Pyx_TraceCall("build", __pyx_f[0], 3492);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2917
+  /* "csamtools.pyx":3495
+ *         '''build index.'''
  * 
- *     def __dealloc__(self):
- *         bam_maqcns_destroy( self.c )             # <<<<<<<<<<<<<<
+ *         self.index = collections.defaultdict( list )             # <<<<<<<<<<<<<<
  * 
- *     cdef __dump( self, glf1_t * g, uint32_t cns, int rb ):
+ *         # this method will start indexing from the current file position
  */
-  bam_maqcns_destroy(((struct __pyx_obj_9csamtools_SNPCallerBase *)__pyx_v_self)->c);
-
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type))));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyList_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type))));
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
+  __Pyx_DECREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
+  ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index = __pyx_t_3;
+  __pyx_t_3 = 0;
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2919
- *         bam_maqcns_destroy( self.c )
- * 
- *     cdef __dump( self, glf1_t * g, uint32_t cns, int rb ):             # <<<<<<<<<<<<<<
- *         '''debugging output.'''
+  /* "csamtools.pyx":3499
+ *         # this method will start indexing from the current file position
+ *         # if you decide
+ *         cdef int ret = 1             # <<<<<<<<<<<<<<
+ *         cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )
  * 
  */
+  __pyx_v_ret = 1;
 
-static  PyObject *__pyx_f_9csamtools_13SNPCallerBase___dump(struct __pyx_obj_9csamtools_SNPCallerBase *__pyx_v_self, glf1_t *__pyx_v_g, uint32_t __pyx_v_cns, int __pyx_v_rb) {
-  int __pyx_v_x;
-  PyObject *__pyx_r = NULL;
-  int __pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dump");
-  __Pyx_TraceCall("__dump", __pyx_f[0], 2919);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2922
- *         '''debugging output.'''
+  /* "csamtools.pyx":3500
+ *         # if you decide
+ *         cdef int ret = 1
+ *         cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )             # <<<<<<<<<<<<<<
  * 
- *         pysam_dump_glf( g, self.c );             # <<<<<<<<<<<<<<
- *         print ""
- *         for x in range(self.iter.n_plp):
+ *         cdef uint64_t pos
  */
-  pysam_dump_glf(__pyx_v_g, __pyx_v_self->c);
+  __pyx_v_b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2923
+  /* "csamtools.pyx":3504
+ *         cdef uint64_t pos
  * 
- *         pysam_dump_glf( g, self.c );
- *         print ""             # <<<<<<<<<<<<<<
- *         for x in range(self.iter.n_plp):
- *             print "--> read %i %s %i" % (x,
+ *         while ret > 0:             # <<<<<<<<<<<<<<
+ *             pos = bam_tell( self.fp.x.bam )
+ *             ret = samread( self.fp, b)
  */
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  while (1) {
+    __pyx_t_4 = (__pyx_v_ret > 0);
+    if (!__pyx_t_4) break;
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2924
- *         pysam_dump_glf( g, self.c );
- *         print ""
- *         for x in range(self.iter.n_plp):             # <<<<<<<<<<<<<<
- *             print "--> read %i %s %i" % (x,
- *                                          bam1_qname(self.iter.plp[x].b),
+    /* "csamtools.pyx":3505
+ * 
+ *         while ret > 0:
+ *             pos = bam_tell( self.fp.x.bam )             # <<<<<<<<<<<<<<
+ *             ret = samread( self.fp, b)
+ *             if ret > 0:
  */
-  __pyx_t_1 = __pyx_v_self->iter->n_plp;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_x = __pyx_t_2;
+    __pyx_v_pos = bam_tell(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp->x.bam);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2925
- *         print ""
- *         for x in range(self.iter.n_plp):
- *             print "--> read %i %s %i" % (x,             # <<<<<<<<<<<<<<
- *                                          bam1_qname(self.iter.plp[x].b),
- *                                          self.iter.plp[x].qpos,
+    /* "csamtools.pyx":3506
+ *         while ret > 0:
+ *             pos = bam_tell( self.fp.x.bam )
+ *             ret = samread( self.fp, b)             # <<<<<<<<<<<<<<
+ *             if ret > 0:
+ *                 qname = bam1_qname( b )
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp, __pyx_v_b);
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2926
- *         for x in range(self.iter.n_plp):
- *             print "--> read %i %s %i" % (x,
- *                                          bam1_qname(self.iter.plp[x].b),             # <<<<<<<<<<<<<<
- *                                          self.iter.plp[x].qpos,
- *                                          )
+    /* "csamtools.pyx":3507
+ *             pos = bam_tell( self.fp.x.bam )
+ *             ret = samread( self.fp, b)
+ *             if ret > 0:             # <<<<<<<<<<<<<<
+ *                 qname = bam1_qname( b )
+ *                 self.index[qname].append( pos )
  */
-    __pyx_t_4 = PyBytes_FromString(bam1_qname((__pyx_v_self->iter->plp[__pyx_v_x]).b)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = (__pyx_v_ret > 0);
+    if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2927
- *             print "--> read %i %s %i" % (x,
- *                                          bam1_qname(self.iter.plp[x].b),
- *                                          self.iter.plp[x].qpos,             # <<<<<<<<<<<<<<
- *                                          )
+      /* "csamtools.pyx":3508
+ *             ret = samread( self.fp, b)
+ *             if ret > 0:
+ *                 qname = bam1_qname( b )             # <<<<<<<<<<<<<<
+ *                 self.index[qname].append( pos )
  * 
  */
-    __pyx_t_5 = __Pyx_PyInt_to_py_int32_t((__pyx_v_self->iter->plp[__pyx_v_x]).qpos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
-    __Pyx_GIVEREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_4));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_3 = 0;
-    __pyx_t_4 = 0;
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_104), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  }
+      __pyx_v_qname = bam1_qname(__pyx_v_b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2931
+      /* "csamtools.pyx":3509
+ *             if ret > 0:
+ *                 qname = bam1_qname( b )
+ *                 self.index[qname].append( pos )             # <<<<<<<<<<<<<<
  * 
- *         print "pos=%i, cns=%i, q_r = %f, depth=%i, n=%i, rb=%i, cns-cq=%i %i %i %i" \
- *             % (self.iter.pos,             # <<<<<<<<<<<<<<
- *                cns,
- *                self.c.q_r,
+ *         bam_destroy1( b )
  */
-  __pyx_t_5 = PyInt_FromLong(__pyx_v_self->iter->pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyBytes_FromString(__pyx_v_qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __pyx_t_3 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      goto __pyx_L7;
+    }
+    __pyx_L7:;
+  }
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2932
- *         print "pos=%i, cns=%i, q_r = %f, depth=%i, n=%i, rb=%i, cns-cq=%i %i %i %i" \
- *             % (self.iter.pos,
- *                cns,             # <<<<<<<<<<<<<<
- *                self.c.q_r,
- *                self.iter.n_plp,
+  /* "csamtools.pyx":3511
+ *                 self.index[qname].append( pos )
+ * 
+ *         bam_destroy1( b )             # <<<<<<<<<<<<<<
+ * 
+ *     def find( self, qname ):
  */
-  __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_cns); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  bam_destroy1(__pyx_v_b);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2933
- *             % (self.iter.pos,
- *                cns,
- *                self.c.q_r,             # <<<<<<<<<<<<<<
- *                self.iter.n_plp,
- *                self.iter.n_plp,
- */
-  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->c->q_r); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("csamtools.IndexedReads.build");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_TraceReturn(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2934
- *                cns,
- *                self.c.q_r,
- *                self.iter.n_plp,             # <<<<<<<<<<<<<<
- *                self.iter.n_plp,
- *                rb,
+/* "csamtools.pyx":3513
+ *         bam_destroy1( b )
+ * 
+ *     def find( self, qname ):             # <<<<<<<<<<<<<<
+ *         if qname in self.index:
+ *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
  */
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_self->iter->n_plp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2935
- *                self.c.q_r,
- *                self.iter.n_plp,
- *                self.iter.n_plp,             # <<<<<<<<<<<<<<
- *                rb,
- *                cns >> 8 & 0xff,
- */
-  __pyx_t_7 = PyInt_FromLong(__pyx_v_self->iter->n_plp); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
+static char __pyx_doc_9csamtools_12IndexedReads_2find[] = "IndexedReads.find(self, qname)";
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
+  PyObject *__pyx_r = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("find");
+  __Pyx_TraceCall("find", __pyx_f[0], 3513);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2936
- *                self.iter.n_plp,
- *                self.iter.n_plp,
- *                rb,             # <<<<<<<<<<<<<<
- *                cns >> 8 & 0xff,
- *                cns >> 16 & 0xff,
+  /* "csamtools.pyx":3514
+ * 
+ *     def find( self, qname ):
+ *         if qname in self.index:             # <<<<<<<<<<<<<<
+ *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
+ *         else:
  */
-  __pyx_t_8 = PyInt_FromLong(__pyx_v_rb); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_1) {
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2937
- *                self.iter.n_plp,
- *                rb,
- *                cns >> 8 & 0xff,             # <<<<<<<<<<<<<<
- *                cns >> 16 & 0xff,
- *                cns & 0xff,
+    /* "csamtools.pyx":3515
+ *     def find( self, qname ):
+ *         if qname in self.index:
+ *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )             # <<<<<<<<<<<<<<
+ *         else:
+ *             raise KeyError( "read %s not found" % qname )
  */
-  __pyx_t_9 = PyInt_FromLong(((__pyx_v_cns >> 8) & 0xff)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2938
- *                rb,
- *                cns >> 8 & 0xff,
- *                cns >> 16 & 0xff,             # <<<<<<<<<<<<<<
- *                cns & 0xff,
- *                cns >> 28,
- */
-  __pyx_t_10 = PyInt_FromLong(((__pyx_v_cns >> 16) & 0xff)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2939
- *                cns >> 8 & 0xff,
- *                cns >> 16 & 0xff,
- *                cns & 0xff,             # <<<<<<<<<<<<<<
- *                cns >> 28,
- *                )
- */
-  __pyx_t_11 = PyInt_FromLong((__pyx_v_cns & 0xff)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2940
- *                cns >> 16 & 0xff,
- *                cns & 0xff,
- *                cns >> 28,             # <<<<<<<<<<<<<<
- *                )
- * 
- */
-  __pyx_t_12 = PyInt_FromLong((__pyx_v_cns >> 28)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_13 = PyTuple_New(10); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_6);
-  __Pyx_GIVEREF(__pyx_t_6);
-  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_7);
-  __Pyx_GIVEREF(__pyx_t_7);
-  PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_8);
-  __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_13, 7, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_13, 8, __pyx_t_11);
-  __Pyx_GIVEREF(__pyx_t_11);
-  PyTuple_SET_ITEM(__pyx_t_13, 9, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_12);
-  __pyx_t_5 = 0;
-  __pyx_t_6 = 0;
-  __pyx_t_4 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_7 = 0;
-  __pyx_t_8 = 0;
-  __pyx_t_9 = 0;
-  __pyx_t_10 = 0;
-  __pyx_t_11 = 0;
-  __pyx_t_12 = 0;
-  __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_105), __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_12)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2943
- *                )
- * 
- *         printf("-------------------------------------\n");             # <<<<<<<<<<<<<<
- *         sys.stdout.flush()
- * 
- */
-  printf(__pyx_k_106);
+    __Pyx_XDECREF(__pyx_r);
+    __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowSelection)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_r = __pyx_t_4;
+    __pyx_t_4 = 0;
+    goto __pyx_L0;
+    goto __pyx_L5;
+  }
+  /*else*/ {
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2944
- * 
- *         printf("-------------------------------------\n");
- *         sys.stdout.flush()             # <<<<<<<<<<<<<<
+    /* "csamtools.pyx":3517
+ *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
+ *         else:
+ *             raise KeyError( "read %s not found" % qname )             # <<<<<<<<<<<<<<
  * 
- * cdef class IteratorSNPCalls( SNPCallerBase ):
+ *     def __dealloc__(self):
  */
-  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__stdout); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__flush); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), __pyx_v_qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_Raise(__pyx_t_4, 0, 0);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_AddTraceback("csamtools.SNPCallerBase.__dump");
-  __pyx_r = 0;
+  __Pyx_AddTraceback("csamtools.IndexedReads.find");
+  __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_TraceReturn(__pyx_r);
@@ -27327,5344 +27543,534 @@ static  PyObject *__pyx_f_9csamtools_13SNPCallerBase___dump(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2960
- *     """
+/* "csamtools.pyx":3519
+ *             raise KeyError( "read %s not found" % qname )
+ * 
+ *     def __dealloc__(self):             # <<<<<<<<<<<<<<
+ *         if self.owns_samfile: samclose( self.fp )
  * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   IteratorColumn iterator_column,
- *                   **kwargs ):
  */
 
-static int __pyx_pf_9csamtools_16IteratorSNPCalls___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_16IteratorSNPCalls___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_iterator_column = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iterator_column,0};
+static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 2960);
-  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[1] = {0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterator_column);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)values[0]);
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)PyTuple_GET_ITEM(__pyx_args, 0));
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_AddTraceback("csamtools.IteratorSNPCalls.__cinit__");
-  __Pyx_RefNannyFinishContext();
-  return -1;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterator_column), __pyx_ptype_9csamtools_IteratorColumn, 1, "iterator_column", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_RefNannySetupContext("__dealloc__");
+  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3519);
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2964
- *                   **kwargs ):
+  /* "csamtools.pyx":3520
  * 
- *         assert self.iter.hasReference(), "IteratorSNPCalls requires an pileup iterator with reference sequence"             # <<<<<<<<<<<<<<
+ *     def __dealloc__(self):
+ *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
  * 
- *     def __iter__(self):
+ * __all__ = ["Samfile",
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter), __pyx_n_s__hasReference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_3)) {
-    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_107));
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile) {
+    samclose(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp);
+    goto __pyx_L5;
   }
-  #endif
+  __pyx_L5:;
 
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("csamtools.IteratorSNPCalls.__cinit__");
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_kwargs);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
-  return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2966
- *         assert self.iter.hasReference(), "IteratorSNPCalls requires an pileup iterator with reference sequence"
- * 
- *     def __iter__(self):             # <<<<<<<<<<<<<<
- *         return self
- * 
- */
-
-static PyObject *__pyx_pf_9csamtools_16IteratorSNPCalls___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_16IteratorSNPCalls___iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 2966);
+static PyObject *__pyx_tp_new_9csamtools_AlignedRead(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = (*t->tp_alloc)(t, 0);
+  if (!o) return 0;
+  return o;
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2967
- * 
- *     def __iter__(self):
- *         return self             # <<<<<<<<<<<<<<
- * 
- *     def __next__(self):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(__pyx_v_self);
-  __pyx_r = __pyx_v_self;
-  goto __pyx_L0;
+static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  (*Py_TYPE(o)->tp_free)(o);
+}
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5qname___get__(o);
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2969
- *         return self
- * 
- *     def __next__(self):             # <<<<<<<<<<<<<<
- *         """python version of next().
- *         """
- */
+static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-static PyObject *__pyx_pf_9csamtools_16IteratorSNPCalls___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_16IteratorSNPCalls___next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_16IteratorSNPCalls___next__;
-static PyObject *__pyx_pf_9csamtools_16IteratorSNPCalls___next__(PyObject *__pyx_v_self) {
-  char *__pyx_v_seq;
-  int __pyx_v_seq_len;
-  int __pyx_v_rb;
-  uint32_t __pyx_v_cns;
-  glf1_t *__pyx_v_g;
-  struct __pyx_obj_9csamtools_SNPCall *__pyx_v_call;
-  PyObject *__pyx_r = NULL;
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 2969);
-  __pyx_v_call = ((struct __pyx_obj_9csamtools_SNPCall *)Py_None); __Pyx_INCREF(Py_None);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2974
- * 
- *         # the following code was adapted from bam_plcmd.c:pileup_func()
- *         self.iter.cnext()             # <<<<<<<<<<<<<<
- * 
- *         if self.iter.n_plp < 0:
- */
-  ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter);
+static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2976
- *         self.iter.cnext()
- * 
- *         if self.iter.n_plp < 0:             # <<<<<<<<<<<<<<
- *             raise ValueError("error during iteration" )
- * 
- */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->n_plp < 0);
-  if (__pyx_t_1) {
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3seq___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2977
- * 
- *         if self.iter.n_plp < 0:
- *             raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
- * 
- *         if self.iter.plp == NULL:
- */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_59));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
+static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(o, v);
   }
-  __pyx_L5:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2979
- *             raise ValueError("error during iteration" )
- * 
- *         if self.iter.plp == NULL:             # <<<<<<<<<<<<<<
- *            raise StopIteration
- * 
- */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->plp == NULL);
-  if (__pyx_t_1) {
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2980
- * 
- *         if self.iter.plp == NULL:
- *            raise StopIteration             # <<<<<<<<<<<<<<
- * 
- *         cdef char * seq = self.iter.getSequence()
- */
-    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L6;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4qual___get__(o);
+}
+
+static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(o, v);
   }
-  __pyx_L6:;
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2982
- *            raise StopIteration
- * 
- *         cdef char * seq = self.iter.getSequence()             # <<<<<<<<<<<<<<
- *         cdef int seq_len = self.iter.seq_len
- * 
- */
-  __pyx_v_seq = ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->getSequence(((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5query___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2983
- * 
- *         cdef char * seq = self.iter.getSequence()
- *         cdef int seq_len = self.iter.seq_len             # <<<<<<<<<<<<<<
- * 
- *         assert seq != NULL
- */
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter), __pyx_n_s__seq_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_seq_len = __pyx_t_4;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2985
- *         cdef int seq_len = self.iter.seq_len
- * 
- *         assert seq != NULL             # <<<<<<<<<<<<<<
- * 
- *         # reference base
- */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_seq != NULL))) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4qend___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4tags___get__(o);
+}
+
+static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(o, v);
   }
-  #endif
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2988
- * 
- *         # reference base
- *         if self.iter.pos >= seq_len:             # <<<<<<<<<<<<<<
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
- * 
- */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->pos >= __pyx_v_seq_len);
-  if (__pyx_t_1) {
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4flag___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2989
- *         # reference base
- *         if self.iter.pos >= seq_len:
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )             # <<<<<<<<<<<<<<
- * 
- *         cdef int rb = seq[self.iter.pos]
- */
-    __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyInt_FromLong(__pyx_v_seq_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
-    __Pyx_GIVEREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_3 = 0;
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_108), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L7;
+static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(o, v);
   }
-  __pyx_L7:;
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2991
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
- * 
- *         cdef int rb = seq[self.iter.pos]             # <<<<<<<<<<<<<<
- *         cdef uint32_t cns
- *         cdef glf1_t * g
- */
-  __pyx_v_rb = (__pyx_v_seq[((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->pos]);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5rname___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2998
- *                                self.iter.plp,
- *                                bam_nt16_table[rb],
- *                                self.c )             # <<<<<<<<<<<<<<
- * 
- *         if pysam_glf_depth( g ) == 0:
- */
-  __pyx_v_g = bam_maqcns_glfgen(((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->n_plp, ((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->plp, (bam_nt16_table[__pyx_v_rb]), ((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.c);
+static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3000
- *                                self.c )
- * 
- *         if pysam_glf_depth( g ) == 0:             # <<<<<<<<<<<<<<
- *             cns = 0xfu << 28 | 0xf << 24
- *         else:
- */
-  __pyx_t_1 = (pysam_glf_depth(__pyx_v_g) == 0);
-  if (__pyx_t_1) {
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3tid___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3001
- * 
- *         if pysam_glf_depth( g ) == 0:
- *             cns = 0xfu << 28 | 0xf << 24             # <<<<<<<<<<<<<<
- *         else:
- *             cns = glf2cns(g, <int>(self.c.q_r + .499))
- */
-    __pyx_v_cns = 4278190080U;
-    goto __pyx_L8;
+static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(o, v);
   }
-  /*else*/ {
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3003
- *             cns = 0xfu << 28 | 0xf << 24
- *         else:
- *             cns = glf2cns(g, <int>(self.c.q_r + .499))             # <<<<<<<<<<<<<<
- * 
- *         free(g)
- */
-    __pyx_v_cns = glf2cns(__pyx_v_g, ((int)(((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.c->q_r + .499)));
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3pos___get__(o);
+}
+
+static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(o, v);
   }
-  __pyx_L8:;
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3005
- *             cns = glf2cns(g, <int>(self.c.q_r + .499))
- * 
- *         free(g)             # <<<<<<<<<<<<<<
- * 
- *         cdef SNPCall call
- */
-  free(__pyx_v_g);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3bin___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3009
- *         cdef SNPCall call
- * 
- *         call = SNPCall()             # <<<<<<<<<<<<<<
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos
- */
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_SNPCall)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(((PyObject *)__pyx_v_call));
-  __pyx_v_call = ((struct __pyx_obj_9csamtools_SNPCall *)__pyx_t_2);
-  __pyx_t_2 = 0;
+static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3010
- * 
- *         call = SNPCall()
- *         call._tid = self.iter.tid             # <<<<<<<<<<<<<<
- *         call._pos = self.iter.pos
- *         call._reference_base = rb
- */
-  __pyx_v_call->_tid = ((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->tid;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3011
- *         call = SNPCall()
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos             # <<<<<<<<<<<<<<
- *         call._reference_base = rb
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- */
-  __pyx_v_call->_pos = ((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->pos;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4aend___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3012
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos
- *         call._reference_base = rb             # <<<<<<<<<<<<<<
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- *         call._consensus_quality = cns >> 8 & 0xff
- */
-  __pyx_v_call->_reference_base = __pyx_v_rb;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4alen___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3013
- *         call._pos = self.iter.pos
- *         call._reference_base = rb
- *         call._genotype = bam_nt16_rev_table[cns>>28]             # <<<<<<<<<<<<<<
- *         call._consensus_quality = cns >> 8 & 0xff
- *         call._snp_quality = cns & 0xff
- */
-  __pyx_v_call->_genotype = (__pyx_v_9csamtools_bam_nt16_rev_table[(__pyx_v_cns >> 28)]);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3014
- *         call._reference_base = rb
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- *         call._consensus_quality = cns >> 8 & 0xff             # <<<<<<<<<<<<<<
- *         call._snp_quality = cns & 0xff
- *         call._rms_mapping_quality = cns >> 16&0xff
- */
-  __pyx_v_call->_consensus_quality = ((__pyx_v_cns >> 8) & 0xff);
+static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3015
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- *         call._consensus_quality = cns >> 8 & 0xff
- *         call._snp_quality = cns & 0xff             # <<<<<<<<<<<<<<
- *         call._rms_mapping_quality = cns >> 16&0xff
- *         call._coverage = self.iter.n_plp
- */
-  __pyx_v_call->_snp_quality = (__pyx_v_cns & 0xff);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3016
- *         call._consensus_quality = cns >> 8 & 0xff
- *         call._snp_quality = cns & 0xff
- *         call._rms_mapping_quality = cns >> 16&0xff             # <<<<<<<<<<<<<<
- *         call._coverage = self.iter.n_plp
- * 
- */
-  __pyx_v_call->_rms_mapping_quality = ((__pyx_v_cns >> 16) & 0xff);
+static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3017
- *         call._snp_quality = cns & 0xff
- *         call._rms_mapping_quality = cns >> 16&0xff
- *         call._coverage = self.iter.n_plp             # <<<<<<<<<<<<<<
- * 
- *         return call
- */
-  __pyx_v_call->_coverage = ((struct __pyx_obj_9csamtools_IteratorSNPCalls *)__pyx_v_self)->__pyx_base.iter->n_plp;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rnext(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3019
- *         call._coverage = self.iter.n_plp
- * 
- *         return call             # <<<<<<<<<<<<<<
- * 
- * cdef class SNPCaller( SNPCallerBase ):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_call));
-  __pyx_r = ((PyObject *)__pyx_v_call);
-  goto __pyx_L0;
+static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("csamtools.IteratorSNPCalls.__next__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_DECREF((PyObject *)__pyx_v_call);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(o);
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3035
- * 
- * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   IteratorColumn iterator_column,
- *                   **kwargs ):
- */
+static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-static int __pyx_pf_9csamtools_9SNPCaller___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_9SNPCaller___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_iterator_column = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iterator_column,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 3035);
-  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[1] = {0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterator_column);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)values[0]);
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)PyTuple_GET_ITEM(__pyx_args, 0));
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_AddTraceback("csamtools.SNPCaller.__cinit__");
-  __Pyx_RefNannyFinishContext();
-  return -1;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterator_column), __pyx_ptype_9csamtools_IteratorColumn, 1, "iterator_column", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pnext(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(o);
+}
 
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.SNPCaller.__cinit__");
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
+static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3041
- *         pass
- * 
- *     def call(self, reference, int pos ):             # <<<<<<<<<<<<<<
- *         """call a snp on chromosome *reference*
- *         and position *pos*.
- */
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5isize___get__(o);
+}
 
-static PyObject *__pyx_pf_9csamtools_9SNPCaller_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_9SNPCaller_call[] = "SNPCaller.call(self, reference, int pos)\ncall a snp on chromosome *reference*\n        and position *pos*.\n\n        returns a :class:`SNPCall` object.\n        ";
-static PyObject *__pyx_pf_9csamtools_9SNPCaller_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_reference = 0;
-  int __pyx_v_pos;
-  int __pyx_v_tid;
-  char *__pyx_v_seq;
-  int __pyx_v_seq_len;
-  int __pyx_v_rb;
-  uint32_t __pyx_v_cns;
-  glf1_t *__pyx_v_g;
-  struct __pyx_obj_9csamtools_SNPCall *__pyx_v_call;
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__pos,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("call");
-  __Pyx_TraceCall("call", __pyx_f[0], 3041);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[2] = {0,0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-      case  1:
-      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
-      if (likely(values[1])) kw_args--;
-      else {
-        __Pyx_RaiseArgtupleInvalid("call", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "call") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_reference = values[0];
-    __pyx_v_pos = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_pos == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
-    __pyx_v_pos = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_pos == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(o, v);
   }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("call", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("csamtools.SNPCaller.call");
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_v_call = ((struct __pyx_obj_9csamtools_SNPCall *)Py_None); __Pyx_INCREF(Py_None);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3048
- *         """
- * 
- *         cdef int tid = self.iter.samfile.gettid( reference )             # <<<<<<<<<<<<<<
- * 
- *         self.iter.reset( tid, pos, pos + 1 )
- */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->samfile), __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_reference);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
-  __Pyx_GIVEREF(__pyx_v_reference);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_tid = __pyx_t_4;
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3050
- *         cdef int tid = self.iter.samfile.gettid( reference )
- * 
- *         self.iter.reset( tid, pos, pos + 1 )             # <<<<<<<<<<<<<<
- * 
- *         while 1:
- */
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyInt_FromLong((__pyx_v_pos + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->reset(((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tlen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3052
- *         self.iter.reset( tid, pos, pos + 1 )
- * 
- *         while 1:             # <<<<<<<<<<<<<<
- *             self.iter.cnext()
- * 
- */
-  while (1) {
-    if (!1) break;
+static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3053
- * 
- *         while 1:
- *             self.iter.cnext()             # <<<<<<<<<<<<<<
- * 
- *             if self.iter.n_plp < 0:
- */
-    ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3055
- *             self.iter.cnext()
- * 
- *             if self.iter.n_plp < 0:             # <<<<<<<<<<<<<<
- *                 raise ValueError("error during iteration" )
- * 
- */
-    __pyx_t_6 = (((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->n_plp < 0);
-    if (__pyx_t_6) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3056
- * 
- *             if self.iter.n_plp < 0:
- *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
- * 
- *             if self.iter.plp == NULL:
- */
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_59));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
-    }
-    __pyx_L8:;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3058
- *                 raise ValueError("error during iteration" )
- * 
- *             if self.iter.plp == NULL:             # <<<<<<<<<<<<<<
- *                 raise ValueError( "no reads in region - no call" )
- * 
- */
-    __pyx_t_6 = (((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->plp == NULL);
-    if (__pyx_t_6) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3059
- * 
- *             if self.iter.plp == NULL:
- *                 raise ValueError( "no reads in region - no call" )             # <<<<<<<<<<<<<<
- * 
- *             if self.iter.pos == pos: break
- */
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_109));
-      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_109));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_109));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L9;
-    }
-    __pyx_L9:;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3061
- *                 raise ValueError( "no reads in region - no call" )
- * 
- *             if self.iter.pos == pos: break             # <<<<<<<<<<<<<<
- * 
- *         cdef char * seq = self.iter.getSequence()
- */
-    __pyx_t_6 = (((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->pos == __pyx_v_pos);
-    if (__pyx_t_6) {
-      goto __pyx_L7_break;
-      goto __pyx_L10;
-    }
-    __pyx_L10:;
+static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(o, v);
   }
-  __pyx_L7_break:;
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3063
- *             if self.iter.pos == pos: break
- * 
- *         cdef char * seq = self.iter.getSequence()             # <<<<<<<<<<<<<<
- *         cdef int seq_len = self.iter.seq_len
- * 
- */
-  __pyx_v_seq = ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->getSequence(((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(o);
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3064
- * 
- *         cdef char * seq = self.iter.getSequence()
- *         cdef int seq_len = self.iter.seq_len             # <<<<<<<<<<<<<<
- * 
- *         assert seq != NULL
- */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter), __pyx_n_s__seq_len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_v_seq_len = __pyx_t_4;
+static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3066
- *         cdef int seq_len = self.iter.seq_len
- * 
- *         assert seq != NULL             # <<<<<<<<<<<<<<
- * 
- *         # reference base
- */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_seq != NULL))) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(o);
+}
+
+static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(o, v);
   }
-  #endif
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3069
- * 
- *         # reference base
- *         if self.iter.pos >= seq_len:             # <<<<<<<<<<<<<<
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
- * 
- */
-  __pyx_t_6 = (((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->pos >= __pyx_v_seq_len);
-  if (__pyx_t_6) {
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3070
- *         # reference base
- *         if self.iter.pos >= seq_len:
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )             # <<<<<<<<<<<<<<
- * 
- *         cdef int rb = seq[self.iter.pos]
- */
-    __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_5 = 0;
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_108), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L11;
+static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(o, v);
   }
-  __pyx_L11:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3072
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
- * 
- *         cdef int rb = seq[self.iter.pos]             # <<<<<<<<<<<<<<
- *         cdef uint32_t cns
- *         cdef glf1_t * g
- */
-  __pyx_v_rb = (__pyx_v_seq[((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->pos]);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3079
- *                                self.iter.plp,
- *                                bam_nt16_table[rb],
- *                                self.c )             # <<<<<<<<<<<<<<
- * 
- * 
- */
-  __pyx_v_g = bam_maqcns_glfgen(((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->n_plp, ((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->plp, (bam_nt16_table[__pyx_v_rb]), ((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.c);
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3082
- * 
- * 
- *         if pysam_glf_depth( g ) == 0:             # <<<<<<<<<<<<<<
- *             cns = 0xfu << 28 | 0xf << 24
- *         else:
- */
-  __pyx_t_6 = (pysam_glf_depth(__pyx_v_g) == 0);
-  if (__pyx_t_6) {
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3083
- * 
- *         if pysam_glf_depth( g ) == 0:
- *             cns = 0xfu << 28 | 0xf << 24             # <<<<<<<<<<<<<<
- *         else:
- *             cns = glf2cns(g, <int>(self.c.q_r + .499))
- */
-    __pyx_v_cns = 4278190080U;
-    goto __pyx_L12;
+static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(o, v);
   }
-  /*else*/ {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3085
- *             cns = 0xfu << 28 | 0xf << 24
- *         else:
- *             cns = glf2cns(g, <int>(self.c.q_r + .499))             # <<<<<<<<<<<<<<
- * 
- *         free(g)
- */
-    __pyx_v_cns = glf2cns(__pyx_v_g, ((int)(((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.c->q_r + .499)));
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
   }
-  __pyx_L12:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3087
- *             cns = glf2cns(g, <int>(self.c.q_r + .499))
- * 
- *         free(g)             # <<<<<<<<<<<<<<
- * 
- *         cdef SNPCall call
- */
-  free(__pyx_v_g);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3091
- *         cdef SNPCall call
- * 
- *         call = SNPCall()             # <<<<<<<<<<<<<<
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos
- */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_SNPCall)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(((PyObject *)__pyx_v_call));
-  __pyx_v_call = ((struct __pyx_obj_9csamtools_SNPCall *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3092
- * 
- *         call = SNPCall()
- *         call._tid = self.iter.tid             # <<<<<<<<<<<<<<
- *         call._pos = self.iter.pos
- *         call._reference_base = rb
- */
-  __pyx_v_call->_tid = ((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->tid;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3093
- *         call = SNPCall()
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos             # <<<<<<<<<<<<<<
- *         call._reference_base = rb
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- */
-  __pyx_v_call->_pos = ((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->pos;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3094
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos
- *         call._reference_base = rb             # <<<<<<<<<<<<<<
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- *         call._consensus_quality = cns >> 8 & 0xff
- */
-  __pyx_v_call->_reference_base = __pyx_v_rb;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3095
- *         call._pos = self.iter.pos
- *         call._reference_base = rb
- *         call._genotype = bam_nt16_rev_table[cns>>28]             # <<<<<<<<<<<<<<
- *         call._consensus_quality = cns >> 8 & 0xff
- *         call._snp_quality = cns & 0xff
- */
-  __pyx_v_call->_genotype = (__pyx_v_9csamtools_bam_nt16_rev_table[(__pyx_v_cns >> 28)]);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3096
- *         call._reference_base = rb
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- *         call._consensus_quality = cns >> 8 & 0xff             # <<<<<<<<<<<<<<
- *         call._snp_quality = cns & 0xff
- *         call._rms_mapping_quality = cns >> 16&0xff
- */
-  __pyx_v_call->_consensus_quality = ((__pyx_v_cns >> 8) & 0xff);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3097
- *         call._genotype = bam_nt16_rev_table[cns>>28]
- *         call._consensus_quality = cns >> 8 & 0xff
- *         call._snp_quality = cns & 0xff             # <<<<<<<<<<<<<<
- *         call._rms_mapping_quality = cns >> 16&0xff
- *         call._coverage = self.iter.n_plp
- */
-  __pyx_v_call->_snp_quality = (__pyx_v_cns & 0xff);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3098
- *         call._consensus_quality = cns >> 8 & 0xff
- *         call._snp_quality = cns & 0xff
- *         call._rms_mapping_quality = cns >> 16&0xff             # <<<<<<<<<<<<<<
- *         call._coverage = self.iter.n_plp
- * 
- */
-  __pyx_v_call->_rms_mapping_quality = ((__pyx_v_cns >> 16) & 0xff);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3099
- *         call._snp_quality = cns & 0xff
- *         call._rms_mapping_quality = cns >> 16&0xff
- *         call._coverage = self.iter.n_plp             # <<<<<<<<<<<<<<
- * 
- *         return call
- */
-  __pyx_v_call->_coverage = ((struct __pyx_obj_9csamtools_SNPCaller *)__pyx_v_self)->__pyx_base.iter->n_plp;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3101
- *         call._coverage = self.iter.n_plp
- * 
- *         return call             # <<<<<<<<<<<<<<
- * 
- * cdef class IndelCall:
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_call));
-  __pyx_r = ((PyObject *)__pyx_v_call);
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("csamtools.SNPCaller.call");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_DECREF((PyObject *)__pyx_v_call);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3111
- *     cdef bam_maqindel_ret_t * _r
- * 
- *     def __cinit__(self):             # <<<<<<<<<<<<<<
- *         #assert r != NULL
- *         #self._r = r
- */
-
-static int __pyx_pf_9csamtools_9IndelCall___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_9IndelCall___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  int __pyx_r;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 3111);
-  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
-    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
-  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
-
-  __pyx_r = 0;
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(o);
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3118
- *     property tid:
- *         '''the chromosome ID as is defined in the header'''
- *         def __get__(self):             # <<<<<<<<<<<<<<
- *             return self._tid
- * 
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_3tid___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_3tid___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3118);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3119
- *         '''the chromosome ID as is defined in the header'''
- *         def __get__(self):
- *             return self._tid             # <<<<<<<<<<<<<<
- * 
- *     property pos:
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.tid.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
+static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3123
- *     property pos:
- *        '''nucleotide position of SNP.'''
- *        def __get__(self): return self._pos             # <<<<<<<<<<<<<<
- * 
- *     property genotype:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_3pos___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_3pos___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3123);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(o);
+}
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.pos.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
+static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3127
- *     property genotype:
- *        '''the genotype called.'''
- *        def __get__(self):             # <<<<<<<<<<<<<<
- *            if self._r.gt == 0:
- *                s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
- */
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(o);
+}
 
-static PyObject *__pyx_pf_9csamtools_9IndelCall_8genotype___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_8genotype___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_v_s;
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3127);
-  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
+static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3128
- *        '''the genotype called.'''
- *        def __get__(self):
- *            if self._r.gt == 0:             # <<<<<<<<<<<<<<
- *                s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
- *                return "%s/%s" % (s,s)
- */
-  switch (((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->gt) {
-    case 0:
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3129
- *        def __get__(self):
- *            if self._r.gt == 0:
- *                s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)             # <<<<<<<<<<<<<<
- *                return "%s/%s" % (s,s)
- *            elif self._r.gt == 1:
- */
-    __pyx_t_1 = PyString_FromStringAndSize((((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->s[0]), (((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->indel1 + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_v_s);
-    __pyx_v_s = __pyx_t_1;
-    __pyx_t_1 = 0;
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3130
- *            if self._r.gt == 0:
- *                s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
- *                return "%s/%s" % (s,s)             # <<<<<<<<<<<<<<
- *            elif self._r.gt == 1:
- *                s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
- */
-    __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(__pyx_v_s);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s);
-    __Pyx_GIVEREF(__pyx_v_s);
-    __Pyx_INCREF(__pyx_v_s);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_s);
-    __Pyx_GIVEREF(__pyx_v_s);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_110), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_r = ((PyObject *)__pyx_t_2);
-    __pyx_t_2 = 0;
-    goto __pyx_L0;
-    break;
+static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3131
- *                s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
- *                return "%s/%s" % (s,s)
- *            elif self._r.gt == 1:             # <<<<<<<<<<<<<<
- *                s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
- *                return "%s/%s" % (s,s)
- */
-    case 1:
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_9positions___get__(o);
+}
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3132
- *                return "%s/%s" % (s,s)
- *            elif self._r.gt == 1:
- *                s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)             # <<<<<<<<<<<<<<
- *                return "%s/%s" % (s,s)
- *            else:
- */
-    __pyx_t_2 = PyString_FromStringAndSize((((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->s[1]), (((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->indel2 + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_v_s);
-    __pyx_v_s = __pyx_t_2;
-    __pyx_t_2 = 0;
+static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = {
+  {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_3compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_3compare)},
+  {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_5overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_5overlap)},
+  {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_6opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_6opt)},
+  {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_7fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_7fancy_str)},
+  {0, 0, 0, 0}
+};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3133
- *            elif self._r.gt == 1:
- *                s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
- *                return "%s/%s" % (s,s)             # <<<<<<<<<<<<<<
- *            else:
- *                return "%s/%s" % (self.first_allele, self.second_allele )
- */
-    __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(__pyx_v_s);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
-    __Pyx_GIVEREF(__pyx_v_s);
-    __Pyx_INCREF(__pyx_v_s);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_s);
-    __Pyx_GIVEREF(__pyx_v_s);
-    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_110), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_r = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
-    goto __pyx_L0;
-    break;
-    default:
+static struct PyGetSetDef __pyx_getsets_9csamtools_AlignedRead[] = {
+  {(char *)"qname", __pyx_getprop_9csamtools_11AlignedRead_qname, __pyx_setprop_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_169), 0},
+  {(char *)"cigar", __pyx_getprop_9csamtools_11AlignedRead_cigar, __pyx_setprop_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_170), 0},
+  {(char *)"seq", __pyx_getprop_9csamtools_11AlignedRead_seq, __pyx_setprop_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_171), 0},
+  {(char *)"qual", __pyx_getprop_9csamtools_11AlignedRead_qual, __pyx_setprop_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_172), 0},
+  {(char *)"query", __pyx_getprop_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_173), 0},
+  {(char *)"qqual", __pyx_getprop_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_174), 0},
+  {(char *)"qstart", __pyx_getprop_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_175), 0},
+  {(char *)"qend", __pyx_getprop_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_176), 0},
+  {(char *)"qlen", __pyx_getprop_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_177), 0},
+  {(char *)"tags", __pyx_getprop_9csamtools_11AlignedRead_tags, __pyx_setprop_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_178), 0},
+  {(char *)"flag", __pyx_getprop_9csamtools_11AlignedRead_flag, __pyx_setprop_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_179), 0},
+  {(char *)"rname", __pyx_getprop_9csamtools_11AlignedRead_rname, __pyx_setprop_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_180), 0},
+  {(char *)"tid", __pyx_getprop_9csamtools_11AlignedRead_tid, __pyx_setprop_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_181), 0},
+  {(char *)"pos", __pyx_getprop_9csamtools_11AlignedRead_pos, __pyx_setprop_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_182), 0},
+  {(char *)"bin", __pyx_getprop_9csamtools_11AlignedRead_bin, __pyx_setprop_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_183), 0},
+  {(char *)"rlen", __pyx_getprop_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_184), 0},
+  {(char *)"aend", __pyx_getprop_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_185), 0},
+  {(char *)"alen", __pyx_getprop_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_186), 0},
+  {(char *)"mapq", __pyx_getprop_9csamtools_11AlignedRead_mapq, __pyx_setprop_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_187), 0},
+  {(char *)"mrnm", __pyx_getprop_9csamtools_11AlignedRead_mrnm, __pyx_setprop_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_188), 0},
+  {(char *)"rnext", __pyx_getprop_9csamtools_11AlignedRead_rnext, __pyx_setprop_9csamtools_11AlignedRead_rnext, __Pyx_DOCSTR(__pyx_k_189), 0},
+  {(char *)"mpos", __pyx_getprop_9csamtools_11AlignedRead_mpos, __pyx_setprop_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_190), 0},
+  {(char *)"pnext", __pyx_getprop_9csamtools_11AlignedRead_pnext, __pyx_setprop_9csamtools_11AlignedRead_pnext, __Pyx_DOCSTR(__pyx_k_191), 0},
+  {(char *)"isize", __pyx_getprop_9csamtools_11AlignedRead_isize, __pyx_setprop_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_192), 0},
+  {(char *)"tlen", __pyx_getprop_9csamtools_11AlignedRead_tlen, __pyx_setprop_9csamtools_11AlignedRead_tlen, __Pyx_DOCSTR(__pyx_k_193), 0},
+  {(char *)"is_paired", __pyx_getprop_9csamtools_11AlignedRead_is_paired, __pyx_setprop_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_194), 0},
+  {(char *)"is_proper_pair", __pyx_getprop_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_195), 0},
+  {(char *)"is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_196), 0},
+  {(char *)"mate_is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_197), 0},
+  {(char *)"is_reverse", __pyx_getprop_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_198), 0},
+  {(char *)"mate_is_reverse", __pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_199), 0},
+  {(char *)"is_read1", __pyx_getprop_9csamtools_11AlignedRead_is_read1, __pyx_setprop_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_200), 0},
+  {(char *)"is_read2", __pyx_getprop_9csamtools_11AlignedRead_is_read2, __pyx_setprop_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_201), 0},
+  {(char *)"is_secondary", __pyx_getprop_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_202), 0},
+  {(char *)"is_qcfail", __pyx_getprop_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_203), 0},
+  {(char *)"is_duplicate", __pyx_getprop_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_204), 0},
+  {(char *)"positions", __pyx_getprop_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_205), 0},
+  {0, 0, 0, 0, 0}
+};
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3135
- *                return "%s/%s" % (s,s)
- *            else:
- *                return "%s/%s" % (self.first_allele, self.second_allele )             # <<<<<<<<<<<<<<
- * 
- *     property consensus_quality:
- */
-    __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__first_allele); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__second_allele); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_1 = 0;
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_110), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_r = ((PyObject *)__pyx_t_2);
-    __pyx_t_2 = 0;
-    goto __pyx_L0;
-    break;
-  }
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("csamtools.IndelCall.genotype.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_s);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3139
- *     property consensus_quality:
- *        '''the genotype quality (Phred-scaled).'''
- *        def __get__(self): return self._r.q_cns             # <<<<<<<<<<<<<<
- * 
- *     property snp_quality:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_17consensus_quality___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_17consensus_quality___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3139);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->q_cns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.consensus_quality.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3143
- *     property snp_quality:
- *        '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
- *        def __get__(self): return self._r.q_ref             # <<<<<<<<<<<<<<
- * 
- *     property mapping_quality:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_11snp_quality___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_11snp_quality___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3143);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->q_ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.snp_quality.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3147
- *     property mapping_quality:
- *        '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
- *        def __get__(self): return self._rms_mapping_quality             # <<<<<<<<<<<<<<
- * 
- *     property coverage:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_15mapping_quality___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_15mapping_quality___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3147);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.mapping_quality.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3151
- *     property coverage:
- *        '''coverage or read depth - the number of reads involved in the call.'''
- *        def __get__(self): return self._coverage             # <<<<<<<<<<<<<<
- * 
- *     property first_allele:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_8coverage___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_8coverage___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3151);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.coverage.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3155
- *     property first_allele:
- *        '''sequence of first allele.'''
- *        def __get__(self): return PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)             # <<<<<<<<<<<<<<
- * 
- *     property second_allele:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_12first_allele___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_12first_allele___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3155);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyString_FromStringAndSize((((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->s[0]), (((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->indel1 + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.first_allele.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3159
- *     property second_allele:
- *        '''sequence of second allele.'''
- *        def __get__(self): return PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)             # <<<<<<<<<<<<<<
- * 
- *     property reads_first:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_13second_allele___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_13second_allele___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3159);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyString_FromStringAndSize((((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->s[1]), (((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->indel2 + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.second_allele.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3163
- *     property reads_first:
- *        '''reads supporting first allele.'''
- *        def __get__(self): return self._r.cnt1             # <<<<<<<<<<<<<<
- * 
- *     property reads_second:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_11reads_first___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_11reads_first___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3163);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->cnt1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.reads_first.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3167
- *     property reads_second:
- *        '''reads supporting first allele.'''
- *        def __get__(self): return self._r.cnt2             # <<<<<<<<<<<<<<
- * 
- *     property reads_diff:
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_12reads_second___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_12reads_second___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3167);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->cnt2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.reads_second.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3171
- *     property reads_diff:
- *        '''reads supporting first allele.'''
- *        def __get__(self): return self._r.cnt_anti             # <<<<<<<<<<<<<<
- * 
- *     def __str__(self):
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall_10reads_diff___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall_10reads_diff___get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__");
-  __Pyx_TraceCall("__get__", __pyx_f[0], 3171);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r->cnt_anti); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("csamtools.IndelCall.reads_diff.__get__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3173
- *        def __get__(self): return self._r.cnt_anti
- * 
- *     def __str__(self):             # <<<<<<<<<<<<<<
- * 
- *         return "\t".join( map(str, (
- */
-
-static PyObject *__pyx_pf_9csamtools_9IndelCall___str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_9IndelCall___str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__str__");
-  __Pyx_TraceCall("__str__", __pyx_f[0], 3173);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3175
- *     def __str__(self):
- * 
- *         return "\t".join( map(str, (             # <<<<<<<<<<<<<<
- *                     self.tid,
- *                     self.pos,
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3176
- * 
- *         return "\t".join( map(str, (
- *                     self.tid,             # <<<<<<<<<<<<<<
- *                     self.pos,
- *                     self.genotype,
- */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3177
- *         return "\t".join( map(str, (
- *                     self.tid,
- *                     self.pos,             # <<<<<<<<<<<<<<
- *                     self.genotype,
- *                     self.consensus_quality,
- */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3178
- *                     self.tid,
- *                     self.pos,
- *                     self.genotype,             # <<<<<<<<<<<<<<
- *                     self.consensus_quality,
- *                     self.snp_quality,
- */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__genotype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3179
- *                     self.pos,
- *                     self.genotype,
- *                     self.consensus_quality,             # <<<<<<<<<<<<<<
- *                     self.snp_quality,
- *                     self.mapping_quality,
- */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3180
- *                     self.genotype,
- *                     self.consensus_quality,
- *                     self.snp_quality,             # <<<<<<<<<<<<<<
- *                     self.mapping_quality,
- *                     self.coverage,
- */
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3181
- *                     self.consensus_quality,
- *                     self.snp_quality,
- *                     self.mapping_quality,             # <<<<<<<<<<<<<<
- *                     self.coverage,
- *                     self.first_allele,
- */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3182
- *                     self.snp_quality,
- *                     self.mapping_quality,
- *                     self.coverage,             # <<<<<<<<<<<<<<
- *                     self.first_allele,
- *                     self.second_allele,
- */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coverage); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3183
- *                     self.mapping_quality,
- *                     self.coverage,
- *                     self.first_allele,             # <<<<<<<<<<<<<<
- *                     self.second_allele,
- *                     self.reads_first,
- */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__first_allele); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3184
- *                     self.coverage,
- *                     self.first_allele,
- *                     self.second_allele,             # <<<<<<<<<<<<<<
- *                     self.reads_first,
- *                     self.reads_second,
- */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__second_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3185
- *                     self.first_allele,
- *                     self.second_allele,
- *                     self.reads_first,             # <<<<<<<<<<<<<<
- *                     self.reads_second,
- *                     self.reads_diff ) ) )
- */
-  __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reads_first); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3186
- *                     self.second_allele,
- *                     self.reads_first,
- *                     self.reads_second,             # <<<<<<<<<<<<<<
- *                     self.reads_diff ) ) )
- * 
- */
-  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reads_second); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3187
- *                     self.reads_first,
- *                     self.reads_second,
- *                     self.reads_diff ) ) )             # <<<<<<<<<<<<<<
- * 
- *     def __dealloc__(self ):
- */
-  __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reads_diff); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_14 = PyTuple_New(12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_14);
-  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_6);
-  __Pyx_GIVEREF(__pyx_t_6);
-  PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_7);
-  __Pyx_GIVEREF(__pyx_t_7);
-  PyTuple_SET_ITEM(__pyx_t_14, 6, __pyx_t_8);
-  __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_14, 7, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_14, 8, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_14, 9, __pyx_t_11);
-  __Pyx_GIVEREF(__pyx_t_11);
-  PyTuple_SET_ITEM(__pyx_t_14, 10, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_12);
-  PyTuple_SET_ITEM(__pyx_t_14, 11, __pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_13);
-  __pyx_t_2 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_4 = 0;
-  __pyx_t_5 = 0;
-  __pyx_t_6 = 0;
-  __pyx_t_7 = 0;
-  __pyx_t_8 = 0;
-  __pyx_t_9 = 0;
-  __pyx_t_10 = 0;
-  __pyx_t_11 = 0;
-  __pyx_t_12 = 0;
-  __pyx_t_13 = 0;
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-  __Pyx_GIVEREF(__pyx_t_14);
-  __pyx_t_14 = 0;
-  __pyx_t_14 = PyObject_Call(__pyx_builtin_map, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14);
-  __Pyx_GIVEREF(__pyx_t_14);
-  __pyx_t_14 = 0;
-  __pyx_t_14 = PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_14);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_r = __pyx_t_14;
-  __pyx_t_14 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_AddTraceback("csamtools.IndelCall.__str__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3189
- *                     self.reads_diff ) ) )
- * 
- *     def __dealloc__(self ):             # <<<<<<<<<<<<<<
- *         bam_maqindel_ret_destroy(self._r)
- * 
- */
-
-static void __pyx_pf_9csamtools_9IndelCall___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_9IndelCall___dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3189);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3190
- * 
- *     def __dealloc__(self ):
- *         bam_maqindel_ret_destroy(self._r)             # <<<<<<<<<<<<<<
- * 
- * cdef class IndelCallerBase:
- */
-  bam_maqindel_ret_destroy(((struct __pyx_obj_9csamtools_IndelCall *)__pyx_v_self)->_r);
-
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3212
- *     cdef int max_depth
- * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   IteratorColumn iterator_column,
- *                   **kwargs ):
- */
-
-static int __pyx_pf_9csamtools_15IndelCallerBase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_15IndelCallerBase___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_iterator_column = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  float __pyx_t_4;
-  int __pyx_t_5;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iterator_column,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 3212);
-  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[1] = {0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterator_column);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)values[0]);
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)PyTuple_GET_ITEM(__pyx_args, 0));
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_AddTraceback("csamtools.IndelCallerBase.__cinit__");
-  __Pyx_RefNannyFinishContext();
-  return -1;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterator_column), __pyx_ptype_9csamtools_IteratorColumn, 1, "iterator_column", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3217
- * 
- * 
- *         self.iter = iterator_column             # <<<<<<<<<<<<<<
- * 
- *         assert iterator_column.hasReference(), "IndelCallerBase requires an pileup iterator with reference sequence"
- */
-  __Pyx_INCREF(((PyObject *)__pyx_v_iterator_column));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_iterator_column));
-  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter);
-  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter));
-  ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter = __pyx_v_iterator_column;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3219
- *         self.iter = iterator_column
- * 
- *         assert iterator_column.hasReference(), "IndelCallerBase requires an pileup iterator with reference sequence"             # <<<<<<<<<<<<<<
- * 
- *         self.options = bam_maqindel_opt_init()
- */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iterator_column), __pyx_n_s__hasReference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_3)) {
-    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_111));
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3221
- *         assert iterator_column.hasReference(), "IndelCallerBase requires an pileup iterator with reference sequence"
- * 
- *         self.options = bam_maqindel_opt_init()             # <<<<<<<<<<<<<<
- * 
- *         # set the default parameterization according to
- */
-  ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->options = bam_maqindel_opt_init();
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3226
- *         # samtools
- * 
- *         self.options.r_indel = kwargs.get( "r_indel", 0.00015 )             # <<<<<<<<<<<<<<
- *         self.options.q_indel = kwargs.get( "q_indel", 40 )
- *         self.cap_mapQ = kwargs.get( "cap_mapQ", 60 )
- */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
-  __pyx_t_2 = PyFloat_FromDouble(0.00015); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__r_indel), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->options->r_indel = __pyx_t_4;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3227
- * 
- *         self.options.r_indel = kwargs.get( "r_indel", 0.00015 )
- *         self.options.q_indel = kwargs.get( "q_indel", 40 )             # <<<<<<<<<<<<<<
- *         self.cap_mapQ = kwargs.get( "cap_mapQ", 60 )
- *         self.max_depth = kwargs.get( "max_depth", 1024 )
- */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
-  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__q_indel), __pyx_int_40); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->options->q_indel = __pyx_t_5;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3228
- *         self.options.r_indel = kwargs.get( "r_indel", 0.00015 )
- *         self.options.q_indel = kwargs.get( "q_indel", 40 )
- *         self.cap_mapQ = kwargs.get( "cap_mapQ", 60 )             # <<<<<<<<<<<<<<
- *         self.max_depth = kwargs.get( "max_depth", 1024 )
- * 
- */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
-  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__cap_mapQ), __pyx_int_60); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->cap_mapQ = __pyx_t_5;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3229
- *         self.options.q_indel = kwargs.get( "q_indel", 40 )
- *         self.cap_mapQ = kwargs.get( "cap_mapQ", 60 )
- *         self.max_depth = kwargs.get( "max_depth", 1024 )             # <<<<<<<<<<<<<<
- * 
- *     def __dealloc__(self):
- */
-  if (unlikely(__pyx_v_kwargs == Py_None)) {
-    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
-  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_depth), __pyx_int_1024); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->max_depth = __pyx_t_5;
-
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("csamtools.IndelCallerBase.__cinit__");
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3231
- *         self.max_depth = kwargs.get( "max_depth", 1024 )
- * 
- *     def __dealloc__(self):             # <<<<<<<<<<<<<<
- *         free( self.options )
- * 
- */
-
-static void __pyx_pf_9csamtools_15IndelCallerBase___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_15IndelCallerBase___dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3231);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3232
- * 
- *     def __dealloc__(self):
- *         free( self.options )             # <<<<<<<<<<<<<<
- * 
- *     def _call( self ):
- */
-  free(((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->options);
-
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3234
- *         free( self.options )
- * 
- *     def _call( self ):             # <<<<<<<<<<<<<<
- * 
- *         cdef char * seq = self.iter.getSequence()
- */
-
-static PyObject *__pyx_pf_9csamtools_15IndelCallerBase__call(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_15IndelCallerBase__call[] = "IndelCallerBase._call(self)";
-static PyObject *__pyx_pf_9csamtools_15IndelCallerBase__call(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  char *__pyx_v_seq;
-  int __pyx_v_seq_len;
-  bam_maqindel_ret_t *__pyx_v_r;
-  int __pyx_v_m;
-  struct __pyx_obj_9csamtools_IndelCall *__pyx_v_call;
-  uint64_t __pyx_v_rms_aux;
-  int __pyx_v_i;
-  bam_pileup1_t *__pyx_v_p;
-  int __pyx_v_tmp;
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  int __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
-  int __pyx_t_7;
-  double __pyx_t_8;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_call");
-  __Pyx_TraceCall("_call", __pyx_f[0], 3234);
-  __pyx_v_call = ((struct __pyx_obj_9csamtools_IndelCall *)Py_None); __Pyx_INCREF(Py_None);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3236
- *     def _call( self ):
- * 
- *         cdef char * seq = self.iter.getSequence()             # <<<<<<<<<<<<<<
- *         cdef int seq_len = self.iter.seq_len
- * 
- */
-  __pyx_v_seq = ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->__pyx_vtab)->getSequence(((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3237
- * 
- *         cdef char * seq = self.iter.getSequence()
- *         cdef int seq_len = self.iter.seq_len             # <<<<<<<<<<<<<<
- * 
- *         assert seq != NULL
- */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter), __pyx_n_s__seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_seq_len = __pyx_t_2;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3239
- *         cdef int seq_len = self.iter.seq_len
- * 
- *         assert seq != NULL             # <<<<<<<<<<<<<<
- * 
- *         # reference base
- */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_seq != NULL))) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3242
- * 
- *         # reference base
- *         if self.iter.pos >= seq_len:             # <<<<<<<<<<<<<<
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
- * 
- */
-  __pyx_t_3 = (((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->pos >= __pyx_v_seq_len);
-  if (__pyx_t_3) {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3243
- *         # reference base
- *         if self.iter.pos >= seq_len:
- *             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )             # <<<<<<<<<<<<<<
- * 
- *         cdef bam_maqindel_ret_t * r
- */
-    __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_seq_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_1 = 0;
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_108), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
-  }
-  __pyx_L5:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3247
- *         cdef bam_maqindel_ret_t * r
- * 
- *         cdef int m = min( self.max_depth, self.iter.n_plp )             # <<<<<<<<<<<<<<
- * 
- *         # printf("pysam: m=%i, q_indel=%i, r_indel=%f, r_snp=%i, mm_penalty=%i, indel_err=%i, ambi_thres=%i\n",
- */
-  __pyx_t_2 = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->n_plp;
-  __pyx_t_6 = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->max_depth;
-  if ((__pyx_t_2 < __pyx_t_6)) {
-    __pyx_t_7 = __pyx_t_2;
-  } else {
-    __pyx_t_7 = __pyx_t_6;
-  }
-  __pyx_v_m = __pyx_t_7;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3259
- *                          seq,
- *                          0,
- *                          NULL)             # <<<<<<<<<<<<<<
- * 
- *         if r == NULL: return None
- */
-  __pyx_v_r = bam_maqindel(__pyx_v_m, ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->pos, ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->options, ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->plp, __pyx_v_seq, 0, NULL);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3261
- *                          NULL)
- * 
- *         if r == NULL: return None             # <<<<<<<<<<<<<<
- * 
- *         cdef IndelCall call
- */
-  __pyx_t_3 = (__pyx_v_r == NULL);
-  if (__pyx_t_3) {
-    __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(Py_None);
-    __pyx_r = Py_None;
-    goto __pyx_L0;
-    goto __pyx_L6;
-  }
-  __pyx_L6:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3264
- * 
- *         cdef IndelCall call
- *         call = IndelCall()             # <<<<<<<<<<<<<<
- *         call._r = r
- *         call._tid = self.iter.tid
- */
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IndelCall)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(((PyObject *)__pyx_v_call));
-  __pyx_v_call = ((struct __pyx_obj_9csamtools_IndelCall *)__pyx_t_4);
-  __pyx_t_4 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3265
- *         cdef IndelCall call
- *         call = IndelCall()
- *         call._r = r             # <<<<<<<<<<<<<<
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos
- */
-  __pyx_v_call->_r = __pyx_v_r;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3266
- *         call = IndelCall()
- *         call._r = r
- *         call._tid = self.iter.tid             # <<<<<<<<<<<<<<
- *         call._pos = self.iter.pos
- *         call._coverage = self.iter.n_plp
- */
-  __pyx_v_call->_tid = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->tid;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3267
- *         call._r = r
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos             # <<<<<<<<<<<<<<
- *         call._coverage = self.iter.n_plp
- * 
- */
-  __pyx_v_call->_pos = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->pos;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3268
- *         call._tid = self.iter.tid
- *         call._pos = self.iter.pos
- *         call._coverage = self.iter.n_plp             # <<<<<<<<<<<<<<
- * 
- *         cdef uint64_t rms_aux = 0
- */
-  __pyx_v_call->_coverage = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->n_plp;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3270
- *         call._coverage = self.iter.n_plp
- * 
- *         cdef uint64_t rms_aux = 0             # <<<<<<<<<<<<<<
- *         cdef int i = 0
- *         cdef bam_pileup1_t * p
- */
-  __pyx_v_rms_aux = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3271
- * 
- *         cdef uint64_t rms_aux = 0
- *         cdef int i = 0             # <<<<<<<<<<<<<<
- *         cdef bam_pileup1_t * p
- *         cdef int tmp
- */
-  __pyx_v_i = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3275
- *         cdef int tmp
- * 
- *         for i from 0 <= i < self.iter.n_plp:             # <<<<<<<<<<<<<<
- *             p = self.iter.plp + i
- *             if p.b.core.qual < self.cap_mapQ:
- */
-  __pyx_t_7 = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->n_plp;
-  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3276
- * 
- *         for i from 0 <= i < self.iter.n_plp:
- *             p = self.iter.plp + i             # <<<<<<<<<<<<<<
- *             if p.b.core.qual < self.cap_mapQ:
- *                 tmp = p.b.core.qual
- */
-    __pyx_v_p = (((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->plp + __pyx_v_i);
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3277
- *         for i from 0 <= i < self.iter.n_plp:
- *             p = self.iter.plp + i
- *             if p.b.core.qual < self.cap_mapQ:             # <<<<<<<<<<<<<<
- *                 tmp = p.b.core.qual
- *             else:
- */
-    __pyx_t_3 = (__pyx_v_p->b->core.qual < ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->cap_mapQ);
-    if (__pyx_t_3) {
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3278
- *             p = self.iter.plp + i
- *             if p.b.core.qual < self.cap_mapQ:
- *                 tmp = p.b.core.qual             # <<<<<<<<<<<<<<
- *             else:
- *                 tmp = self.cap_mapQ
- */
-      __pyx_v_tmp = __pyx_v_p->b->core.qual;
-      goto __pyx_L9;
-    }
-    /*else*/ {
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3280
- *                 tmp = p.b.core.qual
- *             else:
- *                 tmp = self.cap_mapQ             # <<<<<<<<<<<<<<
- *             rms_aux += tmp * tmp
- * 
- */
-      __pyx_v_tmp = ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->cap_mapQ;
-    }
-    __pyx_L9:;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3281
- *             else:
- *                 tmp = self.cap_mapQ
- *             rms_aux += tmp * tmp             # <<<<<<<<<<<<<<
- * 
- *         call._rms_mapping_quality = <uint64_t>(sqrt(<double>rms_aux / self.iter.n_plp) + .499)
- */
-    __pyx_v_rms_aux += (__pyx_v_tmp * __pyx_v_tmp);
-  }
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3283
- *             rms_aux += tmp * tmp
- * 
- *         call._rms_mapping_quality = <uint64_t>(sqrt(<double>rms_aux / self.iter.n_plp) + .499)             # <<<<<<<<<<<<<<
- * 
- *         return call
- */
-  __pyx_t_8 = ((double)__pyx_v_rms_aux);
-  if (unlikely(((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->n_plp == 0)) {
-    PyErr_Format(PyExc_ZeroDivisionError, "float division");
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  __pyx_v_call->_rms_mapping_quality = ((uint64_t)(sqrt((__pyx_t_8 / ((struct __pyx_obj_9csamtools_IndelCallerBase *)__pyx_v_self)->iter->n_plp)) + .499));
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3285
- *         call._rms_mapping_quality = <uint64_t>(sqrt(<double>rms_aux / self.iter.n_plp) + .499)
- * 
- *         return call             # <<<<<<<<<<<<<<
- * 
- * cdef class IndelCaller( IndelCallerBase ):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_call));
-  __pyx_r = ((PyObject *)__pyx_v_call);
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("csamtools.IndelCallerBase._call");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_DECREF((PyObject *)__pyx_v_call);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3300
- *     '''
- * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   IteratorColumn iterator_column,
- *                   **kwargs ):
- */
-
-static int __pyx_pf_9csamtools_11IndelCaller___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_11IndelCaller___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_iterator_column = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iterator_column,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 3300);
-  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[1] = {0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterator_column);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)values[0]);
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)PyTuple_GET_ITEM(__pyx_args, 0));
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_AddTraceback("csamtools.IndelCaller.__cinit__");
-  __Pyx_RefNannyFinishContext();
-  return -1;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterator_column), __pyx_ptype_9csamtools_IteratorColumn, 1, "iterator_column", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.IndelCaller.__cinit__");
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3306
- *         pass
- * 
- *     def call(self, reference, int pos ):             # <<<<<<<<<<<<<<
- *         """call a snp on chromosome *reference*
- *         and position *pos*.
- */
-
-static PyObject *__pyx_pf_9csamtools_11IndelCaller_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_11IndelCaller_call[] = "IndelCaller.call(self, reference, int pos)\ncall a snp on chromosome *reference*\n        and position *pos*.\n\n        returns a :class:`SNPCall` object or None, if no indel call could be made.\n        ";
-static PyObject *__pyx_pf_9csamtools_11IndelCaller_call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_reference = 0;
-  int __pyx_v_pos;
-  int __pyx_v_tid;
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__pos,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("call");
-  __Pyx_TraceCall("call", __pyx_f[0], 3306);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[2] = {0,0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-      case  1:
-      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
-      if (likely(values[1])) kw_args--;
-      else {
-        __Pyx_RaiseArgtupleInvalid("call", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "call") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_reference = values[0];
-    __pyx_v_pos = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_pos == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
-    __pyx_v_pos = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_pos == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("call", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("csamtools.IndelCaller.call");
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3313
- *         """
- * 
- *         cdef int tid = self.iter.samfile.gettid( reference )             # <<<<<<<<<<<<<<
- * 
- *         self.iter.reset( tid, pos, pos + 1 )
- */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter->samfile), __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_reference);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
-  __Pyx_GIVEREF(__pyx_v_reference);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_tid = __pyx_t_4;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3315
- *         cdef int tid = self.iter.samfile.gettid( reference )
- * 
- *         self.iter.reset( tid, pos, pos + 1 )             # <<<<<<<<<<<<<<
- * 
- *         while 1:
- */
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyInt_FromLong((__pyx_v_pos + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->reset(((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3317
- *         self.iter.reset( tid, pos, pos + 1 )
- * 
- *         while 1:             # <<<<<<<<<<<<<<
- *             self.iter.cnext()
- * 
- */
-  while (1) {
-    if (!1) break;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3318
- * 
- *         while 1:
- *             self.iter.cnext()             # <<<<<<<<<<<<<<
- * 
- *             if self.iter.n_plp < 0:
- */
-    ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter);
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3320
- *             self.iter.cnext()
- * 
- *             if self.iter.n_plp < 0:             # <<<<<<<<<<<<<<
- *                 raise ValueError("error during iteration" )
- * 
- */
-    __pyx_t_6 = (((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter->n_plp < 0);
-    if (__pyx_t_6) {
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3321
- * 
- *             if self.iter.n_plp < 0:
- *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
- * 
- *             if self.iter.plp == NULL:
- */
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_59));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
-    }
-    __pyx_L8:;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3323
- *                 raise ValueError("error during iteration" )
- * 
- *             if self.iter.plp == NULL:             # <<<<<<<<<<<<<<
- *                 raise ValueError( "no reads in region - no call" )
- * 
- */
-    __pyx_t_6 = (((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter->plp == NULL);
-    if (__pyx_t_6) {
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3324
- * 
- *             if self.iter.plp == NULL:
- *                 raise ValueError( "no reads in region - no call" )             # <<<<<<<<<<<<<<
- * 
- *             if self.iter.pos == pos: break
- */
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_109));
-      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_109));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_109));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L9;
-    }
-    __pyx_L9:;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3326
- *                 raise ValueError( "no reads in region - no call" )
- * 
- *             if self.iter.pos == pos: break             # <<<<<<<<<<<<<<
- * 
- *         return self._call()
- */
-    __pyx_t_6 = (((struct __pyx_obj_9csamtools_IndelCaller *)__pyx_v_self)->__pyx_base.iter->pos == __pyx_v_pos);
-    if (__pyx_t_6) {
-      goto __pyx_L7_break;
-      goto __pyx_L10;
-    }
-    __pyx_L10:;
-  }
-  __pyx_L7_break:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3328
- *             if self.iter.pos == pos: break
- * 
- *         return self._call()             # <<<<<<<<<<<<<<
- * 
- * cdef class IteratorIndelCalls( IndelCallerBase ):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___call); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("csamtools.IndelCaller.call");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3344
- *     """
- * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   IteratorColumn iterator_column,
- *                   **kwargs ):
- */
-
-static int __pyx_pf_9csamtools_18IteratorIndelCalls___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_18IteratorIndelCalls___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_iterator_column = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iterator_column,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 3344);
-  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[1] = {0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterator_column);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)values[0]);
-  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
-    goto __pyx_L5_argtuple_error;
-  } else {
-    __pyx_v_iterator_column = ((struct __pyx_obj_9csamtools_IteratorColumn *)PyTuple_GET_ITEM(__pyx_args, 0));
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_AddTraceback("csamtools.IteratorIndelCalls.__cinit__");
-  __Pyx_RefNannyFinishContext();
-  return -1;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterator_column), __pyx_ptype_9csamtools_IteratorColumn, 1, "iterator_column", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.IteratorIndelCalls.__cinit__");
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_kwargs);
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3350
- * 
- * 
- *     def __iter__(self):             # <<<<<<<<<<<<<<
- *         return self
- * 
- */
-
-static PyObject *__pyx_pf_9csamtools_18IteratorIndelCalls___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_9csamtools_18IteratorIndelCalls___iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__");
-  __Pyx_TraceCall("__iter__", __pyx_f[0], 3350);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3351
- * 
- *     def __iter__(self):
- *         return self             # <<<<<<<<<<<<<<
- * 
- *     def __next__(self):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(__pyx_v_self);
-  __pyx_r = __pyx_v_self;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3353
- *         return self
- * 
- *     def __next__(self):             # <<<<<<<<<<<<<<
- *         """python version of next().
- *         """
- */
-
-static PyObject *__pyx_pf_9csamtools_18IteratorIndelCalls___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18IteratorIndelCalls___next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorIndelCalls___next__;
-static PyObject *__pyx_pf_9csamtools_18IteratorIndelCalls___next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = NULL;
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__");
-  __Pyx_TraceCall("__next__", __pyx_f[0], 3353);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3358
- * 
- *         # the following code was adapted from bam_plcmd.c:pileup_func()
- *         self.iter.cnext()             # <<<<<<<<<<<<<<
- * 
- *         if self.iter.n_plp < 0:
- */
-  ((struct __pyx_vtabstruct_9csamtools_IteratorColumn *)((struct __pyx_obj_9csamtools_IteratorIndelCalls *)__pyx_v_self)->__pyx_base.iter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorIndelCalls *)__pyx_v_self)->__pyx_base.iter);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3360
- *         self.iter.cnext()
- * 
- *         if self.iter.n_plp < 0:             # <<<<<<<<<<<<<<
- *             raise ValueError("error during iteration" )
- * 
- */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorIndelCalls *)__pyx_v_self)->__pyx_base.iter->n_plp < 0);
-  if (__pyx_t_1) {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3361
- * 
- *         if self.iter.n_plp < 0:
- *             raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
- * 
- *         if self.iter.plp == NULL:
- */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_59));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
-  }
-  __pyx_L5:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3363
- *             raise ValueError("error during iteration" )
- * 
- *         if self.iter.plp == NULL:             # <<<<<<<<<<<<<<
- *            raise StopIteration
- * 
- */
-  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorIndelCalls *)__pyx_v_self)->__pyx_base.iter->plp == NULL);
-  if (__pyx_t_1) {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3364
- * 
- *         if self.iter.plp == NULL:
- *            raise StopIteration             # <<<<<<<<<<<<<<
- * 
- *         return self._call()
- */
-    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L6;
-  }
-  __pyx_L6:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3366
- *            raise StopIteration
- * 
- *         return self._call()             # <<<<<<<<<<<<<<
- * 
- * 
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___call); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_r = __pyx_t_2;
-  __pyx_t_2 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("csamtools.IteratorIndelCalls.__next__");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3386
- *     cdef int owns_samfile
- * 
- *     def __init__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
- *         self.samfile = samfile
- * 
- */
-
-static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
-  int __pyx_v_reopen;
-  PyObject *__pyx_v_mode;
-  PyObject *__pyx_v_store;
-  int __pyx_r;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  char *__pyx_t_3;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__");
-  __Pyx_TraceCall("__init__", __pyx_f[0], 3386);
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
-    PyObject* values[2] = {0,0};
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-      case  1:
-      if (kw_args > 0) {
-        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
-        if (value) { values[1] = value; kw_args--; }
-      }
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
-    if (values[1]) {
-      __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    } else {
-      __pyx_v_reopen = ((int)1);
-    }
-  } else {
-    __pyx_v_reopen = ((int)1);
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      case  1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
-      break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("csamtools.IndexedReads.__init__");
-  __Pyx_RefNannyFinishContext();
-  return -1;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3387
- * 
- *     def __init__(self, Samfile samfile, int reopen = True ):
- *         self.samfile = samfile             # <<<<<<<<<<<<<<
- * 
- *         if samfile.isbam: mode = "rb"
- */
-  __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
-  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile);
-  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
-  ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile = __pyx_v_samfile;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3389
- *         self.samfile = samfile
- * 
- *         if samfile.isbam: mode = "rb"             # <<<<<<<<<<<<<<
- *         else: mode = "r"
- * 
- */
-  if (__pyx_v_samfile->isbam) {
-    __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
-    goto __pyx_L6;
-  }
-  /*else*/ {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3390
- * 
- *         if samfile.isbam: mode = "rb"
- *         else: mode = "r"             # <<<<<<<<<<<<<<
- * 
- *         # reopen the file - note that this makes the iterator
- */
-    __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
-  }
-  __pyx_L6:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3394
- *         # reopen the file - note that this makes the iterator
- *         # slow and causes pileup to slow down significantly.
- *         if reopen:             # <<<<<<<<<<<<<<
- *             store = StderrStore()
- *             self.fp = samopen( samfile._filename, mode, NULL )
- */
-  if (__pyx_v_reopen) {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3395
- *         # slow and causes pileup to slow down significantly.
- *         if reopen:
- *             store = StderrStore()             # <<<<<<<<<<<<<<
- *             self.fp = samopen( samfile._filename, mode, NULL )
- *             store.release()
- */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_v_store);
-    __pyx_v_store = __pyx_t_2;
-    __pyx_t_2 = 0;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3396
- *         if reopen:
- *             store = StderrStore()
- *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
- *             store.release()
- *             assert self.fp != NULL
- */
-    __pyx_t_3 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL);
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3397
- *             store = StderrStore()
- *             self.fp = samopen( samfile._filename, mode, NULL )
- *             store.release()             # <<<<<<<<<<<<<<
- *             assert self.fp != NULL
- *             self.owns_samfile = True
- */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3398
- *             self.fp = samopen( samfile._filename, mode, NULL )
- *             store.release()
- *             assert self.fp != NULL             # <<<<<<<<<<<<<<
- *             self.owns_samfile = True
- *         else:
- */
-    #ifndef PYREX_WITHOUT_ASSERTIONS
-    if (unlikely(!(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp != NULL))) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3399
- *             store.release()
- *             assert self.fp != NULL
- *             self.owns_samfile = True             # <<<<<<<<<<<<<<
- *         else:
- *             self.fp = samfile.samfile
- */
-    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 1;
-    goto __pyx_L7;
-  }
-  /*else*/ {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3401
- *             self.owns_samfile = True
- *         else:
- *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
- *             self.owns_samfile = False
- * 
- */
-    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3402
- *         else:
- *             self.fp = samfile.samfile
- *             self.owns_samfile = False             # <<<<<<<<<<<<<<
- * 
- *         assert samfile.isbam, "can only IndexReads on bam files"
- */
-    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 0;
-  }
-  __pyx_L7:;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3404
- *             self.owns_samfile = False
- * 
- *         assert samfile.isbam, "can only IndexReads on bam files"             # <<<<<<<<<<<<<<
- * 
- *     def build( self ):
- */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  if (unlikely(!__pyx_v_samfile->isbam)) {
-    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_112));
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("csamtools.IndexedReads.__init__");
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_mode);
-  __Pyx_DECREF(__pyx_v_store);
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3406
- *         assert samfile.isbam, "can only IndexReads on bam files"
- * 
- *     def build( self ):             # <<<<<<<<<<<<<<
- *         '''build index.'''
- * 
- */
-
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_12IndexedReads_build[] = "IndexedReads.build(self)\nbuild index.";
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  int __pyx_v_ret;
-  bam1_t *__pyx_v_b;
-  uint64_t __pyx_v_pos;
-  char *__pyx_v_qname;
-  PyObject *__pyx_r = NULL;
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("build");
-  __Pyx_TraceCall("build", __pyx_f[0], 3406);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3409
- *         '''build index.'''
- * 
- *         self.index = collections.defaultdict( list )             # <<<<<<<<<<<<<<
- * 
- *         # this method will start indexing from the current file position
- */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyList_Type)));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)&PyList_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyList_Type)));
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
-  __Pyx_DECREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
-  ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index = __pyx_t_3;
-  __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3413
- *         # this method will start indexing from the current file position
- *         # if you decide
- *         cdef int ret = 1             # <<<<<<<<<<<<<<
- *         cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )
- * 
- */
-  __pyx_v_ret = 1;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3414
- *         # if you decide
- *         cdef int ret = 1
- *         cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )             # <<<<<<<<<<<<<<
- * 
- *         cdef uint64_t pos
- */
-  __pyx_v_b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3418
- *         cdef uint64_t pos
- * 
- *         while ret > 0:             # <<<<<<<<<<<<<<
- *             pos = bam_tell( self.fp.x.bam )
- *             ret = samread( self.fp, b)
- */
-  while (1) {
-    __pyx_t_4 = (__pyx_v_ret > 0);
-    if (!__pyx_t_4) break;
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3419
- * 
- *         while ret > 0:
- *             pos = bam_tell( self.fp.x.bam )             # <<<<<<<<<<<<<<
- *             ret = samread( self.fp, b)
- *             if ret > 0:
- */
-    __pyx_v_pos = bam_tell(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp->x.bam);
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3420
- *         while ret > 0:
- *             pos = bam_tell( self.fp.x.bam )
- *             ret = samread( self.fp, b)             # <<<<<<<<<<<<<<
- *             if ret > 0:
- *                 qname = bam1_qname( b )
- */
-    __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp, __pyx_v_b);
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3421
- *             pos = bam_tell( self.fp.x.bam )
- *             ret = samread( self.fp, b)
- *             if ret > 0:             # <<<<<<<<<<<<<<
- *                 qname = bam1_qname( b )
- *                 self.index[qname].append( pos )
- */
-    __pyx_t_4 = (__pyx_v_ret > 0);
-    if (__pyx_t_4) {
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3422
- *             ret = samread( self.fp, b)
- *             if ret > 0:
- *                 qname = bam1_qname( b )             # <<<<<<<<<<<<<<
- *                 self.index[qname].append( pos )
- * 
- */
-      __pyx_v_qname = bam1_qname(__pyx_v_b);
-
-      /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3423
- *             if ret > 0:
- *                 qname = bam1_qname( b )
- *                 self.index[qname].append( pos )             # <<<<<<<<<<<<<<
- * 
- *         bam_destroy1( b )
- */
-      __pyx_t_3 = PyBytes_FromString(__pyx_v_qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      goto __pyx_L7;
-    }
-    __pyx_L7:;
-  }
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3425
- *                 self.index[qname].append( pos )
- * 
- *         bam_destroy1( b )             # <<<<<<<<<<<<<<
- * 
- *     def find( self, qname ):
- */
-  bam_destroy1(__pyx_v_b);
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("csamtools.IndexedReads.build");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3427
- *         bam_destroy1( b )
- * 
- *     def find( self, qname ):             # <<<<<<<<<<<<<<
- *         if qname in self.index:
- *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
- */
-
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
-static char __pyx_doc_9csamtools_12IndexedReads_find[] = "IndexedReads.find(self, qname)";
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
-  PyObject *__pyx_r = NULL;
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("find");
-  __Pyx_TraceCall("find", __pyx_f[0], 3427);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3428
- * 
- *     def find( self, qname ):
- *         if qname in self.index:             # <<<<<<<<<<<<<<
- *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
- *         else:
- */
-  __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3429
- *     def find( self, qname ):
- *         if qname in self.index:
- *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )             # <<<<<<<<<<<<<<
- *         else:
- *             raise KeyError( "read %s not found" % qname )
- */
-    __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
-    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowSelection)), __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_r = __pyx_t_4;
-    __pyx_t_4 = 0;
-    goto __pyx_L0;
-    goto __pyx_L5;
-  }
-  /*else*/ {
-
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3431
- *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
- *         else:
- *             raise KeyError( "read %s not found" % qname )             # <<<<<<<<<<<<<<
- * 
- *     def __dealloc__(self):
- */
-    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_113), __pyx_v_qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  __pyx_L5:;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("csamtools.IndexedReads.find");
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_TraceReturn(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3433
- *             raise KeyError( "read %s not found" % qname )
- * 
- *     def __dealloc__(self):             # <<<<<<<<<<<<<<
- *         if self.owns_samfile: samclose( self.fp )
- * 
- */
-
-static void __pyx_pf_9csamtools_12IndexedReads___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_9csamtools_12IndexedReads___dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__");
-  __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3433);
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3434
- * 
- *     def __dealloc__(self):
- *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
- * 
- * __all__ = ["Samfile",
- */
-  if (((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile) {
-    samclose(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp);
-    goto __pyx_L5;
-  }
-  __pyx_L5:;
-
-  __Pyx_TraceReturn(Py_None);
-  __Pyx_RefNannyFinishContext();
-}
-
-static PyObject *__pyx_tp_new_9csamtools_AlignedRead(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_11AlignedRead___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_5qname___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_5qname___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_5cigar___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_3seq___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_3seq___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4qual___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_4qual___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_5query___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4qend___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4tags___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_4tags___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4flag___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_4flag___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_5rname___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_5rname___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_3tid___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_3tid___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_3pos___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_3pos___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_3bin___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_3bin___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4aend___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4alen___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_4mapq___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_4mrnm___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_4mpos___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_5isize___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_5isize___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_9is_paired___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_8is_read1___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_8is_read2___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11AlignedRead_9positions___get__(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = {
-  {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_compare)},
-  {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_overlap)},
-  {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_opt)},
-  {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_fancy_str)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_9csamtools_AlignedRead[] = {
-  {(char *)"qname", __pyx_getprop_9csamtools_11AlignedRead_qname, __pyx_setprop_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_114), 0},
-  {(char *)"cigar", __pyx_getprop_9csamtools_11AlignedRead_cigar, __pyx_setprop_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_115), 0},
-  {(char *)"seq", __pyx_getprop_9csamtools_11AlignedRead_seq, __pyx_setprop_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_116), 0},
-  {(char *)"qual", __pyx_getprop_9csamtools_11AlignedRead_qual, __pyx_setprop_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_117), 0},
-  {(char *)"query", __pyx_getprop_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_118), 0},
-  {(char *)"qqual", __pyx_getprop_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_119), 0},
-  {(char *)"qstart", __pyx_getprop_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_120), 0},
-  {(char *)"qend", __pyx_getprop_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_121), 0},
-  {(char *)"qlen", __pyx_getprop_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_122), 0},
-  {(char *)"tags", __pyx_getprop_9csamtools_11AlignedRead_tags, __pyx_setprop_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_123), 0},
-  {(char *)"flag", __pyx_getprop_9csamtools_11AlignedRead_flag, __pyx_setprop_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_124), 0},
-  {(char *)"rname", __pyx_getprop_9csamtools_11AlignedRead_rname, __pyx_setprop_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_125), 0},
-  {(char *)"tid", __pyx_getprop_9csamtools_11AlignedRead_tid, __pyx_setprop_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_126), 0},
-  {(char *)"pos", __pyx_getprop_9csamtools_11AlignedRead_pos, __pyx_setprop_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_127), 0},
-  {(char *)"bin", __pyx_getprop_9csamtools_11AlignedRead_bin, __pyx_setprop_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_128), 0},
-  {(char *)"rlen", __pyx_getprop_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_129), 0},
-  {(char *)"aend", __pyx_getprop_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_130), 0},
-  {(char *)"alen", __pyx_getprop_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_131), 0},
-  {(char *)"mapq", __pyx_getprop_9csamtools_11AlignedRead_mapq, __pyx_setprop_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_132), 0},
-  {(char *)"mrnm", __pyx_getprop_9csamtools_11AlignedRead_mrnm, __pyx_setprop_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_133), 0},
-  {(char *)"mpos", __pyx_getprop_9csamtools_11AlignedRead_mpos, __pyx_setprop_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_134), 0},
-  {(char *)"isize", __pyx_getprop_9csamtools_11AlignedRead_isize, __pyx_setprop_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_135), 0},
-  {(char *)"is_paired", __pyx_getprop_9csamtools_11AlignedRead_is_paired, __pyx_setprop_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_136), 0},
-  {(char *)"is_proper_pair", __pyx_getprop_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_137), 0},
-  {(char *)"is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_138), 0},
-  {(char *)"mate_is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_139), 0},
-  {(char *)"is_reverse", __pyx_getprop_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_140), 0},
-  {(char *)"mate_is_reverse", __pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_141), 0},
-  {(char *)"is_read1", __pyx_getprop_9csamtools_11AlignedRead_is_read1, __pyx_setprop_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_142), 0},
-  {(char *)"is_read2", __pyx_getprop_9csamtools_11AlignedRead_is_read2, __pyx_setprop_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_143), 0},
-  {(char *)"is_secondary", __pyx_getprop_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_144), 0},
-  {(char *)"is_qcfail", __pyx_getprop_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_145), 0},
-  {(char *)"is_duplicate", __pyx_getprop_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_146), 0},
-  {(char *)"positions", __pyx_getprop_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_147), 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_AlignedRead = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_AlignedRead = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_AlignedRead = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_AlignedRead = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.AlignedRead"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_AlignedRead), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_AlignedRead, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/
-  &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/
-  __pyx_pf_9csamtools_11AlignedRead___hash__, /*tp_hash*/
-  0, /*tp_call*/
-  __pyx_pf_9csamtools_11AlignedRead___str__, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("AlignedRead()\n\n    Class representing an aligned read. see SAM format specification for \n    the meaning of fields (http://samtools.sourceforge.net/).\n\n    This class stores a handle to the samtools C-structure representing\n    an aligned read. Member read access is forwarded to the C-structure\n    and converted into python objects. This implementation should be fast,\n    as only the data needed is converted.\n\n    For write access, the C-structure is updated in-place. This is\n    not the most efficient way to build BAM entries, as the variable\n    length data is concatenated and thus needs to resized if\n    a field is updated. Furthermore, the BAM entry might be\n    in an inconsistent state. The :meth:`~validate` method can\n    be used to check if an entry is consistent.\n\n    One issue to look out for is that the sequence should always\n    be set *before* the quality scores. Setting the sequence will\n    also erase any quality scores that were set previously.\n    "), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_AlignedRead, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_9csamtools_AlignedRead, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  __pyx_pf_9csamtools_11AlignedRead___init__, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-static struct __pyx_vtabstruct_9csamtools_Samfile __pyx_vtable_9csamtools_Samfile;
-
-static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_Samfile *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_Samfile *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile;
-  if (__pyx_pf_9csamtools_7Samfile___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_7Samfile___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7Samfile_8filename___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7Samfile_11nreferences___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7Samfile_10references___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7Samfile_7lengths___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7Samfile_4text___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7Samfile_6header___get__(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_Samfile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_7Samfile__isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile__isOpen)},
-  {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pf_9csamtools_7Samfile__hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile__hasIndex)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_7Samfile__open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile__open)},
-  {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_gettid)},
-  {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_getrname)},
-  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_9csamtools_7Samfile__parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile__parseRegion)},
-  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_seek)},
-  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_tell)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_fetch)},
-  {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_mate)},
-  {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_count)},
-  {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_pileup)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_close)},
-  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_write)},
-  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile___enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile___enter__)},
-  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile___exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile___exit__)},
-  {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pf_9csamtools_7Samfile__buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile__buildLine)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile___next__)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_9csamtools_Samfile[] = {
-  {(char *)"filename", __pyx_getprop_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_148), 0},
-  {(char *)"nreferences", __pyx_getprop_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_149), 0},
-  {(char *)"references", __pyx_getprop_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_150), 0},
-  {(char *)"lengths", __pyx_getprop_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_151), 0},
-  {(char *)"text", __pyx_getprop_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_152), 0},
-  {(char *)"header", __pyx_getprop_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_153), 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_Samfile = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_Samfile = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_Samfile = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Samfile = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_Samfile = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.Samfile"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_Samfile), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_Samfile, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_Samfile, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Samfile, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Samfile, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Samfile, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None)*\n              \n    A :term:`SAM`/:term:`BAM` formatted file. The file is automatically opened.\n    \n    *mode* should be ``r`` for reading or ``w`` for writing. The default is text mode (:term:`SAM`). For binary \n    (:term:`BAM`) I/O you should append ``b`` for compressed or ``u`` for uncompressed :term:`BAM` output. \n    Use ``h`` to output header information in text (:term:`TAM`)  mode.\n\n    If ``b`` is present, it must immediately follow ``r`` or ``w``. \n    Valid modes are ``r``, ``w``, ``wh``, ``rb``, ``wb`` and ``wbu``. For instance, to open \n    a :term:`BAM` formatted file for reading, type::\n\n        f = pysam.Samfile('ex1.bam','rb')\n\n    If mode is not specified, we will try to auto-detect in the order 'r', 'rb', thus both the following\n    should work::\n\n        f1 = pysam.Samfile('ex1.bam' )\n        f2 = pysam.Samfile('ex1.bam' )\n\n    If an index for a BAM file exists (.bai), it will be opened automatically. Without an index random\n    access to reads via :meth:`fetch` and :meth:`pileup` is disabled.\n\n    For writing, the header of a :term:`SAM` file/:term:`BAM` file can be constituted from several\n    sources (see also the samtools format specification):\n\n        1. If *template* is given, the header is copied from a another *Samfile* \n           (*template* must be of type *Samfile*).\n\n        2. If *header* is given, the header is built from a multi-level dictionary. The first level \n           are the four types ('HD', 'SQ', ...). The second level are a list of lines, with each line \n           being a list of tag-value pairs.\n\n        3. If *text* is given, new header text is copied from raw text.\n\n        4. The names (*referencenames*) and lengths (*referencelengths*) are supplied directly as lists. \n\n    "), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_7Samfile___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_7Samfile___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_Samfile, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_9csamtools_Samfile, /*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_9csamtools_Samfile, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-
-static PyObject *__pyx_tp_new_9csamtools_PileupProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) {
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11PileupProxy_3tid___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11PileupProxy_1n___get__(o);
-}
-
-static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) {
-  if (v) {
-    return __pyx_pf_9csamtools_11PileupProxy_1n___set__(o, v);
-  }
-  else {
-    PyErr_SetString(PyExc_NotImplementedError, "__del__");
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11PileupProxy_3pos___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_9csamtools_PileupProxy[] = {
-  {(char *)"tid", __pyx_getprop_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_154), 0},
-  {(char *)"n", __pyx_getprop_9csamtools_11PileupProxy_n, __pyx_setprop_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_155), 0},
-  {(char *)"pos", __pyx_getprop_9csamtools_11PileupProxy_pos, 0, 0, 0},
-  {(char *)"pileups", __pyx_getprop_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_156), 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_PileupProxy = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_PileupProxy = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_PileupProxy = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_PileupProxy = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_PileupProxy = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.PileupProxy"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_PileupProxy), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_PileupProxy, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_PileupProxy, /*tp_as_number*/
-  &__pyx_tp_as_sequence_PileupProxy, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  __pyx_pf_9csamtools_11PileupProxy___str__, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_PileupProxy, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("PileupProxy()\nA pileup column. A pileup column contains\n    all the reads that map to a certain target base.\n\n    tid\n        chromosome ID as is defined in the header\n    pos\n        the target base coordinate (0-based)\n    n\n        number of reads mapping to this column    \n    pileups\n        list of reads (:class:`pysam.PileupRead`) aligned to this column\n\n    This class is a proxy for results returned by the samtools pileup engine.\n    If the underlying engine iterator advances, the results of this column\n    will change.\n    "), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_PileupProxy, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_9csamtools_PileupProxy, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  __pyx_pf_9csamtools_11PileupProxy___init__, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-
-static PyObject *__pyx_tp_new_9csamtools_PileupRead(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_PileupRead *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_PileupRead *)o);
-  p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_PileupRead(PyObject *o) {
-  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
-  Py_XDECREF(((PyObject *)p->_alignment));
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
-  if (p->_alignment) {
-    e = (*v)(((PyObject*)p->_alignment), a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) {
-  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->_alignment);
-  p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_9alignment___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_4qpos___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_5indel___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_6is_del___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_7is_head___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_10PileupRead_5level___get__(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_9csamtools_PileupRead[] = {
-  {(char *)"alignment", __pyx_getprop_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_157), 0},
-  {(char *)"qpos", __pyx_getprop_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_158), 0},
-  {(char *)"indel", __pyx_getprop_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_159), 0},
-  {(char *)"is_del", __pyx_getprop_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_160), 0},
-  {(char *)"is_head", __pyx_getprop_9csamtools_10PileupRead_is_head, 0, 0, 0},
-  {(char *)"is_tail", __pyx_getprop_9csamtools_10PileupRead_is_tail, 0, 0, 0},
-  {(char *)"level", __pyx_getprop_9csamtools_10PileupRead_level, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_PileupRead = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_PileupRead = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_PileupRead = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_PileupRead = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_PileupRead = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.PileupRead"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_PileupRead), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_PileupRead, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_PileupRead, /*tp_as_number*/
-  &__pyx_tp_as_sequence_PileupRead, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  __pyx_pf_9csamtools_10PileupRead___str__, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_PileupRead, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("PileupRead()\nA read aligned to a column.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_PileupRead, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_PileupRead, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_PileupRead, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_9csamtools_PileupRead, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  __pyx_pf_9csamtools_10PileupRead___init__, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-static struct __pyx_vtabstruct_9csamtools_Fastafile __pyx_vtable_9csamtools_Fastafile;
-
-static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_Fastafile *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_Fastafile *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile;
-  if (__pyx_pf_9csamtools_9Fastafile___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_9Fastafile___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9Fastafile_8filename___get__(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile__isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile__isOpen)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile__open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile__open)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_close)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_fetch)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_9csamtools_Fastafile[] = {
-  {(char *)"filename", __pyx_getprop_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_148), 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_Fastafile = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
-  __pyx_pf_9csamtools_9Fastafile___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_Fastafile = {
-  __pyx_pf_9csamtools_9Fastafile___len__, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Fastafile = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_Fastafile = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.Fastafile"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_Fastafile), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_Fastafile, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_Fastafile, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Fastafile, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Fastafile, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Fastafile, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("*(filename)*\n              \n    A *FASTA* file. The file is automatically opened.\n\n    The file expects an indexed fasta file.\n\n    TODO: \n        add automatic indexing.\n        add function to get sequence names.\n    "), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_Fastafile, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_9csamtools_Fastafile, /*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_9csamtools_Fastafile, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-
-static PyObject *__pyx_tp_new_9csamtools_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_IteratorRow(PyObject *o) {
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_IteratorRow[] = {
-  {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_IteratorRow = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_IteratorRow = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_IteratorRow = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_IteratorRow = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorRow"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorRow), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorRow, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorRow, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorRow, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorRow, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorRow, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("abstract base class for iterators over mapped reads.\n\n    Various iterators implement different behaviours for wrapping around\n    contig boundaries. Examples include:\n\n    :class:`pysam.IteratorRowRegion`\n        iterate within a single contig and a defined region.\n\n    :class:`pysam.IteratorRowAll`\n        iterate until EOF. This iterator will also include unmapped reads.\n\n    :class:`pysam.IteratorRowAllRefs`\n        iterate over all reads in all reference sequences.\n        \n    The method :meth:`Samfile.fetch` returns an IteratorRow.\n    "), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorRow, /*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_9csamtools_IteratorRow, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion __pyx_vtable_9csamtools_IteratorRowRegion;
-
-static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorRowRegion *p;
-  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowRegion;
-  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pf_9csamtools_17IteratorRowRegion___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_17IteratorRowRegion___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_XDECREF(((PyObject *)p->samfile));
-  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
-}
-
-static int __pyx_tp_traverse_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
-  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
-    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
-  }
-  if (p->samfile) {
-    e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
-  PyObject* tmp;
-  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
-    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
-  }
-  tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
-}
-
-static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_17IteratorRowRegion___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion___next__)},
-  {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_IteratorRowRegion = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_IteratorRowRegion = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_IteratorRowRegion = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_IteratorRowRegion = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorRowRegion"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorRowRegion), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorRowRegion, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorRowRegion, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorRowRegion, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorRowRegion, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorRowRegion, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("*(Samfile samfile, int tid, int beg, int end, int reopen = True )*\n\n    iterate over mapped reads in a region.\n\n    By default, the file is re-openend to avoid conflicts between\n    multiple iterators working on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n\n    The samtools iterators assume that the file\n    position between iterations do not change.\n    As a consequence, no two iterators can work\n    on the same file. To permit this, each iterator\n    creates its own file handle by re-opening the\n    file.\n\n    Note that the index will be shared between \n    samfile and the iterator.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IteratorRowRegion, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_17IteratorRowRegion___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_17IteratorRowRegion___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorRowRegion, /*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_9csamtools_IteratorRowRegion, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-static struct __pyx_vtabstruct_9csamtools_IteratorRowAll __pyx_vtable_9csamtools_IteratorRowAll;
-
-static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorRowAll *p;
-  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll;
-  if (__pyx_pf_9csamtools_14IteratorRowAll___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
-}
-
-static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_14IteratorRowAll___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
-}
-
-static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_14IteratorRowAll___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll___next__)},
-  {0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = {
+static PyNumberMethods __pyx_tp_as_number_AlignedRead = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -32722,7 +28128,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = {
+static PySequenceMethods __pyx_tp_as_sequence_AlignedRead = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -32735,13 +28141,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAll = {
+static PyMappingMethods __pyx_tp_as_mapping_AlignedRead = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = {
+static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -32762,12 +28168,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
+static PyTypeObject __pyx_type_9csamtools_AlignedRead = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorRowAll"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorRowAll), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.AlignedRead"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_AlignedRead), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorRowAll, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_AlignedRead, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -32777,34 +28183,34 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorRowAll, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorRowAll, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorRowAll, /*tp_as_mapping*/
-  0, /*tp_hash*/
+  &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/
+  &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/
+  __pyx_pf_9csamtools_11AlignedRead_4__hash__, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_pf_9csamtools_11AlignedRead_2__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorRowAll, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("*(Samfile samfile, int reopen = True)*\n\n    iterate over all reads in *samfile*\n\n    By default, the file is re-openend to avoid conflicts between\n    multiple iterators working on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n    "), /*tp_doc*/
+  &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("AlignedRead()\n\n    Class representing an aligned read. see SAM format specification for \n    the meaning of fields (http://samtools.sourceforge.net/).\n\n    This class stores a handle to the samtools C-structure representing\n    an aligned read. Member read access is forwarded to the C-structure\n    and converted into python objects. This implementation should be fast,\n    as only the data needed is converted.\n\n    For write access, the C-structure is updated in-place. This is\n    not the most efficient way to build BAM entries, as the variable\n    length data is concatenated and thus needs to resized if\n    a field is updated. Furthermore, the BAM entry might be\n    in an inconsistent state. The :meth:`~validate` method can\n    be used to check if an entry is consistent.\n\n    One issue to look out for is that the sequence should always\n    be set *before* the quality scores. Setting the sequence will\n    also erase any quality scores that were set previously.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_14IteratorRowAll___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_14IteratorRowAll___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorRowAll, /*tp_methods*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_9csamtools_AlignedRead, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_9csamtools_AlignedRead, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_pf_9csamtools_11AlignedRead___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorRowAll, /*tp_new*/
+  __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -32817,64 +28223,101 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
   0, /*tp_version_tag*/
   #endif
 };
+static struct __pyx_vtabstruct_9csamtools_Samfile __pyx_vtable_9csamtools_Samfile;
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p;
-  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_Samfile *p;
+  PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o);
-  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_Samfile *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile;
+  if (__pyx_pf_9csamtools_7Samfile___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
-  Py_XDECREF(((PyObject *)p->samfile));
-  Py_XDECREF(((PyObject *)p->rowiter));
-  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
+static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_pf_9csamtools_7Samfile_15__dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
-  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
-    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
-  }
-  if (p->samfile) {
-    e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
-  }
-  if (p->rowiter) {
-    e = (*v)(((PyObject*)p->rowiter), a); if (e) return e;
-  }
-  return 0;
+static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_8filename___get__(o);
 }
 
-static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
-  PyObject* tmp;
-  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
-    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
-  }
-  tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->rowiter);
-  p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
+static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_11nreferences___get__(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = {
-  {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_nextiter)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs___next__)},
+static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_10references___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_7lengths___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7Samfile_mapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_6mapped___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7Samfile_unmapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_8unmapped___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_4text___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_6header___get__(o);
+}
+
+static PyMethodDef __pyx_methods_9csamtools_Samfile[] = {
+  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_1_isOpen)},
+  {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_2_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_2_hasIndex)},
+  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_3_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_3_open)},
+  {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_4gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_4gettid)},
+  {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_5getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_5getrname)},
+  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_6_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_6_parseRegion)},
+  {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_7reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_7reset)},
+  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_8seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_8seek)},
+  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_9tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_9tell)},
+  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_10fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_10fetch)},
+  {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_11mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_11mate)},
+  {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_12count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_12count)},
+  {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_13pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_13pileup)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_14close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_14close)},
+  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_16write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_16write)},
+  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_17__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_17__enter__)},
+  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_18__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_18__exit__)},
+  {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_19_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_19_buildLine)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_21__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_21__next__)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IteratorRowAllRefs = {
+static struct PyGetSetDef __pyx_getsets_9csamtools_Samfile[] = {
+  {(char *)"filename", __pyx_getprop_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
+  {(char *)"nreferences", __pyx_getprop_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_207), 0},
+  {(char *)"references", __pyx_getprop_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_208), 0},
+  {(char *)"lengths", __pyx_getprop_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_209), 0},
+  {(char *)"mapped", __pyx_getprop_9csamtools_7Samfile_mapped, 0, __Pyx_DOCSTR(__pyx_k_210), 0},
+  {(char *)"unmapped", __pyx_getprop_9csamtools_7Samfile_unmapped, 0, __Pyx_DOCSTR(__pyx_k_211), 0},
+  {(char *)"text", __pyx_getprop_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_212), 0},
+  {(char *)"header", __pyx_getprop_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_213), 0},
+  {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_Samfile = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -32932,7 +28375,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorRowAllRefs = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAllRefs = {
+static PySequenceMethods __pyx_tp_as_sequence_Samfile = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -32945,13 +28388,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAllRefs = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAllRefs = {
+static PyMappingMethods __pyx_tp_as_mapping_Samfile = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = {
+static PyBufferProcs __pyx_tp_as_buffer_Samfile = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -32972,12 +28415,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
+static PyTypeObject __pyx_type_9csamtools_Samfile = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorRowAllRefs"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.Samfile"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_Samfile), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_Samfile, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -32987,26 +28430,26 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorRowAllRefs, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorRowAllRefs, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorRowAllRefs, /*tp_as_mapping*/
+  &__pyx_tp_as_number_Samfile, /*tp_as_number*/
+  &__pyx_tp_as_sequence_Samfile, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_Samfile, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorRowAllRefs, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("iterates over all mapped reads by chaining iterators over each reference\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IteratorRowAllRefs, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/
+  &__pyx_tp_as_buffer_Samfile, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,\n         add_sq_text = False )*\n              \n    A :term:`SAM`/:term:`BAM` formatted file. The file is automatically opened.\n    \n    *mode* should be ``r`` for reading or ``w`` for writing. The default is text mode (:term:`SAM`). For binary \n    (:term:`BAM`) I/O you should append ``b`` for compressed or ``u`` for uncompressed :term:`BAM` output. \n    Use ``h`` to output header information in text (:term:`TAM`)  mode.\n\n    If ``b`` is present, it must immediately follow ``r`` or ``w``. \n    Valid modes are ``r``, ``w``, ``wh``, ``rb``, ``wb`` and ``wbu``. For instance, to open \n    a :term:`BAM` formatted file for reading, type::\n\n        f = pysam.Samfile('ex1.bam','rb')\n\n    If mode is not specified, we will try to auto-detect in the order 'rb', 'r', thus both the following\n    should work::\n\n        f1 = pysam.Samfile('ex1.bam' )\n        f2 = pysam.Samfile('ex1.sam' )\n\n    If an index for a BAM file exists (.bai), it will be opened automatically. Without an index random\n    access to reads via :meth:`fetch` and :meth:`pileup` is disabled.\n\n    For writing, the header of a :term:`SAM` file/:term:`BAM` file can be constituted from several\n    sources (see also the samtools format specification):\n\n        1. If *template* is given, the header is copied from a another *Samfile* \n           (*template* must be of type *Samfile*).\n\n        2. If *header* is given, the header is built from a multi-level dictionary. The first level \n           are the four types ('HD', 'SQ', ...). The second level are a list of lines, with each line \n           being a list of tag-value pairs.\n\n        3. If *text* is given, new header text is copied from raw text.\n\n        4. The names (*referencenames*) and lengths (*referencelengths*) are supplied directly as lists. \n           By default, 'SQ' and 'LN' tags will be added to the header text. This option can be\n           changed by unsetting the flag *add_sq_text*. \n\n    "), /*tp_doc*/
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_18IteratorRowAllRefs___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_18IteratorRowAllRefs___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorRowAllRefs, /*tp_methods*/
+  __pyx_pf_9csamtools_7Samfile_20__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_7Samfile_21__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_Samfile, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_9csamtools_Samfile, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -33014,7 +28457,7 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorRowAllRefs, /*tp_new*/
+  __pyx_tp_new_9csamtools_Samfile, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -33027,66 +28470,22 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection __pyx_vtable_9csamtools_IteratorRowSelection;
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorRowSelection *p;
-  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorRowSelection *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowSelection;
-  p->positions = Py_None; Py_INCREF(Py_None);
-  if (__pyx_pf_9csamtools_20IteratorRowSelection___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_20IteratorRowSelection___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_XDECREF(p->positions);
-  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
-}
-
-static int __pyx_tp_traverse_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
-  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
-    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
-  }
-  if (p->positions) {
-    e = (*v)(p->positions, a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
-  PyObject* tmp;
-  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
-    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
-  }
-  tmp = ((PyObject*)p->positions);
-  p->positions = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
+static void __pyx_tp_dealloc_9csamtools_IteratorRow(PyObject *o) {
+  (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorRowSelection___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection___next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorRow[] = {
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IteratorRowSelection = {
+static PyNumberMethods __pyx_tp_as_number_IteratorRow = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -33144,7 +28543,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorRowSelection = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorRowSelection = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorRow = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -33157,13 +28556,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorRowSelection = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorRowSelection = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorRow = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -33184,12 +28583,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRow = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorRowSelection"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorRowSelection), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRow"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRow), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorRowSelection, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRow, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -33199,24 +28598,24 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorRowSelection, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorRowSelection, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorRowSelection, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorRow, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorRow, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorRow, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorRowSelection, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("*(Samfile samfile)*\n\n    iterate over reads in *samfile* at a given list of file positions.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IteratorRowSelection, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorRow, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("abstract base class for iterators over mapped reads.\n\n    Various iterators implement different behaviours for wrapping around\n    contig boundaries. Examples include:\n\n    :class:`pysam.IteratorRowRegion`\n        iterate within a single contig and a defined region.\n\n    :class:`pysam.IteratorRowAll`\n        iterate until EOF. This iterator will also include unmapped reads.\n\n    :class:`pysam.IteratorRowAllRefs`\n        iterate over all reads in all reference sequences.\n        \n    The method :meth:`Samfile.fetch` returns an IteratorRow.\n    "), /*tp_doc*/
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_20IteratorRowSelection___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_20IteratorRowSelection___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorRowSelection, /*tp_methods*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorRow, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -33226,7 +28625,7 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorRowSelection, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRow, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -33239,94 +28638,39 @@ PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_vtable_9csamtools_IteratorColumn;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowAll __pyx_vtable_9csamtools_IteratorRowAll;
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorColumn *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowAll *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorColumn *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorColumn;
-  p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
-  p->stepper = Py_None; Py_INCREF(Py_None);
-  if (__pyx_pf_9csamtools_14IteratorColumn___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll;
+  if (__pyx_pf_9csamtools_14IteratorRowAll___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
+static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_14IteratorColumn___dealloc__(o);
+    __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_XDECREF(((PyObject *)p->iter));
-  Py_XDECREF(((PyObject *)p->samfile));
-  Py_XDECREF(((PyObject *)p->fastafile));
-  Py_XDECREF(p->stepper);
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
-  if (p->iter) {
-    e = (*v)(((PyObject*)p->iter), a); if (e) return e;
-  }
-  if (p->samfile) {
-    e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
-  }
-  if (p->fastafile) {
-    e = (*v)(((PyObject*)p->fastafile), a); if (e) return e;
-  }
-  if (p->stepper) {
-    e = (*v)(p->stepper, a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) {
-  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->iter);
-  p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->fastafile);
-  p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->stepper);
-  p->stepper = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
-}
-
-static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(o);
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = {
-  {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_addReference)},
-  {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_hasReference)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_14IteratorRowAll_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll_2__next__)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_9csamtools_IteratorColumn[] = {
-  {(char *)"seq_len", __pyx_getprop_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_161), 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_IteratorColumn = {
+static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -33384,7 +28728,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorColumn = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorColumn = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -33397,13 +28741,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorColumn = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorColumn = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAll = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -33424,12 +28768,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorColumn"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorColumn), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowAll"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowAll), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowAll, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -33439,26 +28783,26 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorColumn, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorColumn, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorColumn, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorRowAll, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorRowAll, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorRowAll, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorColumn, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("abstract base class for iterators over columns.\n\n    IteratorColumn objects wrap the pileup functionality of samtools.\n    \n    For reasons of efficiency, the iterator points to the current \n    pileup buffer. The pileup buffer is updated at every iteration.\n    This might cause some unexpected behavious. For example,\n    consider the conversion to a list::\n    \n       f = Samfile(\"file.bam\", \"rb\")\n       result = list( f.pileup() )\n\n    Here, ``result`` will contain ``n`` objects of type :class:`PileupProxy` for ``n`` columns, \n    but each object in ``result`` will contain the same information.\n    \n    The desired behaviour can be achieved by list comprehension::\n\n       result = [ x.pileups() for x in f.pileup() ]\n\n    ``result`` will be a list of ``n`` lists of objects of type :class:`PileupRead`.\n\n    If the iterator is associated with a :class:`Fastafile` using the :meth:`addReference`\n    method, then the iterator will export the current sequence via the methods :meth:`getSequence`\n    and :meth:`seq_len`.\n\n    Optional kwargs to the iterator\n\n    stepper\n       The stepper controlls how the iterator advances. \n       Possible options for the stepper are \n       \n       all\n           use all reads for pileup.\n       samtools\n           same filter and read processing as in :term:`csamtools` pileup\n    fastafile\n       A :class:`FastaFile` object\n    mask\n       Skip all reads with bits set in mask.\n       \n    \n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorRowAll, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("*(Samfile samfile, int reopen = True)*\n\n    iterate over all reads in *samfile*\n\n    By default, the file is re-openend to avoid conflicts between\n    multiple iterators working on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n    "), /*tp_doc*/
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_14IteratorColumn___iter__, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/
+  __pyx_pf_9csamtools_14IteratorRowAll_1__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_14IteratorRowAll_2__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorRowAll, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_9csamtools_IteratorColumn, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -33466,7 +28810,7 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorColumn, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowAll, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -33479,26 +28823,56 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion __pyx_vtable_9csamtools_IteratorColumnRegion;
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorColumnRegion *p;
-  PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_PileupProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion;
-  if (__pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
   return o;
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorColumnRegion___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion___next__)},
+static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) {
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_3tid___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_1n___get__(o);
+}
+
+static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) {
+  if (v) {
+    return __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(o, v);
+  }
+  else {
+    PyErr_SetString(PyExc_NotImplementedError, "__del__");
+    return -1;
+  }
+}
+
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_3pos___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(o);
+}
+
+static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = {
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IteratorColumnRegion = {
+static struct PyGetSetDef __pyx_getsets_9csamtools_PileupProxy[] = {
+  {(char *)"tid", __pyx_getprop_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_214), 0},
+  {(char *)"n", __pyx_getprop_9csamtools_11PileupProxy_n, __pyx_setprop_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_215), 0},
+  {(char *)"pos", __pyx_getprop_9csamtools_11PileupProxy_pos, 0, 0, 0},
+  {(char *)"pileups", __pyx_getprop_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_216), 0},
+  {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_PileupProxy = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -33556,7 +28930,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorColumnRegion = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnRegion = {
+static PySequenceMethods __pyx_tp_as_sequence_PileupProxy = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -33569,13 +28943,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnRegion = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnRegion = {
+static PyMappingMethods __pyx_tp_as_mapping_PileupProxy = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = {
+static PyBufferProcs __pyx_tp_as_buffer_PileupProxy = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -33596,12 +28970,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
+static PyTypeObject __pyx_type_9csamtools_PileupProxy = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorColumnRegion"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorColumnRegion), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.PileupProxy"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_PileupProxy), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_PileupProxy, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -33611,34 +28985,34 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorColumnRegion, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorColumnRegion, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorColumnRegion, /*tp_as_mapping*/
+  &__pyx_tp_as_number_PileupProxy, /*tp_as_number*/
+  &__pyx_tp_as_sequence_PileupProxy, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_pf_9csamtools_11PileupProxy_1__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorColumnRegion, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("iterates over a region only.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
+  &__pyx_tp_as_buffer_PileupProxy, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("PileupProxy()\nA pileup column. A pileup column contains\n    all the reads that map to a certain target base.\n\n    tid\n        chromosome ID as is defined in the header\n    pos\n        the target base coordinate (0-based)\n    n\n        number of reads mapping to this column    \n    pileups\n        list of reads (:class:`pysam.PileupRead`) aligned to this column\n\n    This class is a proxy for results returned by the samtools pileup engine.\n    If the underlying engine iterator advances, the results of this column\n    will change.\n    "), /*tp_doc*/
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
-  __pyx_pf_9csamtools_20IteratorColumnRegion___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/
+  0, /*tp_iternext*/
+  __pyx_methods_9csamtools_PileupProxy, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_9csamtools_PileupProxy, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_pf_9csamtools_11PileupProxy___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorColumnRegion, /*tp_new*/
+  __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -33651,26 +29025,84 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs __pyx_vtable_9csamtools_IteratorColumnAllRefs;
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorColumnAllRefs *p;
-  PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
-  if (__pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
+static PyObject *__pyx_tp_new_9csamtools_PileupRead(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_PileupRead *p;
+  PyObject *o = (*t->tp_alloc)(t, 0);
+  if (!o) return 0;
+  p = ((struct __pyx_obj_9csamtools_PileupRead *)o);
+  p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
+  return o;
+}
+
+static void __pyx_tp_dealloc_9csamtools_PileupRead(PyObject *o) {
+  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
+  Py_XDECREF(((PyObject *)p->_alignment));
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
+  if (p->_alignment) {
+    e = (*v)(((PyObject*)p->_alignment), a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) {
+  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->_alignment);
+  p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_9alignment___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_4qpos___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_5indel___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_6is_del___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_7is_head___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_5level___get__(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_21IteratorColumnAllRefs___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs___next__)},
+static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = {
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IteratorColumnAllRefs = {
+static struct PyGetSetDef __pyx_getsets_9csamtools_PileupRead[] = {
+  {(char *)"alignment", __pyx_getprop_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_217), 0},
+  {(char *)"qpos", __pyx_getprop_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_218), 0},
+  {(char *)"indel", __pyx_getprop_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_219), 0},
+  {(char *)"is_del", __pyx_getprop_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_220), 0},
+  {(char *)"is_head", __pyx_getprop_9csamtools_10PileupRead_is_head, 0, 0, 0},
+  {(char *)"is_tail", __pyx_getprop_9csamtools_10PileupRead_is_tail, 0, 0, 0},
+  {(char *)"level", __pyx_getprop_9csamtools_10PileupRead_level, 0, 0, 0},
+  {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_PileupRead = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -33728,7 +29160,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorColumnAllRefs = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnAllRefs = {
+static PySequenceMethods __pyx_tp_as_sequence_PileupRead = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -33741,13 +29173,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnAllRefs = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnAllRefs = {
+static PyMappingMethods __pyx_tp_as_mapping_PileupRead = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = {
+static PyBufferProcs __pyx_tp_as_buffer_PileupRead = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -33768,12 +29200,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
+static PyTypeObject __pyx_type_9csamtools_PileupRead = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorColumnAllRefs"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.PileupRead"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_PileupRead), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_PileupRead, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -33783,34 +29215,34 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorColumnAllRefs, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorColumnAllRefs, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorColumnAllRefs, /*tp_as_mapping*/
+  &__pyx_tp_as_number_PileupRead, /*tp_as_number*/
+  &__pyx_tp_as_sequence_PileupRead, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_pf_9csamtools_10PileupRead_1__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorColumnAllRefs, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("iterates over all columns by chaining iterators over each reference\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
+  &__pyx_tp_as_buffer_PileupRead, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("PileupRead()\nA read aligned to a column.\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_PileupRead, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_PileupRead, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
-  __pyx_pf_9csamtools_21IteratorColumnAllRefs___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
+  0, /*tp_iternext*/
+  __pyx_methods_9csamtools_PileupRead, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_9csamtools_PileupRead, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_pf_9csamtools_10PileupRead___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorColumnAllRefs, /*tp_new*/
+  __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -33823,66 +29255,51 @@ PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
   0, /*tp_version_tag*/
   #endif
 };
+static struct __pyx_vtabstruct_9csamtools_Fastafile __pyx_vtable_9csamtools_Fastafile;
 
-static PyObject *__pyx_tp_new_9csamtools_SNPCall(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_Fastafile *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
+  p = ((struct __pyx_obj_9csamtools_Fastafile *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile;
+  if (__pyx_pf_9csamtools_9Fastafile___cinit__(o, a, k) < 0) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_pf_9csamtools_9Fastafile_5__dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_3tid___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_3pos___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_8genotype___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_7SNPCall_8coverage___get__(o);
+static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_9Fastafile_8filename___get__(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = {
+static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = {
+  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_1_isOpen)},
+  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_3_open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_3_open)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_4close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_4close)},
+  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_6fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_6fetch)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_9csamtools_SNPCall[] = {
-  {(char *)"tid", __pyx_getprop_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_154), 0},
-  {(char *)"pos", __pyx_getprop_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_162), 0},
-  {(char *)"reference_base", __pyx_getprop_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_163), 0},
-  {(char *)"genotype", __pyx_getprop_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_164), 0},
-  {(char *)"consensus_quality", __pyx_getprop_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_165), 0},
-  {(char *)"snp_quality", __pyx_getprop_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_166), 0},
-  {(char *)"mapping_quality", __pyx_getprop_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_167), 0},
-  {(char *)"coverage", __pyx_getprop_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_168), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_Fastafile[] = {
+  {(char *)"filename", __pyx_getprop_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_SNPCall = {
+static PyNumberMethods __pyx_tp_as_number_Fastafile = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -33940,8 +29357,8 @@ static PyNumberMethods __pyx_tp_as_number_SNPCall = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_SNPCall = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
+  __pyx_pf_9csamtools_9Fastafile_2__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
   0, /*sq_item*/
@@ -33953,13 +29370,13 @@ static PySequenceMethods __pyx_tp_as_sequence_SNPCall = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_SNPCall = {
-  0, /*mp_length*/
+static PyMappingMethods __pyx_tp_as_mapping_Fastafile = {
+  __pyx_pf_9csamtools_9Fastafile_2__len__, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_SNPCall = {
+static PyBufferProcs __pyx_tp_as_buffer_Fastafile = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -33980,12 +29397,12 @@ static PyBufferProcs __pyx_tp_as_buffer_SNPCall = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_SNPCall = {
+static PyTypeObject __pyx_type_9csamtools_Fastafile = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.SNPCall"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_SNPCall), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.Fastafile"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_Fastafile), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_SNPCall, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_Fastafile, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -33995,26 +29412,26 @@ PyTypeObject __pyx_type_9csamtools_SNPCall = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_SNPCall, /*tp_as_number*/
-  &__pyx_tp_as_sequence_SNPCall, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/
+  &__pyx_tp_as_number_Fastafile, /*tp_as_number*/
+  &__pyx_tp_as_sequence_Fastafile, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_Fastafile, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pf_9csamtools_7SNPCall___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_SNPCall, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("the results of a SNP call."), /*tp_doc*/
+  &__pyx_tp_as_buffer_Fastafile, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("*(filename)*\n              \n    A *FASTA* file. The file is automatically opened.\n\n    The file expects an indexed fasta file.\n\n    TODO: \n        add automatic indexing.\n        add function to get sequence names.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_9csamtools_SNPCall, /*tp_methods*/
+  __pyx_methods_9csamtools_Fastafile, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_9csamtools_SNPCall, /*tp_getset*/
+  __pyx_getsets_9csamtools_Fastafile, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -34022,7 +29439,7 @@ PyTypeObject __pyx_type_9csamtools_SNPCall = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_SNPCall, /*tp_new*/
+  __pyx_tp_new_9csamtools_Fastafile, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -34035,59 +29452,66 @@ PyTypeObject __pyx_type_9csamtools_SNPCall = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_SNPCallerBase __pyx_vtable_9csamtools_SNPCallerBase;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion __pyx_vtable_9csamtools_IteratorRowRegion;
 
-static PyObject *__pyx_tp_new_9csamtools_SNPCallerBase(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_SNPCallerBase *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_SNPCallerBase *)o);
-  p->__pyx_vtab = __pyx_vtabptr_9csamtools_SNPCallerBase;
-  p->iter = ((struct __pyx_obj_9csamtools_IteratorColumn *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pf_9csamtools_13SNPCallerBase___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowRegion;
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  if (__pyx_pf_9csamtools_17IteratorRowRegion___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_SNPCallerBase(PyObject *o) {
-  struct __pyx_obj_9csamtools_SNPCallerBase *p = (struct __pyx_obj_9csamtools_SNPCallerBase *)o;
+static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_13SNPCallerBase___dealloc__(o);
+    __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_XDECREF(((PyObject *)p->iter));
-  (*Py_TYPE(o)->tp_free)(o);
+  Py_XDECREF(((PyObject *)p->samfile));
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
 }
 
-static int __pyx_tp_traverse_9csamtools_SNPCallerBase(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_9csamtools_SNPCallerBase *p = (struct __pyx_obj_9csamtools_SNPCallerBase *)o;
-  if (p->iter) {
-    e = (*v)(((PyObject*)p->iter), a); if (e) return e;
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
+    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
+  }
+  if (p->samfile) {
+    e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_9csamtools_SNPCallerBase(PyObject *o) {
-  struct __pyx_obj_9csamtools_SNPCallerBase *p = (struct __pyx_obj_9csamtools_SNPCallerBase *)o;
+static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->iter);
-  p->iter = ((struct __pyx_obj_9csamtools_IteratorColumn *)Py_None); Py_INCREF(Py_None);
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
+    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
+  }
+  tmp = ((PyObject*)p->samfile);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_9csamtools_SNPCallerBase[] = {
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_17IteratorRowRegion_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion_2__next__)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_SNPCallerBase = {
+static PyNumberMethods __pyx_tp_as_number_IteratorRowRegion = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -34145,7 +29569,7 @@ static PyNumberMethods __pyx_tp_as_number_SNPCallerBase = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_SNPCallerBase = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorRowRegion = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -34158,13 +29582,13 @@ static PySequenceMethods __pyx_tp_as_sequence_SNPCallerBase = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_SNPCallerBase = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorRowRegion = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_SNPCallerBase = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorRowRegion = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -34185,12 +29609,12 @@ static PyBufferProcs __pyx_tp_as_buffer_SNPCallerBase = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_SNPCallerBase = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.SNPCallerBase"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_SNPCallerBase), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowRegion"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowRegion), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_SNPCallerBase, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowRegion, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -34200,24 +29624,24 @@ PyTypeObject __pyx_type_9csamtools_SNPCallerBase = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_SNPCallerBase, /*tp_as_number*/
-  &__pyx_tp_as_sequence_SNPCallerBase, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_SNPCallerBase, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorRowRegion, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorRowRegion, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorRowRegion, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_SNPCallerBase, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("Base class for SNP callers.\n\n    *min_baseQ*\n       minimum base quality (possibly capped by BAQ)\n    *capQ_threshold*\n       coefficient for adjusting mapQ of poor mappings\n    *theta*\n       theta in maq consensus calling model\n    *n_haplotypes*\n       number of haplotypes in the sample\n    *het_rate*\n       prior of a difference between two haplotypes\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_SNPCallerBase, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_SNPCallerBase, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorRowRegion, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("*(Samfile samfile, int tid, int beg, int end, int reopen = True )*\n\n    iterate over mapped reads in a region.\n\n    By default, the file is re-openend to avoid conflicts between\n    multiple iterators working on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n\n    The samtools iterators assume that the file\n    position between iterations do not change.\n    As a consequence, no two iterators can work\n    on the same file. To permit this, each iterator\n    creates its own file handle by re-opening the\n    file.\n\n    Note that the index will be shared between \n    samfile and the iterator.\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_IteratorRowRegion, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_SNPCallerBase, /*tp_methods*/
+  __pyx_pf_9csamtools_17IteratorRowRegion_1__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_17IteratorRowRegion_2__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorRowRegion, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -34227,7 +29651,7 @@ PyTypeObject __pyx_type_9csamtools_SNPCallerBase = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_SNPCallerBase, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowRegion, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -34240,26 +29664,64 @@ PyTypeObject __pyx_type_9csamtools_SNPCallerBase = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_IteratorSNPCalls __pyx_vtable_9csamtools_IteratorSNPCalls;
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorSNPCalls(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IteratorSNPCalls *p;
-  PyObject *o = __pyx_tp_new_9csamtools_SNPCallerBase(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IteratorSNPCalls *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_SNPCallerBase*)__pyx_vtabptr_9csamtools_IteratorSNPCalls;
-  if (__pyx_pf_9csamtools_16IteratorSNPCalls___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  if (__pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorSNPCalls[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_16IteratorSNPCalls___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_16IteratorSNPCalls___next__)},
+static void __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
+  Py_XDECREF(((PyObject *)p->samfile));
+  Py_XDECREF(((PyObject *)p->rowiter));
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
+}
+
+static int __pyx_tp_traverse_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
+    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
+  }
+  if (p->samfile) {
+    e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
+  }
+  if (p->rowiter) {
+    e = (*v)(((PyObject*)p->rowiter), a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
+  PyObject* tmp;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
+    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
+  }
+  tmp = ((PyObject*)p->samfile);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->rowiter);
+  p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = {
+  {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IteratorSNPCalls = {
+static PyNumberMethods __pyx_tp_as_number_IteratorRowAllRefs = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -34317,7 +29779,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorSNPCalls = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorSNPCalls = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAllRefs = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -34330,13 +29792,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorSNPCalls = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorSNPCalls = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAllRefs = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorSNPCalls = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -34357,12 +29819,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorSNPCalls = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorSNPCalls = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorSNPCalls"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorSNPCalls), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowAllRefs"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_SNPCallerBase, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -34372,24 +29834,24 @@ PyTypeObject __pyx_type_9csamtools_IteratorSNPCalls = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorSNPCalls, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorSNPCalls, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorSNPCalls, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorRowAllRefs, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorRowAllRefs, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorRowAllRefs, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorSNPCalls, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("*(IteratorColumn iterator)*\n\n    call SNPs within a region.\n\n    *iterator* is a pileup iterator. SNPs will be called\n    on all positions returned by this iterator.\n\n    This caller is fast if SNPs are called over large continuous\n    regions. It is slow, if instantiated frequently and in random\n    order as the sequence will have to be reloaded.\n\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_SNPCallerBase, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_SNPCallerBase, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorRowAllRefs, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("iterates over all mapped reads by chaining iterators over each reference\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_IteratorRowAllRefs, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_16IteratorSNPCalls___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_16IteratorSNPCalls___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorSNPCalls, /*tp_methods*/
+  __pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorRowAllRefs, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -34399,7 +29861,7 @@ PyTypeObject __pyx_type_9csamtools_IteratorSNPCalls = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorSNPCalls, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowAllRefs, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -34412,26 +29874,66 @@ PyTypeObject __pyx_type_9csamtools_IteratorSNPCalls = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_9csamtools_SNPCaller __pyx_vtable_9csamtools_SNPCaller;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection __pyx_vtable_9csamtools_IteratorRowSelection;
 
-static PyObject *__pyx_tp_new_9csamtools_SNPCaller(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_SNPCaller *p;
-  PyObject *o = __pyx_tp_new_9csamtools_SNPCallerBase(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_SNPCaller *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_SNPCallerBase*)__pyx_vtabptr_9csamtools_SNPCaller;
-  if (__pyx_pf_9csamtools_9SNPCaller___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorRowSelection *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowSelection;
+  p->positions = Py_None; Py_INCREF(Py_None);
+  if (__pyx_pf_9csamtools_20IteratorRowSelection___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static PyMethodDef __pyx_methods_9csamtools_SNPCaller[] = {
-  {__Pyx_NAMESTR("call"), (PyCFunction)__pyx_pf_9csamtools_9SNPCaller_call, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9SNPCaller_call)},
+static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_XDECREF(p->positions);
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
+}
+
+static int __pyx_tp_traverse_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
+    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
+  }
+  if (p->positions) {
+    e = (*v)(p->positions, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
+  PyObject* tmp;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
+    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
+  }
+  tmp = ((PyObject*)p->positions);
+  p->positions = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorRowSelection_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection_2__next__)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_SNPCaller = {
+static PyNumberMethods __pyx_tp_as_number_IteratorRowSelection = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -34489,7 +29991,7 @@ static PyNumberMethods __pyx_tp_as_number_SNPCaller = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_SNPCaller = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorRowSelection = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -34502,13 +30004,13 @@ static PySequenceMethods __pyx_tp_as_sequence_SNPCaller = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_SNPCaller = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorRowSelection = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_SNPCaller = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -34529,12 +30031,12 @@ static PyBufferProcs __pyx_tp_as_buffer_SNPCaller = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_SNPCaller = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.SNPCaller"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_SNPCaller), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowSelection"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowSelection), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_SNPCallerBase, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowSelection, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -34544,24 +30046,24 @@ PyTypeObject __pyx_type_9csamtools_SNPCaller = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_SNPCaller, /*tp_as_number*/
-  &__pyx_tp_as_sequence_SNPCaller, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_SNPCaller, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorRowSelection, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorRowSelection, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorRowSelection, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_SNPCaller, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("*(IteratorColumn iterator_column )*\n\n    The samtools SNP caller.\n\n    This object will call SNPs in *samfile* against the reference\n    sequence in *fasta*.\n\n    This caller is fast for calling few SNPs in selected regions.\n\n    It is slow, if called over large genomic regions.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_SNPCallerBase, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_SNPCallerBase, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorRowSelection, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("*(Samfile samfile)*\n\n    iterate over reads in *samfile* at a given list of file positions.\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_IteratorRowSelection, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_SNPCaller, /*tp_methods*/
+  __pyx_pf_9csamtools_20IteratorRowSelection_1__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_20IteratorRowSelection_2__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorRowSelection, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -34571,7 +30073,7 @@ PyTypeObject __pyx_type_9csamtools_SNPCaller = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_SNPCaller, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowSelection, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -34584,98 +30086,94 @@ PyTypeObject __pyx_type_9csamtools_SNPCaller = {
   0, /*tp_version_tag*/
   #endif
 };
+static struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_vtable_9csamtools_IteratorColumn;
 
-static PyObject *__pyx_tp_new_9csamtools_IndelCall(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorColumn *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  if (__pyx_pf_9csamtools_9IndelCall___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorColumn *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorColumn;
+  p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
+  p->stepper = Py_None; Py_INCREF(Py_None);
+  if (__pyx_pf_9csamtools_14IteratorColumn___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_IndelCall(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_9IndelCall___dealloc__(o);
+    __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
+  Py_XDECREF(((PyObject *)p->iter));
+  Py_XDECREF(((PyObject *)p->samfile));
+  Py_XDECREF(((PyObject *)p->fastafile));
+  Py_XDECREF(p->stepper);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_tid(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_3tid___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_pos(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_3pos___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_genotype(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_8genotype___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_consensus_quality(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_17consensus_quality___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_snp_quality(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_11snp_quality___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_mapping_quality(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_15mapping_quality___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_coverage(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_8coverage___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_first_allele(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_12first_allele___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_second_allele(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_13second_allele___get__(o);
-}
-
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_reads_first(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_11reads_first___get__(o);
+static int __pyx_tp_traverse_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
+  if (p->iter) {
+    e = (*v)(((PyObject*)p->iter), a); if (e) return e;
+  }
+  if (p->samfile) {
+    e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
+  }
+  if (p->fastafile) {
+    e = (*v)(((PyObject*)p->fastafile), a); if (e) return e;
+  }
+  if (p->stepper) {
+    e = (*v)(p->stepper, a); if (e) return e;
+  }
+  return 0;
 }
 
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_reads_second(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_12reads_second___get__(o);
+static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->iter);
+  p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->samfile);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->fastafile);
+  p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->stepper);
+  p->stepper = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
 }
 
-static PyObject *__pyx_getprop_9csamtools_9IndelCall_reads_diff(PyObject *o, void *x) {
-  return __pyx_pf_9csamtools_9IndelCall_10reads_diff___get__(o);
+static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IndelCall[] = {
+static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = {
+  {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_2addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_2addReference)},
+  {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_3hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_3hasReference)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_9csamtools_IndelCall[] = {
-  {(char *)"tid", __pyx_getprop_9csamtools_9IndelCall_tid, 0, __Pyx_DOCSTR(__pyx_k_154), 0},
-  {(char *)"pos", __pyx_getprop_9csamtools_9IndelCall_pos, 0, __Pyx_DOCSTR(__pyx_k_162), 0},
-  {(char *)"genotype", __pyx_getprop_9csamtools_9IndelCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_164), 0},
-  {(char *)"consensus_quality", __pyx_getprop_9csamtools_9IndelCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_165), 0},
-  {(char *)"snp_quality", __pyx_getprop_9csamtools_9IndelCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_166), 0},
-  {(char *)"mapping_quality", __pyx_getprop_9csamtools_9IndelCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_167), 0},
-  {(char *)"coverage", __pyx_getprop_9csamtools_9IndelCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_168), 0},
-  {(char *)"first_allele", __pyx_getprop_9csamtools_9IndelCall_first_allele, 0, __Pyx_DOCSTR(__pyx_k_169), 0},
-  {(char *)"second_allele", __pyx_getprop_9csamtools_9IndelCall_second_allele, 0, __Pyx_DOCSTR(__pyx_k_170), 0},
-  {(char *)"reads_first", __pyx_getprop_9csamtools_9IndelCall_reads_first, 0, __Pyx_DOCSTR(__pyx_k_171), 0},
-  {(char *)"reads_second", __pyx_getprop_9csamtools_9IndelCall_reads_second, 0, __Pyx_DOCSTR(__pyx_k_171), 0},
-  {(char *)"reads_diff", __pyx_getprop_9csamtools_9IndelCall_reads_diff, 0, __Pyx_DOCSTR(__pyx_k_171), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_IteratorColumn[] = {
+  {(char *)"seq_len", __pyx_getprop_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_221), 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IndelCall = {
+static PyNumberMethods __pyx_tp_as_number_IteratorColumn = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -34733,7 +30231,7 @@ static PyNumberMethods __pyx_tp_as_number_IndelCall = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IndelCall = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorColumn = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -34746,13 +30244,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IndelCall = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IndelCall = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorColumn = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IndelCall = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -34773,12 +30271,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IndelCall = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IndelCall = {
+static PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IndelCall"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IndelCall), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorColumn"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorColumn), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IndelCall, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -34788,26 +30286,26 @@ PyTypeObject __pyx_type_9csamtools_IndelCall = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IndelCall, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IndelCall, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IndelCall, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorColumn, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorColumn, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorColumn, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pf_9csamtools_9IndelCall___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IndelCall, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("the results of an indel call."), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorColumn, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("abstract base class for iterators over columns.\n\n    IteratorColumn objects wrap the pileup functionality of samtools.\n    \n    For reasons of efficiency, the iterator points to the current \n    pileup buffer. The pileup buffer is updated at every iteration.\n    This might cause some unexpected behavious. For example,\n    consider the conversion to a list::\n    \n       f = Samfile(\"file.bam\", \"rb\")\n       result = list( f.pileup() )\n\n    Here, ``result`` will contain ``n`` objects of type :class:`PileupProxy` for ``n`` columns, \n    but each object in ``result`` will contain the same information.\n    \n    The desired behaviour can be achieved by list comprehension::\n\n       result = [ x.pileups() for x in f.pileup() ]\n\n    ``result`` will be a list of ``n`` lists of objects of type :class:`PileupRead`.\n\n    If the iterator is associated with a :class:`Fastafile` using the :meth:`addReference`\n    method, then the iterator will export the current sequence via the methods :meth:`getSequence`\n    and :meth:`seq_len`.\n\n    Optional kwargs to the iterator\n\n    stepper\n       The stepper controlls how the iterator advances. \n       Possible options for the stepper are \n       \n       all\n           use all reads for pileup.\n       samtools\n           same filter and read processing as in :term:`csamtools` pileup\n    fastafile\n       A :class:`FastaFile` object\n    mask\n       Skip all reads with bits set in mask.\n    max_depth\n       maximum read depth. The default is 8000.\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
+  __pyx_pf_9csamtools_14IteratorColumn_1__iter__, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_9csamtools_IndelCall, /*tp_methods*/
+  __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_9csamtools_IndelCall, /*tp_getset*/
+  __pyx_getsets_9csamtools_IteratorColumn, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -34815,7 +30313,7 @@ PyTypeObject __pyx_type_9csamtools_IndelCall = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IndelCall, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorColumn, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -34828,58 +30326,26 @@ PyTypeObject __pyx_type_9csamtools_IndelCall = {
   0, /*tp_version_tag*/
   #endif
 };
+static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion __pyx_vtable_9csamtools_IteratorColumnRegion;
 
-static PyObject *__pyx_tp_new_9csamtools_IndelCallerBase(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_9csamtools_IndelCallerBase *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
+static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorColumnRegion *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_9csamtools_IndelCallerBase *)o);
-  p->iter = ((struct __pyx_obj_9csamtools_IteratorColumn *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pf_9csamtools_15IndelCallerBase___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o);
+  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion;
+  if (__pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_9csamtools_IndelCallerBase(PyObject *o) {
-  struct __pyx_obj_9csamtools_IndelCallerBase *p = (struct __pyx_obj_9csamtools_IndelCallerBase *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_15IndelCallerBase___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_XDECREF(((PyObject *)p->iter));
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_9csamtools_IndelCallerBase(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_obj_9csamtools_IndelCallerBase *p = (struct __pyx_obj_9csamtools_IndelCallerBase *)o;
-  if (p->iter) {
-    e = (*v)(((PyObject*)p->iter), a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_9csamtools_IndelCallerBase(PyObject *o) {
-  struct __pyx_obj_9csamtools_IndelCallerBase *p = (struct __pyx_obj_9csamtools_IndelCallerBase *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->iter);
-  p->iter = ((struct __pyx_obj_9csamtools_IteratorColumn *)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
-}
-
-static PyMethodDef __pyx_methods_9csamtools_IndelCallerBase[] = {
-  {__Pyx_NAMESTR("_call"), (PyCFunction)__pyx_pf_9csamtools_15IndelCallerBase__call, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_15IndelCallerBase__call)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion_1__next__)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IndelCallerBase = {
+static PyNumberMethods __pyx_tp_as_number_IteratorColumnRegion = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -34937,7 +30403,7 @@ static PyNumberMethods __pyx_tp_as_number_IndelCallerBase = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IndelCallerBase = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnRegion = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -34950,13 +30416,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IndelCallerBase = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IndelCallerBase = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnRegion = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IndelCallerBase = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -34977,12 +30443,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IndelCallerBase = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IndelCallerBase = {
+static PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IndelCallerBase"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IndelCallerBase), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorColumnRegion"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorColumnRegion), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IndelCallerBase, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -34992,24 +30458,24 @@ PyTypeObject __pyx_type_9csamtools_IndelCallerBase = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IndelCallerBase, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IndelCallerBase, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IndelCallerBase, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorColumnRegion, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorColumnRegion, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorColumnRegion, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IndelCallerBase, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("Base class for SNP callers.\n\n    *min_baseQ*\n       minimum base quality (possibly capped by BAQ)\n    *capQ_threshold*\n       coefficient for adjusting mapQ of poor mappings\n    *theta*\n       theta in maq consensus calling model\n    *n_haplotypes*\n       number of haplotypes in the sample\n    *het_rate*\n       prior of a difference between two haplotypes\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IndelCallerBase, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IndelCallerBase, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorColumnRegion, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("iterates over a region only.\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_IndelCallerBase, /*tp_methods*/
+  __pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -35019,7 +30485,7 @@ PyTypeObject __pyx_type_9csamtools_IndelCallerBase = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IndelCallerBase, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorColumnRegion, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -35032,22 +30498,26 @@ PyTypeObject __pyx_type_9csamtools_IndelCallerBase = {
   0, /*tp_version_tag*/
   #endif
 };
+static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs __pyx_vtable_9csamtools_IteratorColumnAllRefs;
 
-static PyObject *__pyx_tp_new_9csamtools_IndelCaller(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = __pyx_tp_new_9csamtools_IndelCallerBase(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorColumnAllRefs *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
   if (!o) return 0;
-  if (__pyx_pf_9csamtools_11IndelCaller___cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o);
+  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
+  if (__pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IndelCaller[] = {
-  {__Pyx_NAMESTR("call"), (PyCFunction)__pyx_pf_9csamtools_11IndelCaller_call, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11IndelCaller_call)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IndelCaller = {
+static PyNumberMethods __pyx_tp_as_number_IteratorColumnAllRefs = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -35105,7 +30575,7 @@ static PyNumberMethods __pyx_tp_as_number_IndelCaller = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IndelCaller = {
+static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnAllRefs = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -35118,13 +30588,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IndelCaller = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IndelCaller = {
+static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnAllRefs = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IndelCaller = {
+static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -35145,12 +30615,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IndelCaller = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IndelCaller = {
+static PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IndelCaller"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IndelCaller), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorColumnAllRefs"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IndelCallerBase, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -35160,24 +30630,24 @@ PyTypeObject __pyx_type_9csamtools_IndelCaller = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IndelCaller, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IndelCaller, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IndelCaller, /*tp_as_mapping*/
+  &__pyx_tp_as_number_IteratorColumnAllRefs, /*tp_as_number*/
+  &__pyx_tp_as_sequence_IteratorColumnAllRefs, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_IteratorColumnAllRefs, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IndelCaller, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("*(IteratorColumn iterator_column )*\n\n    The samtools SNP caller.\n\n    This object will call SNPs in *samfile* against the reference\n    sequence in *fasta*.\n\n    This caller is fast for calling few SNPs in selected regions.\n\n    It is slow, if called over large genomic regions.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IndelCallerBase, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IndelCallerBase, /*tp_clear*/
+  &__pyx_tp_as_buffer_IteratorColumnAllRefs, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("iterates over all columns by chaining iterators over each reference\n    "), /*tp_doc*/
+  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_9csamtools_IndelCaller, /*tp_methods*/
+  __pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -35187,7 +30657,7 @@ PyTypeObject __pyx_type_9csamtools_IndelCaller = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IndelCaller, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorColumnAllRefs, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -35201,21 +30671,65 @@ PyTypeObject __pyx_type_9csamtools_IndelCaller = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_9csamtools_IteratorIndelCalls(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = __pyx_tp_new_9csamtools_IndelCallerBase(t, a, k);
-  if (!o) return 0;
-  if (__pyx_pf_9csamtools_18IteratorIndelCalls___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
+static PyObject *__pyx_tp_new_9csamtools_SNPCall(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = (*t->tp_alloc)(t, 0);
+  if (!o) return 0;
+  return o;
+}
+
+static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) {
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_3tid___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_3pos___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_8genotype___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(o);
+}
+
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_8coverage___get__(o);
 }
 
-static PyMethodDef __pyx_methods_9csamtools_IteratorIndelCalls[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_18IteratorIndelCalls___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorIndelCalls___next__)},
+static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = {
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_IteratorIndelCalls = {
+static struct PyGetSetDef __pyx_getsets_9csamtools_SNPCall[] = {
+  {(char *)"tid", __pyx_getprop_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_214), 0},
+  {(char *)"pos", __pyx_getprop_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_222), 0},
+  {(char *)"reference_base", __pyx_getprop_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_223), 0},
+  {(char *)"genotype", __pyx_getprop_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_224), 0},
+  {(char *)"consensus_quality", __pyx_getprop_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_225), 0},
+  {(char *)"snp_quality", __pyx_getprop_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_226), 0},
+  {(char *)"mapping_quality", __pyx_getprop_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_227), 0},
+  {(char *)"coverage", __pyx_getprop_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_228), 0},
+  {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_SNPCall = {
   0, /*nb_add*/
   0, /*nb_subtract*/
   0, /*nb_multiply*/
@@ -35273,7 +30787,7 @@ static PyNumberMethods __pyx_tp_as_number_IteratorIndelCalls = {
   #endif
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_IteratorIndelCalls = {
+static PySequenceMethods __pyx_tp_as_sequence_SNPCall = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
@@ -35286,13 +30800,13 @@ static PySequenceMethods __pyx_tp_as_sequence_IteratorIndelCalls = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_IteratorIndelCalls = {
+static PyMappingMethods __pyx_tp_as_mapping_SNPCall = {
   0, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_IteratorIndelCalls = {
+static PyBufferProcs __pyx_tp_as_buffer_SNPCall = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -35313,12 +30827,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorIndelCalls = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IteratorIndelCalls = {
+static PyTypeObject __pyx_type_9csamtools_SNPCall = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("csamtools.IteratorIndelCalls"), /*tp_name*/
-  sizeof(struct __pyx_obj_9csamtools_IteratorIndelCalls), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.SNPCall"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_SNPCall), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_9csamtools_IndelCallerBase, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_SNPCall, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -35328,26 +30842,26 @@ PyTypeObject __pyx_type_9csamtools_IteratorIndelCalls = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_IteratorIndelCalls, /*tp_as_number*/
-  &__pyx_tp_as_sequence_IteratorIndelCalls, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_IteratorIndelCalls, /*tp_as_mapping*/
+  &__pyx_tp_as_number_SNPCall, /*tp_as_number*/
+  &__pyx_tp_as_sequence_SNPCall, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_pf_9csamtools_7SNPCall___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_IteratorIndelCalls, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("*(IteratorColumn iterator)*\n\n    call indels within a region.\n\n    *iterator* is a pileup iterator. SNPs will be called\n    on all positions returned by this iterator.\n\n    This caller is fast if SNPs are called over large continuous\n    regions. It is slow, if instantiated frequently and in random\n    order as the sequence will have to be reloaded.\n\n    "), /*tp_doc*/
-  __pyx_tp_traverse_9csamtools_IndelCallerBase, /*tp_traverse*/
-  __pyx_tp_clear_9csamtools_IndelCallerBase, /*tp_clear*/
+  &__pyx_tp_as_buffer_SNPCall, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("the results of a SNP call."), /*tp_doc*/
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_9csamtools_18IteratorIndelCalls___iter__, /*tp_iter*/
-  __pyx_pf_9csamtools_18IteratorIndelCalls___next__, /*tp_iternext*/
-  __pyx_methods_9csamtools_IteratorIndelCalls, /*tp_methods*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_9csamtools_SNPCall, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_9csamtools_SNPCall, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -35355,7 +30869,7 @@ PyTypeObject __pyx_type_9csamtools_IteratorIndelCalls = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_9csamtools_IteratorIndelCalls, /*tp_new*/
+  __pyx_tp_new_9csamtools_SNPCall, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -35385,7 +30899,7 @@ static void __pyx_tp_dealloc_9csamtools_IndexedReads(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_9csamtools_12IndexedReads___dealloc__(o);
+    __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -35420,8 +30934,8 @@ static int __pyx_tp_clear_9csamtools_IndexedReads(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IndexedReads[] = {
-  {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_build)},
-  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_find)},
+  {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_1build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_1build)},
+  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_2find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_2find)},
   {0, 0, 0, 0}
 };
 
@@ -35523,7 +31037,7 @@ static PyBufferProcs __pyx_tp_as_buffer_IndexedReads = {
   #endif
 };
 
-PyTypeObject __pyx_type_9csamtools_IndexedReads = {
+static PyTypeObject __pyx_type_9csamtools_IndexedReads = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("csamtools.IndexedReads"), /*tp_name*/
   sizeof(struct __pyx_obj_9csamtools_IndexedReads), /*tp_basicsize*/
@@ -35547,7 +31061,7 @@ PyTypeObject __pyx_type_9csamtools_IndexedReads = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_IndexedReads, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("IndexedReads(Samfile samfile, int reopen=True)\nindex a bamfile by read.\n\n    The index is kept in memory.\n\n    By default, the file is re-openend to avoid conflicts if\n    multiple operators work on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n    "), /*tp_doc*/
   __pyx_tp_traverse_9csamtools_IndexedReads, /*tp_traverse*/
   __pyx_tp_clear_9csamtools_IndexedReads, /*tp_clear*/
@@ -35580,7 +31094,6 @@ PyTypeObject __pyx_type_9csamtools_IndexedReads = {
 };
 
 static PyMethodDef __pyx_methods[] = {
-  {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pf_9csamtools__samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)},
   {0, 0, 0, 0}
 };
 
@@ -35600,159 +31113,113 @@ static struct PyModuleDef __pyx_moduledef = {
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
-  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
   {&__pyx_kp_s_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 0, 1, 0},
   {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0},
-  {&__pyx_kp_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 0},
-  {&__pyx_n_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 1},
-  {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0},
-  {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0},
-  {&__pyx_kp_s_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 0, 1, 0},
-  {&__pyx_kp_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 0},
-  {&__pyx_kp_s_109, __pyx_k_109, sizeof(__pyx_k_109), 0, 0, 1, 0},
+  {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0},
+  {&__pyx_kp_s_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 0, 1, 0},
   {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
-  {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0},
-  {&__pyx_kp_s_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 0, 1, 0},
   {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0},
   {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0},
+  {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0},
+  {&__pyx_kp_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 0},
   {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
+  {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0},
+  {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0},
+  {&__pyx_n_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 1},
+  {&__pyx_kp_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 0},
+  {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0},
+  {&__pyx_kp_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 0},
+  {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0},
+  {&__pyx_kp_s_127, __pyx_k_127, sizeof(__pyx_k_127), 0, 0, 1, 0},
+  {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0},
+  {&__pyx_kp_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 0},
+  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
+  {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0},
+  {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0},
+  {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0},
+  {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0},
+  {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0},
+  {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0},
+  {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0},
+  {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0},
+  {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0},
+  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
+  {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0},
+  {&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0},
+  {&__pyx_kp_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 0},
+  {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0},
+  {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0},
+  {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0},
+  {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0},
+  {&__pyx_kp_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 0},
+  {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
+  {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0},
   {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
-  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
-  {&__pyx_kp_s_173, __pyx_k_173, sizeof(__pyx_k_173), 0, 0, 1, 0},
-  {&__pyx_kp_s_174, __pyx_k_174, sizeof(__pyx_k_174), 0, 0, 1, 0},
-  {&__pyx_kp_s_175, __pyx_k_175, sizeof(__pyx_k_175), 0, 0, 1, 0},
-  {&__pyx_kp_s_176, __pyx_k_176, sizeof(__pyx_k_176), 0, 0, 1, 0},
-  {&__pyx_kp_u_177, __pyx_k_177, sizeof(__pyx_k_177), 0, 1, 0, 0},
-  {&__pyx_kp_u_178, __pyx_k_178, sizeof(__pyx_k_178), 0, 1, 0, 0},
-  {&__pyx_kp_u_179, __pyx_k_179, sizeof(__pyx_k_179), 0, 1, 0, 0},
-  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
-  {&__pyx_kp_u_180, __pyx_k_180, sizeof(__pyx_k_180), 0, 1, 0, 0},
-  {&__pyx_kp_u_181, __pyx_k_181, sizeof(__pyx_k_181), 0, 1, 0, 0},
-  {&__pyx_kp_u_182, __pyx_k_182, sizeof(__pyx_k_182), 0, 1, 0, 0},
-  {&__pyx_kp_u_183, __pyx_k_183, sizeof(__pyx_k_183), 0, 1, 0, 0},
-  {&__pyx_kp_u_184, __pyx_k_184, sizeof(__pyx_k_184), 0, 1, 0, 0},
-  {&__pyx_kp_u_185, __pyx_k_185, sizeof(__pyx_k_185), 0, 1, 0, 0},
-  {&__pyx_kp_u_186, __pyx_k_186, sizeof(__pyx_k_186), 0, 1, 0, 0},
-  {&__pyx_kp_u_187, __pyx_k_187, sizeof(__pyx_k_187), 0, 1, 0, 0},
-  {&__pyx_kp_u_188, __pyx_k_188, sizeof(__pyx_k_188), 0, 1, 0, 0},
-  {&__pyx_kp_u_189, __pyx_k_189, sizeof(__pyx_k_189), 0, 1, 0, 0},
-  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
-  {&__pyx_kp_u_190, __pyx_k_190, sizeof(__pyx_k_190), 0, 1, 0, 0},
-  {&__pyx_kp_u_191, __pyx_k_191, sizeof(__pyx_k_191), 0, 1, 0, 0},
-  {&__pyx_kp_u_192, __pyx_k_192, sizeof(__pyx_k_192), 0, 1, 0, 0},
-  {&__pyx_kp_u_193, __pyx_k_193, sizeof(__pyx_k_193), 0, 1, 0, 0},
-  {&__pyx_kp_u_194, __pyx_k_194, sizeof(__pyx_k_194), 0, 1, 0, 0},
-  {&__pyx_kp_u_195, __pyx_k_195, sizeof(__pyx_k_195), 0, 1, 0, 0},
-  {&__pyx_kp_u_196, __pyx_k_196, sizeof(__pyx_k_196), 0, 1, 0, 0},
-  {&__pyx_kp_u_197, __pyx_k_197, sizeof(__pyx_k_197), 0, 1, 0, 0},
-  {&__pyx_kp_u_198, __pyx_k_198, sizeof(__pyx_k_198), 0, 1, 0, 0},
-  {&__pyx_kp_u_199, __pyx_k_199, sizeof(__pyx_k_199), 0, 1, 0, 0},
+  {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0},
+  {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0},
+  {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0},
+  {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0},
+  {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
+  {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0},
+  {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
+  {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0},
+  {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0},
+  {&__pyx_kp_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 0},
+  {&__pyx_kp_s_164, __pyx_k_164, sizeof(__pyx_k_164), 0, 0, 1, 0},
+  {&__pyx_n_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 1},
+  {&__pyx_kp_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 0},
+  {&__pyx_kp_s_168, __pyx_k_168, sizeof(__pyx_k_168), 0, 0, 1, 0},
+  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
   {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
-  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
-  {&__pyx_n_s_200, __pyx_k_200, sizeof(__pyx_k_200), 0, 0, 1, 1},
-  {&__pyx_kp_u_201, __pyx_k_201, sizeof(__pyx_k_201), 0, 1, 0, 0},
-  {&__pyx_kp_u_202, __pyx_k_202, sizeof(__pyx_k_202), 0, 1, 0, 0},
-  {&__pyx_kp_u_203, __pyx_k_203, sizeof(__pyx_k_203), 0, 1, 0, 0},
-  {&__pyx_n_s_204, __pyx_k_204, sizeof(__pyx_k_204), 0, 0, 1, 1},
-  {&__pyx_kp_u_205, __pyx_k_205, sizeof(__pyx_k_205), 0, 1, 0, 0},
-  {&__pyx_n_s_206, __pyx_k_206, sizeof(__pyx_k_206), 0, 0, 1, 1},
-  {&__pyx_kp_u_207, __pyx_k_207, sizeof(__pyx_k_207), 0, 1, 0, 0},
-  {&__pyx_kp_u_208, __pyx_k_208, sizeof(__pyx_k_208), 0, 1, 0, 0},
-  {&__pyx_kp_u_209, __pyx_k_209, sizeof(__pyx_k_209), 0, 1, 0, 0},
   {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
-  {&__pyx_kp_u_210, __pyx_k_210, sizeof(__pyx_k_210), 0, 1, 0, 0},
-  {&__pyx_kp_u_211, __pyx_k_211, sizeof(__pyx_k_211), 0, 1, 0, 0},
-  {&__pyx_kp_u_212, __pyx_k_212, sizeof(__pyx_k_212), 0, 1, 0, 0},
-  {&__pyx_kp_u_213, __pyx_k_213, sizeof(__pyx_k_213), 0, 1, 0, 0},
-  {&__pyx_kp_u_214, __pyx_k_214, sizeof(__pyx_k_214), 0, 1, 0, 0},
-  {&__pyx_kp_u_215, __pyx_k_215, sizeof(__pyx_k_215), 0, 1, 0, 0},
-  {&__pyx_kp_u_216, __pyx_k_216, sizeof(__pyx_k_216), 0, 1, 0, 0},
-  {&__pyx_kp_u_217, __pyx_k_217, sizeof(__pyx_k_217), 0, 1, 0, 0},
-  {&__pyx_kp_u_218, __pyx_k_218, sizeof(__pyx_k_218), 0, 1, 0, 0},
-  {&__pyx_kp_u_219, __pyx_k_219, sizeof(__pyx_k_219), 0, 1, 0, 0},
   {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
-  {&__pyx_kp_u_220, __pyx_k_220, sizeof(__pyx_k_220), 0, 1, 0, 0},
   {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
+  {&__pyx_kp_s_230, __pyx_k_230, sizeof(__pyx_k_230), 0, 0, 1, 0},
+  {&__pyx_kp_s_231, __pyx_k_231, sizeof(__pyx_k_231), 0, 0, 1, 0},
+  {&__pyx_kp_s_232, __pyx_k_232, sizeof(__pyx_k_232), 0, 0, 1, 0},
+  {&__pyx_kp_s_238, __pyx_k_238, sizeof(__pyx_k_238), 0, 0, 1, 0},
   {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
   {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
   {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
   {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
   {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
   {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
-  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
   {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
-  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
   {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
-  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
   {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
   {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
-  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
   {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
-  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
   {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
-  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
-  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
-  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
-  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
-  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
   {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
-  {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
   {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
-  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
   {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
   {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
-  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
   {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
-  {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
   {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
-  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
   {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
-  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
+  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
   {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
   {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
-  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
-  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
-  {&__pyx_n_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 1},
-  {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
+  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
   {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
-  {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
-  {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0},
   {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
-  {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0},
-  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
-  {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0},
   {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
-  {&__pyx_kp_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 0},
-  {&__pyx_kp_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 0},
   {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
-  {&__pyx_kp_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 0},
-  {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0},
-  {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0},
-  {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
-  {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0},
-  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
-  {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0},
   {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
-  {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
-  {&__pyx_kp_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 0},
   {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
-  {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0},
-  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
-  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
-  {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0},
   {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0},
   {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
-  {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0},
   {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0},
-  {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0},
   {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0},
   {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0},
-  {&__pyx_kp_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 0},
   {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0},
   {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0},
+  {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0},
+  {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0},
   {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1},
   {&__pyx_n_s__AS, __pyx_k__AS, sizeof(__pyx_k__AS), 0, 0, 1, 1},
   {&__pyx_n_s__AlignedRead, __pyx_k__AlignedRead, sizeof(__pyx_k__AlignedRead), 0, 0, 1, 1},
+  {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
   {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
   {&__pyx_n_s__CL, __pyx_k__CL, sizeof(__pyx_k__CL), 0, 0, 1, 1},
   {&__pyx_n_s__CN, __pyx_k__CN, sizeof(__pyx_k__CN), 0, 0, 1, 1},
@@ -35769,21 +31236,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__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__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
-  {&__pyx_n_s__IndelCaller, __pyx_k__IndelCaller, sizeof(__pyx_k__IndelCaller), 0, 0, 1, 1},
   {&__pyx_n_s__IndexedReads, __pyx_k__IndexedReads, sizeof(__pyx_k__IndexedReads), 0, 0, 1, 1},
   {&__pyx_n_s__IntType, __pyx_k__IntType, sizeof(__pyx_k__IntType), 0, 0, 1, 1},
   {&__pyx_n_s__IteratorColumn, __pyx_k__IteratorColumn, sizeof(__pyx_k__IteratorColumn), 0, 0, 1, 1},
-  {&__pyx_n_s__IteratorIndelCalls, __pyx_k__IteratorIndelCalls, sizeof(__pyx_k__IteratorIndelCalls), 0, 0, 1, 1},
   {&__pyx_n_s__IteratorRow, __pyx_k__IteratorRow, sizeof(__pyx_k__IteratorRow), 0, 0, 1, 1},
-  {&__pyx_n_s__IteratorRowAll, __pyx_k__IteratorRowAll, sizeof(__pyx_k__IteratorRowAll), 0, 0, 1, 1},
-  {&__pyx_n_s__IteratorRowAllRefs, __pyx_k__IteratorRowAllRefs, sizeof(__pyx_k__IteratorRowAllRefs), 0, 0, 1, 1},
-  {&__pyx_n_s__IteratorRowRegion, __pyx_k__IteratorRowRegion, sizeof(__pyx_k__IteratorRowRegion), 0, 0, 1, 1},
-  {&__pyx_n_s__IteratorSNPCalls, __pyx_k__IteratorSNPCalls, sizeof(__pyx_k__IteratorSNPCalls), 0, 0, 1, 1},
   {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
   {&__pyx_n_s__LB, __pyx_k__LB, sizeof(__pyx_k__LB), 0, 0, 1, 1},
   {&__pyx_n_s__LN, __pyx_k__LN, sizeof(__pyx_k__LN), 0, 0, 1, 1},
   {&__pyx_n_s__M5, __pyx_k__M5, sizeof(__pyx_k__M5), 0, 0, 1, 1},
   {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
+  {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1},
   {&__pyx_n_s__O_CREAT, __pyx_k__O_CREAT, sizeof(__pyx_k__O_CREAT), 0, 0, 1, 1},
   {&__pyx_n_s__O_WRONLY, __pyx_k__O_WRONLY, sizeof(__pyx_k__O_WRONLY), 0, 0, 1, 1},
   {&__pyx_n_s__Outs, __pyx_k__Outs, sizeof(__pyx_k__Outs), 0, 0, 1, 1},
@@ -35800,7 +31262,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1},
   {&__pyx_n_s__SM, __pyx_k__SM, sizeof(__pyx_k__SM), 0, 0, 1, 1},
   {&__pyx_n_s__SN, __pyx_k__SN, sizeof(__pyx_k__SN), 0, 0, 1, 1},
-  {&__pyx_n_s__SNPCaller, __pyx_k__SNPCaller, sizeof(__pyx_k__SNPCaller), 0, 0, 1, 1},
   {&__pyx_n_s__SO, __pyx_k__SO, sizeof(__pyx_k__SO), 0, 0, 1, 1},
   {&__pyx_n_s__SP, __pyx_k__SP, sizeof(__pyx_k__SP), 0, 0, 1, 1},
   {&__pyx_n_s__SQ, __pyx_k__SQ, sizeof(__pyx_k__SQ), 0, 0, 1, 1},
@@ -35824,13 +31285,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s____getattribute__, __pyx_k____getattribute__, sizeof(__pyx_k____getattribute__), 0, 0, 1, 1},
   {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
-  {&__pyx_n_s____next__, __pyx_k____next__, sizeof(__pyx_k____next__), 0, 0, 1, 1},
   {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s___alignment, __pyx_k___alignment, sizeof(__pyx_k___alignment), 0, 0, 1, 1},
   {&__pyx_n_s___buildHeader, __pyx_k___buildHeader, sizeof(__pyx_k___buildHeader), 0, 0, 1, 1},
   {&__pyx_n_s___buildLine, __pyx_k___buildLine, sizeof(__pyx_k___buildLine), 0, 0, 1, 1},
-  {&__pyx_n_s___call, __pyx_k___call, sizeof(__pyx_k___call), 0, 0, 1, 1},
   {&__pyx_n_s___consensus_quality, __pyx_k___consensus_quality, sizeof(__pyx_k___consensus_quality), 0, 0, 1, 1},
   {&__pyx_n_s___coverage, __pyx_k___coverage, sizeof(__pyx_k___coverage), 0, 0, 1, 1},
   {&__pyx_n_s___delegate, __pyx_k___delegate, sizeof(__pyx_k___delegate), 0, 0, 1, 1},
@@ -35848,26 +31307,23 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
   {&__pyx_n_s___pos, __pyx_k___pos, sizeof(__pyx_k___pos), 0, 0, 1, 1},
   {&__pyx_n_s___qpos, __pyx_k___qpos, sizeof(__pyx_k___qpos), 0, 0, 1, 1},
-  {&__pyx_n_s___r, __pyx_k___r, sizeof(__pyx_k___r), 0, 0, 1, 1},
   {&__pyx_n_s___reference_base, __pyx_k___reference_base, sizeof(__pyx_k___reference_base), 0, 0, 1, 1},
   {&__pyx_n_s___samtools_dispatch, __pyx_k___samtools_dispatch, sizeof(__pyx_k___samtools_dispatch), 0, 0, 1, 1},
   {&__pyx_n_s___snp_quality, __pyx_k___snp_quality, sizeof(__pyx_k___snp_quality), 0, 0, 1, 1},
   {&__pyx_n_s___tid, __pyx_k___tid, sizeof(__pyx_k___tid), 0, 0, 1, 1},
-  {&__pyx_n_s__addReference, __pyx_k__addReference, sizeof(__pyx_k__addReference), 0, 0, 1, 1},
+  {&__pyx_n_s__add_sq_text, __pyx_k__add_sq_text, sizeof(__pyx_k__add_sq_text), 0, 0, 1, 1},
   {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1},
   {&__pyx_n_s__all, __pyx_k__all, sizeof(__pyx_k__all), 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__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
   {&__pyx_n_s__bam, __pyx_k__bam, sizeof(__pyx_k__bam), 0, 0, 1, 1},
   {&__pyx_n_s__beg, __pyx_k__beg, sizeof(__pyx_k__beg), 0, 0, 1, 1},
   {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1},
   {&__pyx_n_s__bqual, __pyx_k__bqual, sizeof(__pyx_k__bqual), 0, 0, 1, 1},
-  {&__pyx_n_s__build, __pyx_k__build, sizeof(__pyx_k__build), 0, 0, 1, 1},
   {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
   {&__pyx_n_s__calcsize, __pyx_k__calcsize, sizeof(__pyx_k__calcsize), 0, 0, 1, 1},
-  {&__pyx_n_s__call, __pyx_k__call, sizeof(__pyx_k__call), 0, 0, 1, 1},
   {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1},
-  {&__pyx_n_s__cap_mapQ, __pyx_k__cap_mapQ, sizeof(__pyx_k__cap_mapQ), 0, 0, 1, 1},
   {&__pyx_n_s__catch_stderr, __pyx_k__catch_stderr, sizeof(__pyx_k__catch_stderr), 0, 0, 1, 1},
   {&__pyx_n_s__catch_stdout, __pyx_k__catch_stdout, sizeof(__pyx_k__catch_stdout), 0, 0, 1, 1},
   {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1},
@@ -35875,15 +31331,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
   {&__pyx_n_s__cmp, __pyx_k__cmp, sizeof(__pyx_k__cmp), 0, 0, 1, 1},
   {&__pyx_n_s__cnext, __pyx_k__cnext, sizeof(__pyx_k__cnext), 0, 0, 1, 1},
-  {&__pyx_n_s__cnt1, __pyx_k__cnt1, sizeof(__pyx_k__cnt1), 0, 0, 1, 1},
-  {&__pyx_n_s__cnt2, __pyx_k__cnt2, sizeof(__pyx_k__cnt2), 0, 0, 1, 1},
-  {&__pyx_n_s__cnt_anti, __pyx_k__cnt_anti, sizeof(__pyx_k__cnt_anti), 0, 0, 1, 1},
   {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
-  {&__pyx_n_s__compare, __pyx_k__compare, sizeof(__pyx_k__compare), 0, 0, 1, 1},
   {&__pyx_n_s__consensus_quality, __pyx_k__consensus_quality, sizeof(__pyx_k__consensus_quality), 0, 0, 1, 1},
   {&__pyx_n_s__core, __pyx_k__core, sizeof(__pyx_k__core), 0, 0, 1, 1},
-  {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1},
   {&__pyx_n_s__coverage, __pyx_k__coverage, sizeof(__pyx_k__coverage), 0, 0, 1, 1},
+  {&__pyx_n_s__csamtools, __pyx_k__csamtools, sizeof(__pyx_k__csamtools), 0, 0, 1, 1},
   {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
   {&__pyx_n_s__current_pos, __pyx_k__current_pos, sizeof(__pyx_k__current_pos), 0, 0, 1, 1},
   {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
@@ -35894,35 +31346,25 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__dup, __pyx_k__dup, sizeof(__pyx_k__dup), 0, 0, 1, 1},
   {&__pyx_n_s__dup2, __pyx_k__dup2, sizeof(__pyx_k__dup2), 0, 0, 1, 1},
   {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
-  {&__pyx_n_s__errmod, __pyx_k__errmod, sizeof(__pyx_k__errmod), 0, 0, 1, 1},
   {&__pyx_n_s__exc_type, __pyx_k__exc_type, sizeof(__pyx_k__exc_type), 0, 0, 1, 1},
   {&__pyx_n_s__exc_value, __pyx_k__exc_value, sizeof(__pyx_k__exc_value), 0, 0, 1, 1},
   {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
   {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
-  {&__pyx_n_s__fancy_str, __pyx_k__fancy_str, sizeof(__pyx_k__fancy_str), 0, 0, 1, 1},
   {&__pyx_n_s__fastafile, __pyx_k__fastafile, sizeof(__pyx_k__fastafile), 0, 0, 1, 1},
   {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
-  {&__pyx_n_s__fetch, __pyx_k__fetch, sizeof(__pyx_k__fetch), 0, 0, 1, 1},
   {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
   {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
   {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1},
-  {&__pyx_n_s__first_allele, __pyx_k__first_allele, sizeof(__pyx_k__first_allele), 0, 0, 1, 1},
   {&__pyx_n_s__flag, __pyx_k__flag, sizeof(__pyx_k__flag), 0, 0, 1, 1},
   {&__pyx_n_s__flush, __pyx_k__flush, sizeof(__pyx_k__flush), 0, 0, 1, 1},
   {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1},
   {&__pyx_n_s__genotype, __pyx_k__genotype, sizeof(__pyx_k__genotype), 0, 0, 1, 1},
-  {&__pyx_n_s__getSequence, __pyx_k__getSequence, sizeof(__pyx_k__getSequence), 0, 0, 1, 1},
-  {&__pyx_n_s__getrname, __pyx_k__getrname, sizeof(__pyx_k__getrname), 0, 0, 1, 1},
   {&__pyx_n_s__gettid, __pyx_k__gettid, sizeof(__pyx_k__gettid), 0, 0, 1, 1},
-  {&__pyx_n_s__hasReference, __pyx_k__hasReference, sizeof(__pyx_k__hasReference), 0, 0, 1, 1},
   {&__pyx_n_s__hash, __pyx_k__hash, sizeof(__pyx_k__hash), 0, 0, 1, 1},
   {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1},
-  {&__pyx_n_s__het_rate, __pyx_k__het_rate, sizeof(__pyx_k__het_rate), 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__indel, __pyx_k__indel, sizeof(__pyx_k__indel), 0, 0, 1, 1},
-  {&__pyx_n_s__indel1, __pyx_k__indel1, sizeof(__pyx_k__indel1), 0, 0, 1, 1},
-  {&__pyx_n_s__indel2, __pyx_k__indel2, sizeof(__pyx_k__indel2), 0, 0, 1, 1},
   {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
   {&__pyx_n_s__is_del, __pyx_k__is_del, sizeof(__pyx_k__is_del), 0, 0, 1, 1},
   {&__pyx_n_s__is_head, __pyx_k__is_head, sizeof(__pyx_k__is_head), 0, 0, 1, 1},
@@ -35930,9 +31372,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__isbam, __pyx_k__isbam, sizeof(__pyx_k__isbam), 0, 0, 1, 1},
   {&__pyx_n_s__isize, __pyx_k__isize, sizeof(__pyx_k__isize), 0, 0, 1, 1},
   {&__pyx_n_s__isremote, __pyx_k__isremote, sizeof(__pyx_k__isremote), 0, 0, 1, 1},
+  {&__pyx_n_s__isstream, __pyx_k__isstream, sizeof(__pyx_k__isstream), 0, 0, 1, 1},
   {&__pyx_n_s__isupper, __pyx_k__isupper, sizeof(__pyx_k__isupper), 0, 0, 1, 1},
   {&__pyx_n_s__iter, __pyx_k__iter, sizeof(__pyx_k__iter), 0, 0, 1, 1},
-  {&__pyx_n_s__iterator_column, __pyx_k__iterator_column, sizeof(__pyx_k__iterator_column), 0, 0, 1, 1},
   {&__pyx_n_s__iterdata, __pyx_k__iterdata, sizeof(__pyx_k__iterdata), 0, 0, 1, 1},
   {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
   {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
@@ -35949,7 +31391,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__mate, __pyx_k__mate, sizeof(__pyx_k__mate), 0, 0, 1, 1},
   {&__pyx_n_s__max_depth, __pyx_k__max_depth, sizeof(__pyx_k__max_depth), 0, 0, 1, 1},
   {&__pyx_n_s__method, __pyx_k__method, sizeof(__pyx_k__method), 0, 0, 1, 1},
-  {&__pyx_n_s__min_baseQ, __pyx_k__min_baseQ, sizeof(__pyx_k__min_baseQ), 0, 0, 1, 1},
   {&__pyx_n_s__mkstemp, __pyx_k__mkstemp, sizeof(__pyx_k__mkstemp), 0, 0, 1, 1},
   {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
   {&__pyx_n_s__mpos, __pyx_k__mpos, sizeof(__pyx_k__mpos), 0, 0, 1, 1},
@@ -35957,8 +31398,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__mtid, __pyx_k__mtid, sizeof(__pyx_k__mtid), 0, 0, 1, 1},
   {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
   {&__pyx_n_s__n_cigar, __pyx_k__n_cigar, sizeof(__pyx_k__n_cigar), 0, 0, 1, 1},
-  {&__pyx_n_s__n_hap, __pyx_k__n_hap, sizeof(__pyx_k__n_hap), 0, 0, 1, 1},
-  {&__pyx_n_s__n_haplotypes, __pyx_k__n_haplotypes, sizeof(__pyx_k__n_haplotypes), 0, 0, 1, 1},
   {&__pyx_n_s__n_plp, __pyx_k__n_plp, sizeof(__pyx_k__n_plp), 0, 0, 1, 1},
   {&__pyx_n_s__n_pu, __pyx_k__n_pu, sizeof(__pyx_k__n_pu), 0, 0, 1, 1},
   {&__pyx_n_s__n_targets, __pyx_k__n_targets, sizeof(__pyx_k__n_targets), 0, 0, 1, 1},
@@ -35968,14 +31407,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
   {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
   {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
-  {&__pyx_n_s__opt, __pyx_k__opt, sizeof(__pyx_k__opt), 0, 0, 1, 1},
-  {&__pyx_n_s__options, __pyx_k__options, sizeof(__pyx_k__options), 0, 0, 1, 1},
   {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
-  {&__pyx_n_s__overlap, __pyx_k__overlap, sizeof(__pyx_k__overlap), 0, 0, 1, 1},
   {&__pyx_n_s__owns_samfile, __pyx_k__owns_samfile, sizeof(__pyx_k__owns_samfile), 0, 0, 1, 1},
   {&__pyx_n_s__pack_into, __pyx_k__pack_into, sizeof(__pyx_k__pack_into), 0, 0, 1, 1},
   {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
-  {&__pyx_n_s__pileup, __pyx_k__pileup, sizeof(__pyx_k__pileup), 0, 0, 1, 1},
   {&__pyx_n_s__pileup_iter, __pyx_k__pileup_iter, sizeof(__pyx_k__pileup_iter), 0, 0, 1, 1},
   {&__pyx_n_s__pileups, __pyx_k__pileups, sizeof(__pyx_k__pileups), 0, 0, 1, 1},
   {&__pyx_n_s__platform, __pyx_k__platform, sizeof(__pyx_k__platform), 0, 0, 1, 1},
@@ -35983,25 +31418,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1},
   {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
   {&__pyx_n_s__positions, __pyx_k__positions, sizeof(__pyx_k__positions), 0, 0, 1, 1},
-  {&__pyx_n_s__q_cns, __pyx_k__q_cns, sizeof(__pyx_k__q_cns), 0, 0, 1, 1},
-  {&__pyx_n_s__q_indel, __pyx_k__q_indel, sizeof(__pyx_k__q_indel), 0, 0, 1, 1},
-  {&__pyx_n_s__q_r, __pyx_k__q_r, sizeof(__pyx_k__q_r), 0, 0, 1, 1},
-  {&__pyx_n_s__q_ref, __pyx_k__q_ref, sizeof(__pyx_k__q_ref), 0, 0, 1, 1},
   {&__pyx_n_s__qname, __pyx_k__qname, sizeof(__pyx_k__qname), 0, 0, 1, 1},
   {&__pyx_n_s__qpos, __pyx_k__qpos, sizeof(__pyx_k__qpos), 0, 0, 1, 1},
   {&__pyx_n_s__qseq, __pyx_k__qseq, sizeof(__pyx_k__qseq), 0, 0, 1, 1},
   {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1},
   {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
-  {&__pyx_n_s__r_indel, __pyx_k__r_indel, sizeof(__pyx_k__r_indel), 0, 0, 1, 1},
-  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
+  {&__pyx_n_s__rU, __pyx_k__rU, sizeof(__pyx_k__rU), 0, 0, 1, 1},
   {&__pyx_n_s__raw, __pyx_k__raw, sizeof(__pyx_k__raw), 0, 0, 1, 1},
   {&__pyx_n_s__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 1, 1},
   {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1},
   {&__pyx_n_s__readAndRelease, __pyx_k__readAndRelease, sizeof(__pyx_k__readAndRelease), 0, 0, 1, 1},
   {&__pyx_n_s__readlines, __pyx_k__readlines, sizeof(__pyx_k__readlines), 0, 0, 1, 1},
-  {&__pyx_n_s__reads_diff, __pyx_k__reads_diff, sizeof(__pyx_k__reads_diff), 0, 0, 1, 1},
-  {&__pyx_n_s__reads_first, __pyx_k__reads_first, sizeof(__pyx_k__reads_first), 0, 0, 1, 1},
-  {&__pyx_n_s__reads_second, __pyx_k__reads_second, sizeof(__pyx_k__reads_second), 0, 0, 1, 1},
   {&__pyx_n_s__record, __pyx_k__record, sizeof(__pyx_k__record), 0, 0, 1, 1},
   {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1},
   {&__pyx_n_s__reference_base, __pyx_k__reference_base, sizeof(__pyx_k__reference_base), 0, 0, 1, 1},
@@ -36011,7 +31438,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__release, __pyx_k__release, sizeof(__pyx_k__release), 0, 0, 1, 1},
   {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
   {&__pyx_n_s__reopen, __pyx_k__reopen, sizeof(__pyx_k__reopen), 0, 0, 1, 1},
-  {&__pyx_n_s__reset, __pyx_k__reset, sizeof(__pyx_k__reset), 0, 0, 1, 1},
   {&__pyx_n_s__restore, __pyx_k__restore, sizeof(__pyx_k__restore), 0, 0, 1, 1},
   {&__pyx_n_s__retval, __pyx_k__retval, sizeof(__pyx_k__retval), 0, 0, 1, 1},
   {&__pyx_n_s__rg2lib, __pyx_k__rg2lib, sizeof(__pyx_k__rg2lib), 0, 0, 1, 1},
@@ -36021,7 +31447,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
   {&__pyx_n_s__samfile, __pyx_k__samfile, sizeof(__pyx_k__samfile), 0, 0, 1, 1},
   {&__pyx_n_s__samtools, __pyx_k__samtools, sizeof(__pyx_k__samtools), 0, 0, 1, 1},
-  {&__pyx_n_s__second_allele, __pyx_k__second_allele, sizeof(__pyx_k__second_allele), 0, 0, 1, 1},
   {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1},
   {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
   {&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1},
@@ -36033,6 +31458,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__snp_quality, __pyx_k__snp_quality, sizeof(__pyx_k__snp_quality), 0, 0, 1, 1},
   {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
   {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
+  {&__pyx_n_s__start_offset, __pyx_k__start_offset, sizeof(__pyx_k__start_offset), 0, 0, 1, 1},
   {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
   {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1},
   {&__pyx_n_s__stderr_f, __pyx_k__stderr_f, sizeof(__pyx_k__stderr_f), 0, 0, 1, 1},
@@ -36048,11 +31474,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__tags, __pyx_k__tags, sizeof(__pyx_k__tags), 0, 0, 1, 1},
   {&__pyx_n_s__target_len, __pyx_k__target_len, sizeof(__pyx_k__target_len), 0, 0, 1, 1},
   {&__pyx_n_s__target_name, __pyx_k__target_name, sizeof(__pyx_k__target_name), 0, 0, 1, 1},
-  {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1},
   {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1},
   {&__pyx_n_s__template, __pyx_k__template, sizeof(__pyx_k__template), 0, 0, 1, 1},
   {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1},
-  {&__pyx_n_s__theta, __pyx_k__theta, sizeof(__pyx_k__theta), 0, 0, 1, 1},
   {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
   {&__pyx_n_s__traceback, __pyx_k__traceback, sizeof(__pyx_k__traceback), 0, 0, 1, 1},
   {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1},
@@ -36072,1642 +31496,2026 @@ static int __Pyx_InitCachedBuiltins(void) {
   __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_cmp = __Pyx_GetName(__pyx_b, __pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
-
-static int __Pyx_InitGlobals(void) {
-  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_60 = PyInt_FromLong(60); if (unlikely(!__pyx_int_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_neg_127 = PyInt_FromLong(-127); if (unlikely(!__pyx_int_neg_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_0660 = PyInt_FromLong(0660); if (unlikely(!__pyx_int_0660)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_65535 = PyInt_FromLong(65535); if (unlikely(!__pyx_int_65535)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_neg_32767 = PyInt_FromLong(-32767); if (unlikely(!__pyx_int_neg_32767)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_536870912 = PyInt_FromLong(536870912); if (unlikely(!__pyx_int_536870912)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_neg_2147483648 = PyInt_FromLong(-2147483648); if (unlikely(!__pyx_int_neg_2147483648)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
-
-#if PY_MAJOR_VERSION < 3
-PyMODINIT_FUNC initcsamtools(void); /*proto*/
-PyMODINIT_FUNC initcsamtools(void)
-#else
-PyMODINIT_FUNC PyInit_csamtools(void); /*proto*/
-PyMODINIT_FUNC PyInit_csamtools(void)
-#endif
-{
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
-  #if CYTHON_REFNANNY
-  void* __pyx_refnanny = NULL;
-  __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");
-  }
-  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_csamtools(void)", __LINE__, __FILE__);
-  #endif
-  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #ifdef __pyx_binding_PyCFunctionType_USED
-  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #endif
-  /*--- Library function declarations ---*/
-  /*--- Threads initialization code ---*/
-  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
-  #ifdef WITH_THREAD /* Python build with threading support? */
-  PyEval_InitThreads();
-  #endif
-  #endif
-  /*--- Module creation code ---*/
-  #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
-  #else
-  __pyx_m = PyModule_Create(&__pyx_moduledef);
-  #endif
-  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  #if PY_MAJOR_VERSION < 3
-  Py_INCREF(__pyx_m);
-  #endif
-  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
-  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  /*--- Initialize various global constants etc. ---*/
-  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_module_is_main_csamtools) {
-    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  }
-  /*--- Builtin init code ---*/
-  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  /*--- Global init code ---*/
-  /*--- Function export code ---*/
-  /*--- Type init code ---*/
-  __pyx_ptype_9csamtools_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject), 0); if (unlikely(!__pyx_ptype_9csamtools_file)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyType_Ready(&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_11AlignedRead___str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_11AlignedRead___str__.doc = __pyx_doc_9csamtools_11AlignedRead___str__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead___str__;
-    }
-  }
-  if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_AlignedRead = &__pyx_type_9csamtools_AlignedRead;
-  __pyx_vtabptr_9csamtools_Samfile = &__pyx_vtable_9csamtools_Samfile;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_9csamtools_Samfile *, PyObject *))__pyx_f_9csamtools_7Samfile__buildHeader;
-  __pyx_vtable_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_getCurrent;
-  __pyx_vtable_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_cnext;
-  __pyx_vtable_9csamtools_Samfile.write = (int (*)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_9csamtools_7Samfile_write;
-  __pyx_vtable_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_9csamtools_Samfile *, int))__pyx_f_9csamtools_7Samfile__getrname;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_Samfile._buildHeader = (void(*)(void))__pyx_f_9csamtools_7Samfile__buildHeader;
-  *(void(**)(void))&__pyx_vtable_9csamtools_Samfile.getCurrent = (void(*)(void))__pyx_f_9csamtools_7Samfile_getCurrent;
-  *(void(**)(void))&__pyx_vtable_9csamtools_Samfile.cnext = (void(*)(void))__pyx_f_9csamtools_7Samfile_cnext;
-  *(void(**)(void))&__pyx_vtable_9csamtools_Samfile.write = (void(*)(void))__pyx_f_9csamtools_7Samfile_write;
-  *(void(**)(void))&__pyx_vtable_9csamtools_Samfile._getrname = (void(*)(void))__pyx_f_9csamtools_7Samfile__getrname;
-  #endif
-  if (PyType_Ready(&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_7Samfile___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_7Samfile___next__.doc = __pyx_doc_9csamtools_7Samfile___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_Samfile.tp_dict, __pyx_vtabptr_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_Samfile = &__pyx_type_9csamtools_Samfile;
-  if (PyType_Ready(&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_PileupProxy = &__pyx_type_9csamtools_PileupProxy;
-  if (PyType_Ready(&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_PileupRead = &__pyx_type_9csamtools_PileupRead;
-  __pyx_vtabptr_9csamtools_Fastafile = &__pyx_vtable_9csamtools_Fastafile;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_9csamtools_9Fastafile__fetch;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_Fastafile._fetch = (void(*)(void))__pyx_f_9csamtools_9Fastafile__fetch;
-  #endif
-  if (PyType_Ready(&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_Fastafile = &__pyx_type_9csamtools_Fastafile;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorRow = &__pyx_type_9csamtools_IteratorRow;
-  __pyx_vtabptr_9csamtools_IteratorRowRegion = &__pyx_vtable_9csamtools_IteratorRowRegion;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent;
-  __pyx_vtable_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_cnext;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (void(*)(void))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorRowRegion.cnext = (void(*)(void))__pyx_f_9csamtools_17IteratorRowRegion_cnext;
-  #endif
-  __pyx_type_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_17IteratorRowRegion___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_17IteratorRowRegion___next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorRowRegion = &__pyx_type_9csamtools_IteratorRowRegion;
-  __pyx_vtabptr_9csamtools_IteratorRowAll = &__pyx_vtable_9csamtools_IteratorRowAll;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_getCurrent;
-  __pyx_vtable_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_cnext;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (void(*)(void))__pyx_f_9csamtools_14IteratorRowAll_getCurrent;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorRowAll.cnext = (void(*)(void))__pyx_f_9csamtools_14IteratorRowAll_cnext;
-  #endif
-  __pyx_type_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_14IteratorRowAll___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_14IteratorRowAll___next__.doc = __pyx_doc_9csamtools_14IteratorRowAll___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorRowAll = &__pyx_type_9csamtools_IteratorRowAll;
-  __pyx_type_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs___next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs___next__;
-    }
-  }
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorRowAllRefs = &__pyx_type_9csamtools_IteratorRowAllRefs;
-  __pyx_vtabptr_9csamtools_IteratorRowSelection = &__pyx_vtable_9csamtools_IteratorRowSelection;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent;
-  __pyx_vtable_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_cnext;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (void(*)(void))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorRowSelection.cnext = (void(*)(void))__pyx_f_9csamtools_20IteratorRowSelection_cnext;
-  #endif
-  __pyx_type_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_20IteratorRowSelection___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_20IteratorRowSelection___next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorRowSelection = &__pyx_type_9csamtools_IteratorRowSelection;
-  __pyx_vtabptr_9csamtools_IteratorColumn = &__pyx_vtable_9csamtools_IteratorColumn;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_cnext;
-  __pyx_vtable_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_getSequence;
-  __pyx_vtable_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_setMask;
-  __pyx_vtable_9csamtools_IteratorColumn.setupIteratorData = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args))__pyx_f_9csamtools_14IteratorColumn_setupIteratorData;
-  __pyx_vtable_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_reset;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorColumn.cnext = (void(*)(void))__pyx_f_9csamtools_14IteratorColumn_cnext;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorColumn.getSequence = (void(*)(void))__pyx_f_9csamtools_14IteratorColumn_getSequence;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorColumn.setMask = (void(*)(void))__pyx_f_9csamtools_14IteratorColumn_setMask;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorColumn.setupIteratorData = (void(*)(void))__pyx_f_9csamtools_14IteratorColumn_setupIteratorData;
-  *(void(**)(void))&__pyx_vtable_9csamtools_IteratorColumn.reset = (void(*)(void))__pyx_f_9csamtools_14IteratorColumn_reset;
-  #endif
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorColumn = &__pyx_type_9csamtools_IteratorColumn;
-  __pyx_vtabptr_9csamtools_IteratorColumnRegion = &__pyx_vtable_9csamtools_IteratorColumnRegion;
-  __pyx_vtable_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
-  __pyx_type_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion___next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorColumnRegion = &__pyx_type_9csamtools_IteratorColumnRegion;
-  __pyx_vtabptr_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_9csamtools_IteratorColumnAllRefs;
-  __pyx_vtable_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
-  __pyx_type_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs___next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorColumnAllRefs = &__pyx_type_9csamtools_IteratorColumnAllRefs;
-  if (PyType_Ready(&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "SNPCall", (PyObject *)&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_SNPCall = &__pyx_type_9csamtools_SNPCall;
-  __pyx_vtabptr_9csamtools_SNPCallerBase = &__pyx_vtable_9csamtools_SNPCallerBase;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_9csamtools_SNPCallerBase.__dump = (PyObject *(*)(struct __pyx_obj_9csamtools_SNPCallerBase *, glf1_t *, uint32_t, int))__pyx_f_9csamtools_13SNPCallerBase___dump;
-  #else
-  *(void(**)(void))&__pyx_vtable_9csamtools_SNPCallerBase.__dump = (void(*)(void))__pyx_f_9csamtools_13SNPCallerBase___dump;
-  #endif
-  if (PyType_Ready(&__pyx_type_9csamtools_SNPCallerBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_SNPCallerBase.tp_dict, __pyx_vtabptr_9csamtools_SNPCallerBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "SNPCallerBase", (PyObject *)&__pyx_type_9csamtools_SNPCallerBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_SNPCallerBase = &__pyx_type_9csamtools_SNPCallerBase;
-  __pyx_vtabptr_9csamtools_IteratorSNPCalls = &__pyx_vtable_9csamtools_IteratorSNPCalls;
-  __pyx_vtable_9csamtools_IteratorSNPCalls.__pyx_base = *__pyx_vtabptr_9csamtools_SNPCallerBase;
-  __pyx_type_9csamtools_IteratorSNPCalls.tp_base = __pyx_ptype_9csamtools_SNPCallerBase;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorSNPCalls) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorSNPCalls, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_16IteratorSNPCalls___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_16IteratorSNPCalls___next__.doc = __pyx_doc_9csamtools_16IteratorSNPCalls___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_16IteratorSNPCalls___next__;
-    }
-  }
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorSNPCalls.tp_dict, __pyx_vtabptr_9csamtools_IteratorSNPCalls) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorSNPCalls", (PyObject *)&__pyx_type_9csamtools_IteratorSNPCalls) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorSNPCalls = &__pyx_type_9csamtools_IteratorSNPCalls;
-  __pyx_vtabptr_9csamtools_SNPCaller = &__pyx_vtable_9csamtools_SNPCaller;
-  __pyx_vtable_9csamtools_SNPCaller.__pyx_base = *__pyx_vtabptr_9csamtools_SNPCallerBase;
-  __pyx_type_9csamtools_SNPCaller.tp_base = __pyx_ptype_9csamtools_SNPCallerBase;
-  if (PyType_Ready(&__pyx_type_9csamtools_SNPCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_9csamtools_SNPCaller.tp_dict, __pyx_vtabptr_9csamtools_SNPCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "SNPCaller", (PyObject *)&__pyx_type_9csamtools_SNPCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_SNPCaller = &__pyx_type_9csamtools_SNPCaller;
-  if (PyType_Ready(&__pyx_type_9csamtools_IndelCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IndelCall", (PyObject *)&__pyx_type_9csamtools_IndelCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IndelCall = &__pyx_type_9csamtools_IndelCall;
-  if (PyType_Ready(&__pyx_type_9csamtools_IndelCallerBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IndelCallerBase", (PyObject *)&__pyx_type_9csamtools_IndelCallerBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IndelCallerBase = &__pyx_type_9csamtools_IndelCallerBase;
-  __pyx_type_9csamtools_IndelCaller.tp_base = __pyx_ptype_9csamtools_IndelCallerBase;
-  if (PyType_Ready(&__pyx_type_9csamtools_IndelCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IndelCaller", (PyObject *)&__pyx_type_9csamtools_IndelCaller) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IndelCaller = &__pyx_type_9csamtools_IndelCaller;
-  __pyx_type_9csamtools_IteratorIndelCalls.tp_base = __pyx_ptype_9csamtools_IndelCallerBase;
-  if (PyType_Ready(&__pyx_type_9csamtools_IteratorIndelCalls) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorIndelCalls, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_18IteratorIndelCalls___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_18IteratorIndelCalls___next__.doc = __pyx_doc_9csamtools_18IteratorIndelCalls___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorIndelCalls___next__;
-    }
-  }
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorIndelCalls", (PyObject *)&__pyx_type_9csamtools_IteratorIndelCalls) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IteratorIndelCalls = &__pyx_type_9csamtools_IteratorIndelCalls;
-  if (PyType_Ready(&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_9csamtools_IndexedReads = &__pyx_type_9csamtools_IndexedReads;
-  /*--- Type import code ---*/
-  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  /*--- Function import code ---*/
-  /*--- Execution code ---*/
+  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_cmp = __Pyx_GetName(__pyx_b, __pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":4
- * # cython: profile=True
- * # adds doc-strings for sphinx
- * import tempfile             # <<<<<<<<<<<<<<
- * import os
- * import sys
+static int __Pyx_InitCachedConstants(void) {
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
+
+  /* "csamtools.pyx":271
+ *     def __len__(self):
+ *         if self.fastafile == NULL:
+ *             raise ValueError( "calling len() on closed file" )             # <<<<<<<<<<<<<<
+ * 
+ *         return faidx_fetch_nseq(self.fastafile)
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":5
- * # adds doc-strings for sphinx
- * import tempfile
- * import os             # <<<<<<<<<<<<<<
- * import sys
- * import types
+  /* "csamtools.pyx":303
+ *         '''number of :term:`filename` associated with this object.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return self._filename
+ * 
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":6
- * import tempfile
- * import os
- * import sys             # <<<<<<<<<<<<<<
- * import types
- * import itertools
+  /* "csamtools.pyx":328
+ * 
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ * 
+ *         cdef int length
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":7
- * import os
- * import sys
- * import types             # <<<<<<<<<<<<<<
- * import itertools
- * import struct
+  /* "csamtools.pyx":334
+ * 
+ *         if not region:
+ *             if reference is None: raise ValueError( 'no sequence/region supplied.' )             # <<<<<<<<<<<<<<
+ *             if start is None: start = 0
+ *             if end is None: end = max_pos -1
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":8
- * import sys
- * import types
- * import itertools             # <<<<<<<<<<<<<<
- * import struct
- * import ctypes
+  /* "csamtools.pyx":636
+ *         returns -1 if reference is not known.
+ *         '''
+ *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *         return pysam_reference2tid( self.samfile.header, reference )
+ * 
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":9
- * import types
- * import itertools
- * import struct             # <<<<<<<<<<<<<<
- * import ctypes
- * import collections
+  /* "csamtools.pyx":642
+ *         '''
+ *         convert numerical :term:`tid` into :term:`reference` name.'''
+ *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *         if not 0 <= tid < self.samfile.header.n_targets:
+ *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":10
- * import itertools
- * import struct
- * import ctypes             # <<<<<<<<<<<<<<
- * import collections
- * import re
+  /* "csamtools.pyx":650
+ *         '''
+ *         convert numerical :term:`tid` into :term:`reference` name.'''
+ *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *         if not 0 <= tid < self.samfile.header.n_targets:
+ *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":11
- * import struct
- * import ctypes
- * import collections             # <<<<<<<<<<<<<<
- * import re
- * import platform
+  /* "csamtools.pyx":699
+ *             if len(parts) >= 3: rend = int(parts[2])
+ * 
+ *         if not reference: return 0, 0, 0, 0             # <<<<<<<<<<<<<<
+ * 
+ *         rtid = self.gettid( reference )
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_34 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34));
+  __Pyx_INCREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, __pyx_int_0);
+  __Pyx_GIVEREF(__pyx_int_0);
+  __Pyx_INCREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, __pyx_int_0);
+  __Pyx_GIVEREF(__pyx_int_0);
+  __Pyx_INCREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, __pyx_int_0);
+  __Pyx_GIVEREF(__pyx_int_0);
+  __Pyx_INCREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, __pyx_int_0);
+  __Pyx_GIVEREF(__pyx_int_0);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":12
- * import ctypes
- * import collections
- * import re             # <<<<<<<<<<<<<<
- * import platform
- * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
+  /* "csamtools.pyx":719
+ * 
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *         if not self.isbam:
+ *             raise NotImplementedError("seek only available in bam files")
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":13
- * import collections
- * import re
- * import platform             # <<<<<<<<<<<<<<
- * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
- * from cpython cimport PyErr_SetString
+  /* "csamtools.pyx":721
+ *             raise ValueError( "I/O operation on closed file" )
+ *         if not self.isbam:
+ *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
+ *         if self.isstream:
+ *             raise OSError("seek no available in streams")
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__platform), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__platform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":63
- * #####################################################################
- * # hard-coded constants
- * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"             # <<<<<<<<<<<<<<
- * cdef int max_pos = 2 << 29
+  /* "csamtools.pyx":723
+ *             raise NotImplementedError("seek only available in bam files")
+ *         if self.isstream:
+ *             raise OSError("seek no available in streams")             # <<<<<<<<<<<<<<
  * 
+ *         return bam_seek( self.samfile.x.bam, offset, where )
  */
-  __pyx_v_9csamtools_bam_nt16_rev_table = __pyx_k_172;
+  __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":64
- * # hard-coded constants
- * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"
- * cdef int max_pos = 2 << 29             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":732
+ *         '''
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *         if not self.isbam:
+ *             raise NotImplementedError("seek only available in bam files")
+ */
+  __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
+
+  /* "csamtools.pyx":734
+ *             raise ValueError( "I/O operation on closed file" )
+ *         if not self.isbam:
+ *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
  * 
- * # redirect stderr to 0
+ *         return bam_tell( self.samfile.x.bam )
  */
-  __pyx_v_9csamtools_max_pos = 1073741824;
+  __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_38));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":67
+  /* "csamtools.pyx":769
  * 
- * # redirect stderr to 0
- * _logfile = open(os.path.devnull, "w")             # <<<<<<<<<<<<<<
- * pysam_set_stderr( PyFile_AsFile( _logfile ) )
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
+ *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__devnull); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
-  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___logfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":68
- * # redirect stderr to 0
- * _logfile = open(os.path.devnull, "w")
- * pysam_set_stderr( PyFile_AsFile( _logfile ) )             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":778
+ *         if self.isbam:
+ *             if not until_eof and not self._hasIndex() and not self.isremote:
+ *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
+ * 
+ *             if callback:
+ */
+  __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_46));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
+
+  /* "csamtools.pyx":781
+ * 
+ *             if callback:
+ *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
+ *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )
+ *                 return bam_fetch(self.samfile.x.bam,
+ */
+  __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
+
+  /* "csamtools.pyx":782
+ *             if callback:
+ *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
+ *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
+ *                 return bam_fetch(self.samfile.x.bam,
+ *                                  self.index,
+ */
+  __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
+  PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+
+  /* "csamtools.pyx":803
+ *             # this happens if a bamfile is opened with mode 'r'
+ *             if has_coord:
+ *                 raise ValueError ("fetching by region is not available for sam files" )             # <<<<<<<<<<<<<<
+ * 
+ *             if self.samfile.header.n_targets == 0:
+ */
+  __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_52));
+  PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_52));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_52));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
+
+  /* "csamtools.pyx":806
+ * 
+ *             if self.samfile.header.n_targets == 0:
+ *                 raise ValueError( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
+ * 
+ *             if callback:
+ */
+  __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_54));
+  PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_54));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
+
+  /* "csamtools.pyx":809
+ * 
+ *             if callback:
+ *                 raise NotImplementedError( "callback not implemented yet" )             # <<<<<<<<<<<<<<
+ *             else:
+ *                 return IteratorRowAll( self, reopen=reopen )
+ */
+  __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_57));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
+  PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
+
+  /* "csamtools.pyx":850
+ * 
+ *         if mate_data.mate == NULL:
+ *             raise ValueError( "mate not found" )             # <<<<<<<<<<<<<<
+ * 
+ *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
+ */
+  __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
+  PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
+
+  /* "csamtools.pyx":875
+ * 
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ * 
+ *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
+ */
+  __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+
+  /* "csamtools.pyx":884
+ *         if self.isbam:
+ *             if not until_eof and not self._hasIndex() and not self.isremote:
+ *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
  * 
- * #####################################################################
+ *             if not region:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  pysam_set_stderr(PyFile_AsFile(__pyx_t_1));
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_64));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
+  PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, ((PyObject *)__pyx_kp_s_46));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":117
- *     (<object>f)(a)
+  /* "csamtools.pyx":887
  * 
- * class PileupColumn(object):             # <<<<<<<<<<<<<<
- *     '''A pileup column. A pileup column contains
- *     all the reads that map to a certain target base.
+ *             if not region:
+ *                 raise ValueError( "counting functionality requires a region/reference" )             # <<<<<<<<<<<<<<
+ *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )
+ *             bam_fetch(self.samfile.x.bam,
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_builtin_object);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
-  __Pyx_GIVEREF(__pyx_builtin_object);
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_173)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_CreateClass(__pyx_t_2, ((PyObject *)__pyx_t_1), __pyx_n_s__PileupColumn, "csamtools"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_65));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_65));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_65));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":130
- *         list of reads (:class:`pysam.PileupRead`) aligned to this column
- *     '''
- *     def __str__(self):             # <<<<<<<<<<<<<<
- *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
- *             "\n" + "\n".join( map(str, self.pileups) )
+  /* "csamtools.pyx":888
+ *             if not region:
+ *                 raise ValueError( "counting functionality requires a region/reference" )
+ *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
+ *             bam_fetch(self.samfile.x.bam,
+ *                              self.index,
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_12PileupColumn___str__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s____str__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PileupColumn, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_50));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":174
- *     return 0
+  /* "csamtools.pyx":898
+ *             return counter
+ *         else:
+ *             raise ValueError ("count for a region is not available for sam files" )             # <<<<<<<<<<<<<<
  * 
- * class StderrStore():             # <<<<<<<<<<<<<<
- *     '''
- *     stderr is captured.
+ *     def pileup( self,
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_174)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStore, "csamtools"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_69));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_68));
+  PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_kp_s_68));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_68));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":178
- *     stderr is captured.
- *     '''
- *     def __init__(self):             # <<<<<<<<<<<<<<
- *         return
- *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
+  /* "csamtools.pyx":952
+ * 
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ * 
+ *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_9csamtools_11StderrStore___init__, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":184
- *         self.stderr_save.setfd( self.stderr_h )
+  /* "csamtools.pyx":957
  * 
- *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
- *         return []
- *         self.stderr_save.restore()
+ *         if self.isbam:
+ *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )             # <<<<<<<<<<<<<<
+ * 
+ *             if callback:
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_11StderrStore_readAndRelease, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__readAndRelease, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_71));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_71));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":193
- *         return lines
+  /* "csamtools.pyx":960
  * 
- *     def release(self):             # <<<<<<<<<<<<<<
- *         return
- *         self.stderr_save.restore()
+ *             if callback:
+ *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
+ * 
+ *                 buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_9csamtools_11StderrStore_release, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__release, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_73));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_kp_s_48));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":199
- *             os.remove( self.stderr_f )
+  /* "csamtools.pyx":981
  * 
- *     def __del__(self):             # <<<<<<<<<<<<<<
- *         self.release()
+ *         else:
+ *             raise NotImplementedError( "pileup of samfiles not implemented yet" )             # <<<<<<<<<<<<<<
  * 
+ *     def close( self ):
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_11StderrStore___del__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s____del__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_74));
+  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_74));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_74));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":202
- *         self.release()
+  /* "csamtools.pyx":1025
+ *         '''number of :term:`filename` associated with this object.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return self._filename
  * 
- * class StderrStoreWindows():             # <<<<<<<<<<<<<<
- *     '''does nothing. stderr can't be redirected on windows'''
- *     def __init__(self): pass
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_175)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStoreWindows, "csamtools"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_76));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":204
- * class StderrStoreWindows():
- *     '''does nothing. stderr can't be redirected on windows'''
- *     def __init__(self): pass             # <<<<<<<<<<<<<<
- *     def readAndRelease(self): return []
- *     def release(self): pass
+  /* "csamtools.pyx":1031
+ *         '''number of :term:`reference` sequences in the file.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return self.samfile.header.n_targets
+ * 
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_9csamtools_18StderrStoreWindows___init__, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_77));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":205
- *     '''does nothing. stderr can't be redirected on windows'''
- *     def __init__(self): pass
- *     def readAndRelease(self): return []             # <<<<<<<<<<<<<<
- *     def release(self): pass
- * 
+  /* "csamtools.pyx":1037
+ *         """tuple with the names of :term:`reference` sequences."""
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             t = []
+ *             for x from 0 <= x < self.samfile.header.n_targets:
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_18StderrStoreWindows_readAndRelease, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__readAndRelease, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_78));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":206
- *     def __init__(self): pass
- *     def readAndRelease(self): return []
- *     def release(self): pass             # <<<<<<<<<<<<<<
- * 
- * if platform.system()=='Windows':
+  /* "csamtools.pyx":1048
+ *         """
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             t = []
+ *             for x from 0 <= x < self.samfile.header.n_targets:
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_9csamtools_18StderrStoreWindows_release, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__release, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStoreWindows, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_79));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":208
- *     def release(self): pass
+  /* "csamtools.pyx":1058
+ *         """
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
  * 
- * if platform.system()=='Windows':             # <<<<<<<<<<<<<<
- *     del StderrStore
- *     StderrStore = StderrStoreWindows
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__platform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__system); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_5) {
+  __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":209
- * 
- * if platform.system()=='Windows':
- *     del StderrStore             # <<<<<<<<<<<<<<
- *     StderrStore = StderrStoreWindows
+  /* "csamtools.pyx":1059
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )             # <<<<<<<<<<<<<<
  * 
+ *             cdef int tid
  */
-    if (__Pyx_DelAttrString(__pyx_m, "StderrStore") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_82));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_81));
+  PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, ((PyObject *)__pyx_kp_s_81));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_81));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));
 
-    /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":210
- * if platform.system()=='Windows':
- *     del StderrStore
- *     StderrStore = StderrStoreWindows             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":1071
+ *         """
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
+ *             cdef int tid
+ */
+  __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
+
+  /* "csamtools.pyx":1072
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )             # <<<<<<<<<<<<<<
+ *             cdef int tid
+ *             cdef uint32_t total = 0
+ */
+  __pyx_k_tuple_85 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_85));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_84));
+  PyTuple_SET_ITEM(__pyx_k_tuple_85, 0, ((PyObject *)__pyx_kp_s_84));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_84));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));
+
+  /* "csamtools.pyx":1084
+ *         '''full contents of the :term:`sam file` header as a string.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
  * 
+ */
+  __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_86));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
+
+  /* "csamtools.pyx":1092
+ *         '''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
+ *             result = {}
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
+  __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_87));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":217
- * ######################################################################
- * # valid types for sam headers
- * VALID_HEADER_TYPES = { "HD" : dict,             # <<<<<<<<<<<<<<
- *                        "SQ" : list,
- *                        "RG" : list,
+  /* "csamtools.pyx":1099
+ *                 # convert to python string (note: call self.text to create 0-terminated string)
+ *                 t = self.text
+ *                 for line in t.split("\n"):             # <<<<<<<<<<<<<<
+ *                     if not line.strip(): continue
+ *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)&PyDict_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_88));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":218
- * # valid types for sam headers
- * VALID_HEADER_TYPES = { "HD" : dict,
- *                        "SQ" : list,             # <<<<<<<<<<<<<<
- *                        "RG" : list,
- *                        "PG" : list,
+  /* "csamtools.pyx":1101
+ *                 for line in t.split("\n"):
+ *                     if not line.strip(): continue
+ *                     assert line.startswith("@"), "header line without '@': '%s'" % line             # <<<<<<<<<<<<<<
+ *                     fields = line[1:].split("\t")
+ *                     record = fields[0]
  */
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)&PyList_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_90));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_89));
+  PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_89));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":219
- * VALID_HEADER_TYPES = { "HD" : dict,
- *                        "SQ" : list,
- *                        "RG" : list,             # <<<<<<<<<<<<<<
- *                        "PG" : list,
- *                        "CO" : list }
+  /* "csamtools.pyx":1102
+ *                     if not line.strip(): continue
+ *                     assert line.startswith("@"), "header line without '@': '%s'" % line
+ *                     fields = line[1:].split("\t")             # <<<<<<<<<<<<<<
+ *                     record = fields[0]
+ *                     assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
+ */
+  __pyx_k_tuple_92 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_92));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_kp_s_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));
+
+  /* "csamtools.pyx":1115
+ *                     x = {}
+ *                     for field in fields[1:]:
+ *                         key, value = field.split(":",1)             # <<<<<<<<<<<<<<
+ *                         # uppercase keys must be valid
+ *                         # lowercase are permitted for user fields
  */
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)&PyList_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_95 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_94));
+  PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_94));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_94));
+  __Pyx_INCREF(__pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_k_tuple_95, 1, __pyx_int_1);
+  __Pyx_GIVEREF(__pyx_int_1);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":220
- *                        "SQ" : list,
- *                        "RG" : list,
- *                        "PG" : list,             # <<<<<<<<<<<<<<
- *                        "CO" : list }
- * 
+  /* "csamtools.pyx":1217
+ *     ###############################################################
+ *     def __iter__(self):
+ *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *         if not self.isbam and self.samfile.header.n_targets == 0:
+ *                 raise NotImplementedError( "can not iterate over samfile without header")
  */
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)&PyList_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_102 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_102));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":221
- *                        "RG" : list,
- *                        "PG" : list,
- *                        "CO" : list }             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":1219
+ *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *         if not self.isbam and self.samfile.header.n_targets == 0:
+ *                 raise NotImplementedError( "can not iterate over samfile without header")             # <<<<<<<<<<<<<<
+ *         return self
  * 
- * # order of records within sam headers
  */
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)&PyList_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_103));
+  PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_103));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":224
+  /* "csamtools.pyx":1296
  * 
- * # order of records within sam headers
- * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" )             # <<<<<<<<<<<<<<
+ *         if not samfile._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
- * # type conversions within sam header records
+ *         if not samfile._hasIndex():
  */
-  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__HD));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__HD));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ));
-  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__SQ));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__RG));
-  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__RG));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PG));
-  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__PG));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__CO));
-  PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__CO));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_k_tuple_105 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_105));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_105, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":227
+  /* "csamtools.pyx":1299
  * 
- * # type conversions within sam header records
- * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },             # <<<<<<<<<<<<<<
- *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
- *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
- */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":228
- * # type conversions within sam header records
- * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
- *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },             # <<<<<<<<<<<<<<
- *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
- *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
- */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":229
- * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
- *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
- *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },             # <<<<<<<<<<<<<<
- *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
+ *         if not samfile._hasIndex():
+ *             raise ValueError( "no index available for iteration" )             # <<<<<<<<<<<<<<
  * 
+ *         # makes sure that samfile stays alive as long as the
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SM), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LB), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DS), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PU), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PI), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DT), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_106));
+  PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_106));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_106));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":230
- *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
- *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
- *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":1369
  * 
- * # output order of fields within records
- */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PN), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)&PyString_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":233
+ *         if not samfile._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
- * # output order of fields within records
- * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),             # <<<<<<<<<<<<<<
- *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
+ *         if samfile.isbam: mode = "rb"
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__VN));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__SO));
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__SO));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__GO));
-  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__GO));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO));
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":234
- * # output order of fields within records
- * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
- *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),             # <<<<<<<<<<<<<<
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+  /* "csamtools.pyx":1424
+ *     def __cinit__(self, Samfile samfile):
+ *         assert samfile._isOpen()
+ *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")             # <<<<<<<<<<<<<<
+ *         self.samfile = samfile
+ *         self.tid = -1
  */
-  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__SN));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__SN));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__LN));
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__LN));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__AS));
-  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__AS));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__M5));
-  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__M5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__UR));
-  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__UR));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__SP));
-  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__SP));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP));
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
+  PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_50));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":235
- * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
- *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),             # <<<<<<<<<<<<<<
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+  /* "csamtools.pyx":1477
+ * 
+ *         if not samfile._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
+ *         if not samfile._isOpen():
  */
-  __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__ID));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__SM));
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__SM));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__LB));
-  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__LB));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__DS));
-  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__DS));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PU));
-  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__PU));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PI));
-  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__PI));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__CN));
-  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__CN));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__DT));
-  PyTuple_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__DT));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PL));
-  PyTuple_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__PL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL));
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_110 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_110));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":236
- *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":1480
  * 
+ *         if not samfile._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
+ *         assert samfile.isbam, "can only use this iterator on bam files"
  */
-  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PN));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__PN));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PN));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__ID));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
-  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__VN));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__CL));
-  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__CL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL));
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":719
- *                region = None,
- *                callback = None,
- *                until_eof = False ):             # <<<<<<<<<<<<<<
- *         '''
- *         fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by
- */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_29 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __pyx_k_tuple_111 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":830
- *                end = None,
- *                region = None,
- *                until_eof = False ):             # <<<<<<<<<<<<<<
- *         '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
+  /* "csamtools.pyx":1796
+ *             self.cnext()
+ *             if self.n_plp < 0:
+ *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
  * 
+ *             if self.plp == NULL:
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_39 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_116));
+  PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_116));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1718
- *                   int tid = 0,
- *                   int start = 0,
- *                   int end = max_pos,             # <<<<<<<<<<<<<<
- *                   **kwargs ):
+  /* "csamtools.pyx":1828
  * 
+ *             if self.n_plp < 0:
+ *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
+ * 
+ *             # return result, if within same reference
  */
-  __pyx_k_58 = __pyx_v_9csamtools_max_pos;
+  __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_118));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_116));
+  PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_116));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2699
- *             return self._level
+  /* "csamtools.pyx":2363
+ *                     size = struct.calcsize(fmt)
+ *                     if offset + size > max_size:
+ *                         raise NotImplementedError("tags field too large")             # <<<<<<<<<<<<<<
  * 
- * class Outs:             # <<<<<<<<<<<<<<
- *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
- *     def __init__(self, id = 1):
+ *                     struct.pack_into( fmt,
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_176)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3), __pyx_n_s__Outs, "csamtools"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_133));
+  PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_133));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2701
- * class Outs:
- *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
- *     def __init__(self, id = 1):             # <<<<<<<<<<<<<<
- *         self.streams = []
- *         self.id = id
+  /* "csamtools.pyx":2710
+ * 
+ *     def __init__(self):
+ *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
+ * 
+ *     def __str__(self):
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_4Outs___init__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_k_tuple_158 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_158)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_158));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_157));
+  PyTuple_SET_ITEM(__pyx_k_tuple_158, 0, ((PyObject *)__pyx_kp_s_157));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_157));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_158));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2705
- *         self.id = id
+  /* "csamtools.pyx":2754
  * 
- *     def setdevice(self, filename):             # <<<<<<<<<<<<<<
- *         '''open an existing file, like "/dev/null"'''
- *         fd = os.open(filename, os.O_WRONLY)
+ *     def __init__(self):
+ *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
+ * 
+ *     def __str__(self):
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_9csamtools_4Outs_setdevice, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s__setdevice, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_k_tuple_159 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_159));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_157));
+  PyTuple_SET_ITEM(__pyx_k_tuple_159, 0, ((PyObject *)__pyx_kp_s_157));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_157));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2710
- *         self.setfd(fd)
+  /* "csamtools.pyx":2867
+ *         # recover. Thus redirect output to file with -o option.
+ *         if method == "view":
+ *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")             # <<<<<<<<<<<<<<
+ *             args = ( "-o", stdout_f ) + args
  * 
- *     def setfile(self, filename):             # <<<<<<<<<<<<<<
- *         '''open a new file.'''
- *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_4Outs_setfile, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s__setfile, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_k_tuple_165 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_165));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_164));
+  PyTuple_SET_ITEM(__pyx_k_tuple_165, 0, ((PyObject *)__pyx_kp_s_164));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_164));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_165));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2715
- *         self.setfd(fd)
+  /* "csamtools.pyx":224
  * 
- *     def setfd(self, fd):             # <<<<<<<<<<<<<<
- *         ofd = os.dup(self.id)      #  Save old stream on new unit.
- *         self.streams.append(ofd)
- */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_9csamtools_4Outs_setfd, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s__setfd, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ * # order of records within sam headers
+ * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" )             # <<<<<<<<<<<<<<
+ * 
+ * # type conversions within sam header records
+ */
+  __pyx_k_tuple_233 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_233));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__HD));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 0, ((PyObject *)__pyx_n_s__HD));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 1, ((PyObject *)__pyx_n_s__SQ));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__RG));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 2, ((PyObject *)__pyx_n_s__RG));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PG));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 3, ((PyObject *)__pyx_n_s__PG));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__CO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 4, ((PyObject *)__pyx_n_s__CO));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_233));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2723
- *         os.close(fd)                #  Close other unit (look out, caller.)
+  /* "csamtools.pyx":233
  * 
- *     def restore(self):             # <<<<<<<<<<<<<<
- *         '''restore previous output stream'''
- *         if self.streams:
+ * # output order of fields within records
+ * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),             # <<<<<<<<<<<<<<
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
  */
-  __pyx_t_2 = PyCFunction_New(&__pyx_mdef_9csamtools_4Outs_restore, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s__restore, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_k_tuple_234 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_234));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_234, 0, ((PyObject *)__pyx_n_s__VN));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__SO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_234, 1, ((PyObject *)__pyx_n_s__SO));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__GO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_234, 2, ((PyObject *)__pyx_n_s__GO));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_234));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2736
- * def _samtools_dispatch( method,
- *                         args = (),
- *                         catch_stdout = True,             # <<<<<<<<<<<<<<
- *                         catch_stderr = False,
- *                         ):
+  /* "csamtools.pyx":234
+ * # output order of fields within records
+ * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),             # <<<<<<<<<<<<<<
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_98 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __pyx_k_tuple_235 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_235));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__SN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 0, ((PyObject *)__pyx_n_s__SN));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__LN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 1, ((PyObject *)__pyx_n_s__LN));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__AS));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 2, ((PyObject *)__pyx_n_s__AS));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__M5));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 3, ((PyObject *)__pyx_n_s__M5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__UR));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 4, ((PyObject *)__pyx_n_s__UR));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__SP));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 5, ((PyObject *)__pyx_n_s__SP));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_235));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":2737
- *                         args = (),
- *                         catch_stdout = True,
- *                         catch_stderr = False,             # <<<<<<<<<<<<<<
- *                         ):
- *     '''call ``method`` in samtools providing arguments in args.
+  /* "csamtools.pyx":235
+ * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),             # <<<<<<<<<<<<<<
+ *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ * 
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_99 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
+  __pyx_k_tuple_236 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_236));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 0, ((PyObject *)__pyx_n_s__ID));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__SM));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 1, ((PyObject *)__pyx_n_s__SM));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__LB));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 2, ((PyObject *)__pyx_n_s__LB));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__DS));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 3, ((PyObject *)__pyx_n_s__DS));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PU));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 4, ((PyObject *)__pyx_n_s__PU));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PI));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 5, ((PyObject *)__pyx_n_s__PI));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__CN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 6, ((PyObject *)__pyx_n_s__CN));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__DT));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 7, ((PyObject *)__pyx_n_s__DT));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PL));
+  PyTuple_SET_ITEM(__pyx_k_tuple_236, 8, ((PyObject *)__pyx_n_s__PL));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_236));
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":3436
- *         if self.owns_samfile: samclose( self.fp )
+  /* "csamtools.pyx":236
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL" ), }             # <<<<<<<<<<<<<<
+ * 
  * 
- * __all__ = ["Samfile",             # <<<<<<<<<<<<<<
- *            "Fastafile",
- *            "IteratorRow",
  */
-  __pyx_t_3 = PyList_New(13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile));
-  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__Samfile));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__Fastafile));
-  PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Fastafile));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Fastafile));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorRow));
-  PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__IteratorRow));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorRow));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorColumn));
-  PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__IteratorColumn));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorColumn));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__AlignedRead));
-  PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__AlignedRead));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AlignedRead));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupColumn));
-  PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_n_s__PileupColumn));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupColumn));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupProxy));
-  PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s__PileupProxy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupProxy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupRead));
-  PyList_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_n_s__PileupRead));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupRead));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorSNPCalls));
-  PyList_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_n_s__IteratorSNPCalls));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorSNPCalls));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__SNPCaller));
-  PyList_SET_ITEM(__pyx_t_3, 9, ((PyObject *)__pyx_n_s__SNPCaller));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SNPCaller));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__IndelCaller));
-  PyList_SET_ITEM(__pyx_t_3, 10, ((PyObject *)__pyx_n_s__IndelCaller));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndelCaller));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorIndelCalls));
-  PyList_SET_ITEM(__pyx_t_3, 11, ((PyObject *)__pyx_n_s__IteratorIndelCalls));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorIndelCalls));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__IndexedReads));
-  PyList_SET_ITEM(__pyx_t_3, 12, ((PyObject *)__pyx_n_s__IndexedReads));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndexedReads));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_k_tuple_237 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_237));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_237, 0, ((PyObject *)__pyx_n_s__PN));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PN));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
+  PyTuple_SET_ITEM(__pyx_k_tuple_237, 1, ((PyObject *)__pyx_n_s__ID));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_237, 2, ((PyObject *)__pyx_n_s__VN));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__CL));
+  PyTuple_SET_ITEM(__pyx_k_tuple_237, 3, ((PyObject *)__pyx_n_s__CL));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_237));
+  __Pyx_RefNannyFinishContext();
+  return 0;
+  __pyx_L1_error:;
+  __Pyx_RefNannyFinishContext();
+  return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_neg_127 = PyInt_FromLong(-127); if (unlikely(!__pyx_int_neg_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_0660 = PyInt_FromLong(0660); if (unlikely(!__pyx_int_0660)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_8000 = PyInt_FromLong(8000); if (unlikely(!__pyx_int_8000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_65535 = PyInt_FromLong(65535); if (unlikely(!__pyx_int_65535)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_neg_32767 = PyInt_FromLong(-32767); if (unlikely(!__pyx_int_neg_32767)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_536870912 = PyInt_FromLong(536870912); if (unlikely(!__pyx_int_536870912)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_neg_2147483648 = PyInt_FromLong(-2147483648); if (unlikely(!__pyx_int_neg_2147483648)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initcsamtools(void); /*proto*/
+PyMODINIT_FUNC initcsamtools(void)
+#else
+PyMODINIT_FUNC PyInit_csamtools(void); /*proto*/
+PyMODINIT_FUNC PyInit_csamtools(void)
+#endif
+{
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  #if CYTHON_REFNANNY
+  void* __pyx_refnanny = NULL;
+  __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");
+  }
+  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_csamtools(void)", __LINE__, __FILE__);
+  #endif
+  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifdef __pyx_binding_PyCFunctionType_USED
+  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  /*--- Library function declarations ---*/
+  /*--- Threads initialization code ---*/
+  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+  #ifdef WITH_THREAD /* Python build with threading support? */
+  PyEval_InitThreads();
+  #endif
+  #endif
+  /*--- Module creation code ---*/
+  #if PY_MAJOR_VERSION < 3
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
+  #else
+  __pyx_m = PyModule_Create(&__pyx_moduledef);
+  #endif
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
+  #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  /*--- Initialize various global constants etc. ---*/
+  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_module_is_main_csamtools) {
+    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  }
+  /*--- Builtin init code ---*/
+  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Constants init code ---*/
+  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Global init code ---*/
+  /*--- Function export code ---*/
+  /*--- Type init code ---*/
+  __pyx_ptype_9csamtools_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject), 0); if (unlikely(!__pyx_ptype_9csamtools_file)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__.doc = __pyx_doc_9csamtools_11AlignedRead_2__str__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead_2__str__;
+    }
+  }
+  if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_AlignedRead = &__pyx_type_9csamtools_AlignedRead;
+  __pyx_vtabptr_9csamtools_Samfile = &__pyx_vtable_9csamtools_Samfile;
+  __pyx_vtable_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_9csamtools_Samfile *, PyObject *))__pyx_f_9csamtools_7Samfile__buildHeader;
+  __pyx_vtable_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_getCurrent;
+  __pyx_vtable_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_cnext;
+  __pyx_vtable_9csamtools_Samfile.write = (int (*)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_9csamtools_7Samfile_write;
+  __pyx_vtable_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_9csamtools_Samfile *, int))__pyx_f_9csamtools_7Samfile__getrname;
+  if (PyType_Ready(&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_7Samfile_21__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_7Samfile_21__next__.doc = __pyx_doc_9csamtools_7Samfile_21__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile_21__next__;
+    }
+  }
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_Samfile.tp_dict, __pyx_vtabptr_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_Samfile = &__pyx_type_9csamtools_Samfile;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRow = &__pyx_type_9csamtools_IteratorRow;
+  __pyx_vtabptr_9csamtools_IteratorRowAll = &__pyx_vtable_9csamtools_IteratorRowAll;
+  __pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_getCurrent;
+  __pyx_vtable_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_cnext;
+  __pyx_type_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__.doc = __pyx_doc_9csamtools_14IteratorRowAll_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__;
+    }
+  }
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowAll = &__pyx_type_9csamtools_IteratorRowAll;
+  if (PyType_Ready(&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_PileupProxy = &__pyx_type_9csamtools_PileupProxy;
+  if (PyType_Ready(&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_PileupRead = &__pyx_type_9csamtools_PileupRead;
+  __pyx_vtabptr_9csamtools_Fastafile = &__pyx_vtable_9csamtools_Fastafile;
+  __pyx_vtable_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_9csamtools_9Fastafile__fetch;
+  if (PyType_Ready(&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_Fastafile = &__pyx_type_9csamtools_Fastafile;
+  __pyx_vtabptr_9csamtools_IteratorRowRegion = &__pyx_vtable_9csamtools_IteratorRowRegion;
+  __pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent;
+  __pyx_vtable_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_cnext;
+  __pyx_type_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__;
+    }
+  }
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowRegion = &__pyx_type_9csamtools_IteratorRowRegion;
+  __pyx_type_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__;
+    }
+  }
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowAllRefs = &__pyx_type_9csamtools_IteratorRowAllRefs;
+  __pyx_vtabptr_9csamtools_IteratorRowSelection = &__pyx_vtable_9csamtools_IteratorRowSelection;
+  __pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent;
+  __pyx_vtable_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_cnext;
+  __pyx_type_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__;
+    }
+  }
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowSelection = &__pyx_type_9csamtools_IteratorRowSelection;
+  __pyx_vtabptr_9csamtools_IteratorColumn = &__pyx_vtable_9csamtools_IteratorColumn;
+  __pyx_vtable_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_cnext;
+  __pyx_vtable_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_getSequence;
+  __pyx_vtable_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_setMask;
+  __pyx_vtable_9csamtools_IteratorColumn.setupIteratorData = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args))__pyx_f_9csamtools_14IteratorColumn_setupIteratorData;
+  __pyx_vtable_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_reset;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorColumn = &__pyx_type_9csamtools_IteratorColumn;
+  __pyx_vtabptr_9csamtools_IteratorColumnRegion = &__pyx_vtable_9csamtools_IteratorColumnRegion;
+  __pyx_vtable_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
+  __pyx_type_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__;
+    }
+  }
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorColumnRegion = &__pyx_type_9csamtools_IteratorColumnRegion;
+  __pyx_vtabptr_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_9csamtools_IteratorColumnAllRefs;
+  __pyx_vtable_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
+  __pyx_type_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__;
+    }
+  }
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorColumnAllRefs = &__pyx_type_9csamtools_IteratorColumnAllRefs;
+  if (PyType_Ready(&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "SNPCall", (PyObject *)&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_SNPCall = &__pyx_type_9csamtools_SNPCall;
+  if (PyType_Ready(&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IndexedReads = &__pyx_type_9csamtools_IndexedReads;
+  /*--- Type import code ---*/
+  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Function import code ---*/
+  /*--- Execution code ---*/
 
-  /* "/ifs/devel/pysam/pysam/pysam/csamtools.pyx":1
- * # cython: embedsignature=True             # <<<<<<<<<<<<<<
+  /* "csamtools.pyx":4
  * # cython: profile=True
  * # adds doc-strings for sphinx
+ * import tempfile             # <<<<<<<<<<<<<<
+ * import os
+ * import sys
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Fastafile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_177), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Fastafile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_178), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Fastafile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fetch); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_179), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_180), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_181), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_182), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__gettid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_183), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getrname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_184), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_185), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__seek); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_186), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_187), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fetch); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_188), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_189), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_190), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pileup); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_191), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_192), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_193), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s___buildLine); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_194), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_195), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorRowRegion); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_196), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorRowAll); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_197), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorRowAllRefs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_198), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s_200); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_199), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorColumn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__addReference); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_201), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorColumn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__hasReference); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_202), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s_204); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_203), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s_206); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____next__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_205), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__AlignedRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____str__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":5
+ * # adds doc-strings for sphinx
+ * import tempfile
+ * import os             # <<<<<<<<<<<<<<
+ * import sys
+ * import types
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_207), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__AlignedRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":6
+ * import tempfile
+ * import os
+ * import sys             # <<<<<<<<<<<<<<
+ * import types
+ * import itertools
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compare); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":7
+ * import os
+ * import sys
+ * import types             # <<<<<<<<<<<<<<
+ * import itertools
+ * import struct
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_208), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__AlignedRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":8
+ * import sys
+ * import types
+ * import itertools             # <<<<<<<<<<<<<<
+ * import struct
+ * import ctypes
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__overlap); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":9
+ * import types
+ * import itertools
+ * import struct             # <<<<<<<<<<<<<<
+ * import ctypes
+ * import collections
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_209), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__AlignedRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":10
+ * import itertools
+ * import struct
+ * import ctypes             # <<<<<<<<<<<<<<
+ * import collections
+ * import re
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__opt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":11
+ * import struct
+ * import ctypes
+ * import collections             # <<<<<<<<<<<<<<
+ * import re
+ * import platform
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_210), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__AlignedRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":12
+ * import ctypes
+ * import collections
+ * import re             # <<<<<<<<<<<<<<
+ * import platform
+ * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fancy_str); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":13
+ * import collections
+ * import re
+ * import platform             # <<<<<<<<<<<<<<
+ * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
+ * from cpython cimport PyErr_SetString
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__platform), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_211), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__platform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":63
+ * #####################################################################
+ * # hard-coded constants
+ * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"             # <<<<<<<<<<<<<<
+ * cdef int max_pos = 2 << 29
+ * 
+ */
+  __pyx_v_9csamtools_bam_nt16_rev_table = __pyx_k_229;
+
+  /* "csamtools.pyx":64
+ * # hard-coded constants
+ * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"
+ * cdef int max_pos = 2 << 29             # <<<<<<<<<<<<<<
+ * 
+ * # redirect stderr to 0
+ */
+  __pyx_v_9csamtools_max_pos = 1073741824;
+
+  /* "csamtools.pyx":67
+ * 
+ * # redirect stderr to 0
+ * _logfile = open(os.path.devnull, "w")             # <<<<<<<<<<<<<<
+ * pysam_set_stderr( PyFile_AsFile( _logfile ) )
+ * 
+ */
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__setdevice); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__devnull); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_212), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__setfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___logfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":68
+ * # redirect stderr to 0
+ * _logfile = open(os.path.devnull, "w")
+ * pysam_set_stderr( PyFile_AsFile( _logfile ) )             # <<<<<<<<<<<<<<
+ * 
+ * #####################################################################
+ */
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_213), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  pysam_set_stderr(PyFile_AsFile(__pyx_t_1));
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":117
+ *     (<object>f)(a)
+ * 
+ * class PileupColumn(object):             # <<<<<<<<<<<<<<
+ *     '''A pileup column. A pileup column contains
+ *     all the reads that map to a certain target base.
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+
+  /* "csamtools.pyx":130
+ *         list of reads (:class:`pysam.PileupRead`) aligned to this column
+ *     '''
+ *     def __str__(self):             # <<<<<<<<<<<<<<
+ *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
+ *             "\n" + "\n".join( map(str, self.pileups) )
+ */
+  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_12PileupColumn___str__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "csamtools.pyx":117
+ *     (<object>f)(a)
+ * 
+ * class PileupColumn(object):             # <<<<<<<<<<<<<<
+ *     '''A pileup column. A pileup column contains
+ *     all the reads that map to a certain target base.
+ */
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(__pyx_builtin_object);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
+  __Pyx_GIVEREF(__pyx_builtin_object);
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_230)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__PileupColumn, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PileupColumn, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "csamtools.pyx":174
+ *     return 0
+ * 
+ * class StderrStore():             # <<<<<<<<<<<<<<
+ *     '''
+ *     stderr is captured.
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+
+  /* "csamtools.pyx":178
+ *     stderr is captured.
+ *     '''
+ *     def __init__(self):             # <<<<<<<<<<<<<<
+ *         return
+ *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":184
+ *         self.stderr_save.setfd( self.stderr_h )
+ * 
+ *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
+ *         return []
+ *         self.stderr_save.restore()
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":193
+ *         return lines
+ * 
+ *     def release(self):             # <<<<<<<<<<<<<<
+ *         return
+ *         self.stderr_save.restore()
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":199
+ *             os.remove( self.stderr_f )
+ * 
+ *     def __del__(self):             # <<<<<<<<<<<<<<
+ *         self.release()
+ * 
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_3__del__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____del__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":174
+ *     return 0
+ * 
+ * class StderrStore():             # <<<<<<<<<<<<<<
+ *     '''
+ *     stderr is captured.
+ */
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_231)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStore, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "csamtools.pyx":202
+ *         self.release()
+ * 
+ * class StderrStoreWindows():             # <<<<<<<<<<<<<<
+ *     '''does nothing. stderr can't be redirected on windows'''
+ *     def __init__(self): pass
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+
+  /* "csamtools.pyx":204
+ * class StderrStoreWindows():
+ *     '''does nothing. stderr can't be redirected on windows'''
+ *     def __init__(self): pass             # <<<<<<<<<<<<<<
+ *     def readAndRelease(self): return []
+ *     def release(self): pass
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":205
+ *     '''does nothing. stderr can't be redirected on windows'''
+ *     def __init__(self): pass
+ *     def readAndRelease(self): return []             # <<<<<<<<<<<<<<
+ *     def release(self): pass
+ * 
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":206
+ *     def __init__(self): pass
+ *     def readAndRelease(self): return []
+ *     def release(self): pass             # <<<<<<<<<<<<<<
+ * 
+ * if platform.system()=='Windows':
+ */
+  __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":202
+ *         self.release()
+ * 
+ * class StderrStoreWindows():             # <<<<<<<<<<<<<<
+ *     '''does nothing. stderr can't be redirected on windows'''
+ *     def __init__(self): pass
+ */
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_232)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStoreWindows, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStoreWindows, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "csamtools.pyx":208
+ *     def release(self): pass
+ * 
+ * if platform.system()=='Windows':             # <<<<<<<<<<<<<<
+ *     del StderrStore
+ *     StderrStore = StderrStoreWindows
+ */
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__platform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__restore); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__system); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_214), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s___samtools_dispatch); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_4) {
+
+    /* "csamtools.pyx":209
+ * 
+ * if platform.system()=='Windows':
+ *     del StderrStore             # <<<<<<<<<<<<<<
+ *     StderrStore = StderrStoreWindows
+ * 
+ */
+    if (__Pyx_DelAttrString(__pyx_m, "StderrStore") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+    /* "csamtools.pyx":210
+ * if platform.system()=='Windows':
+ *     del StderrStore
+ *     StderrStore = StderrStoreWindows             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "csamtools.pyx":217
+ * ######################################################################
+ * # valid types for sam headers
+ * VALID_HEADER_TYPES = { "HD" : dict,             # <<<<<<<<<<<<<<
+ *                        "SQ" : list,
+ *                        "RG" : list,
+ */
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":218
+ * # valid types for sam headers
+ * VALID_HEADER_TYPES = { "HD" : dict,
+ *                        "SQ" : list,             # <<<<<<<<<<<<<<
+ *                        "RG" : list,
+ *                        "PG" : list,
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":219
+ * VALID_HEADER_TYPES = { "HD" : dict,
+ *                        "SQ" : list,
+ *                        "RG" : list,             # <<<<<<<<<<<<<<
+ *                        "PG" : list,
+ *                        "CO" : list }
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":220
+ *                        "SQ" : list,
+ *                        "RG" : list,
+ *                        "PG" : list,             # <<<<<<<<<<<<<<
+ *                        "CO" : list }
+ * 
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":221
+ *                        "RG" : list,
+ *                        "PG" : list,
+ *                        "CO" : list }             # <<<<<<<<<<<<<<
+ * 
+ * # order of records within sam headers
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":224
+ * 
+ * # order of records within sam headers
+ * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" )             # <<<<<<<<<<<<<<
+ * 
+ * # type conversions within sam header records
+ */
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_233)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":227
+ * 
+ * # type conversions within sam header records
+ * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },             # <<<<<<<<<<<<<<
+ *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
+ *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
+ */
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "csamtools.pyx":228
+ * # type conversions within sam header records
+ * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
+ *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },             # <<<<<<<<<<<<<<
+ *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
+ *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "csamtools.pyx":229
+ * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
+ *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
+ *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },             # <<<<<<<<<<<<<<
+ *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
+ * 
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SM), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LB), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PU), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DT), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "csamtools.pyx":230
+ *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
+ *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
+ *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }             # <<<<<<<<<<<<<<
+ * 
+ * # output order of fields within records
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":233
+ * 
+ * # output order of fields within records
+ * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),             # <<<<<<<<<<<<<<
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
+ */
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_234)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":234
+ * # output order of fields within records
+ * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),             # <<<<<<<<<<<<<<
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_235)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":235
+ * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),             # <<<<<<<<<<<<<<
+ *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ * 
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_236)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":236
+ *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL" ), }             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_237)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":485
+ *                header = None,
+ *                port = None,
+ *                add_sq_text = True,             # <<<<<<<<<<<<<<
+ *               ):
+ *         '''open a sam/bam file.
+ */
+  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_16 = __pyx_t_3;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":744
+ *                region = None,
+ *                callback = None,
+ *                until_eof = False ):             # <<<<<<<<<<<<<<
+ *         '''
+ *         fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by
+ */
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_44 = __pyx_t_3;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":861
+ *                end = None,
+ *                region = None,
+ *                until_eof = False ):             # <<<<<<<<<<<<<<
+ *         '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
+ * 
+ */
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_62 = __pyx_t_3;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":1783
+ *                   int tid = 0,
+ *                   int start = 0,
+ *                   int end = max_pos,             # <<<<<<<<<<<<<<
+ *                   **kwargs ):
+ * 
+ */
+  __pyx_k_115 = __pyx_v_9csamtools_max_pos;
+
+  /* "csamtools.pyx":2785
+ *             return self._level
+ * 
+ * class Outs:             # <<<<<<<<<<<<<<
+ *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
+ *     def __init__(self, id = 1):
+ */
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+
+  /* "csamtools.pyx":2787
+ * class Outs:
+ *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
+ *     def __init__(self, id = 1):             # <<<<<<<<<<<<<<
+ *         self.streams = []
+ *         self.id = id
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_215), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorSNPCalls); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____next__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":2791
+ *         self.id = id
+ * 
+ *     def setdevice(self, filename):             # <<<<<<<<<<<<<<
+ *         '''open an existing file, like "/dev/null"'''
+ *         fd = os.open(filename, os.O_WRONLY)
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_1setdevice, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setdevice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_216), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__SNPCaller); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__call); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":2796
+ *         self.setfd(fd)
+ * 
+ *     def setfile(self, filename):             # <<<<<<<<<<<<<<
+ *         '''open a new file.'''
+ *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_2setfile, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_217), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IndelCaller); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__call); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":2801
+ *         self.setfd(fd)
+ * 
+ *     def setfd(self, fd):             # <<<<<<<<<<<<<<
+ *         ofd = os.dup(self.id)      #  Save old stream on new unit.
+ *         self.streams.append(ofd)
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_3setfd, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setfd, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_218), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IteratorIndelCalls); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s____next__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":2809
+ *         os.close(fd)                #  Close other unit (look out, caller.)
+ * 
+ *     def restore(self):             # <<<<<<<<<<<<<<
+ *         '''restore previous output stream'''
+ *         if self.streams:
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_4restore, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__restore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_219), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s__IndexedReads); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "csamtools.pyx":2785
+ *             return self._level
+ * 
+ * class Outs:             # <<<<<<<<<<<<<<
+ *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
+ *     def __init__(self, id = 1):
+ */
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_238)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3), __pyx_n_s__Outs, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_1, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_220), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":2822
+ * def _samtools_dispatch( method,
+ *                         args = (),
+ *                         catch_stdout = True,             # <<<<<<<<<<<<<<
+ *                         catch_stderr = False,
+ *                         ):
+ */
+  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_160 = __pyx_t_3;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":2823
+ *                         args = (),
+ *                         catch_stdout = True,
+ *                         catch_stderr = False,             # <<<<<<<<<<<<<<
+ *                         ):
+ *     '''call ``method`` in samtools providing arguments in args.
+ */
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_k_161 = __pyx_t_3;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":2820
+ *             del self.streams[-1]
+ * 
+ * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
+ *                         args = (),
+ *                         catch_stdout = True,
+ */
+  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9csamtools__samtools_dispatch, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___samtools_dispatch, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":3522
+ *         if self.owns_samfile: samclose( self.fp )
+ * 
+ * __all__ = ["Samfile",             # <<<<<<<<<<<<<<
+ *            "Fastafile",
+ *            "IteratorRow",
+ */
+  __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile));
+  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__Samfile));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__Fastafile));
+  PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Fastafile));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Fastafile));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorRow));
+  PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__IteratorRow));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorRow));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorColumn));
+  PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__IteratorColumn));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorColumn));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__AlignedRead));
+  PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__AlignedRead));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AlignedRead));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupColumn));
+  PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_n_s__PileupColumn));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupColumn));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupProxy));
+  PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s__PileupProxy));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupProxy));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupRead));
+  PyList_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_n_s__PileupRead));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupRead));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__IndexedReads));
+  PyList_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_n_s__IndexedReads));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndexedReads));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  /* "csamtools.pyx":1
+ * # cython: embedsignature=True             # <<<<<<<<<<<<<<
+ * # cython: profile=True
+ * # adds doc-strings for sphinx
+ */
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/Cython-0.13-py2.7-linux-x86_64.egg/Cython/Includes/cpython/type.pxd":2
+  /* "cpython/type.pxd":2
  * 
  * cdef extern from "Python.h":             # <<<<<<<<<<<<<<
  *     # The C structure of the objects used to describe built-in types.
@@ -37718,7 +33526,6 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
   if (__pyx_m) {
     __Pyx_AddTraceback("init csamtools");
     Py_DECREF(__pyx_m); __pyx_m = 0;
@@ -37805,10 +33612,10 @@ static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const cha
         __pyx_empty_bytes   /*PyObject *lnotab*/
     );
 
-bad: 
+bad:
     Py_XDECREF(py_srcfile);
     Py_XDECREF(py_funcname);
-    
+
     return py_code;
 }
 
@@ -37902,47 +33709,154 @@ invalid_keyword:
     return 0;
 }
 
-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);
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+
+    tmp_type = tstate->curexc_type;
+    tmp_value = tstate->curexc_value;
+    tmp_tb = tstate->curexc_traceback;
+    tstate->curexc_type = type;
+    tstate->curexc_value = value;
+    tstate->curexc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+}
+
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->curexc_type;
+    *value = tstate->curexc_value;
+    *tb = tstate->curexc_traceback;
+
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+}
+
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    Py_XINCREF(type);
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    /* Next, replace a missing value with None */
+    if (value == NULL) {
+        value = Py_None;
+        Py_INCREF(value);
+    }
+    #if PY_VERSION_HEX < 0x02050000
+    if (!PyClass_Check(type))
+    #else
+    if (!PyType_Check(type))
+    #endif
+    {
+        /* Raising an instance.  The value should be a dummy. */
+        if (value != Py_None) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto raise_error;
+        }
+        /* Normalize to raise <class>, <instance> */
+        Py_DECREF(value);
+        value = type;
+        #if PY_VERSION_HEX < 0x02050000
+            if (PyInstance_Check(type)) {
+                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+                Py_INCREF(type);
+            }
+            else {
+                type = 0;
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception must be an old-style class or instance");
+                goto raise_error;
+            }
         #else
-        "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AS_STRING(kw_name));
+            type = (PyObject*) Py_TYPE(type);
+            Py_INCREF(type);
+            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception class must be a subclass of BaseException");
+                goto raise_error;
+            }
         #endif
+    }
+
+    __Pyx_ErrRestore(type, value, tb);
+    return;
+raise_error:
+    Py_XDECREF(value);
+    Py_XDECREF(type);
+    Py_XDECREF(tb);
+    return;
 }
 
-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 *number, *more_or_less;
+#else /* Python 3+ */
 
-    if (num_found < num_min) {
-        num_expected = num_min;
-        more_or_less = "at least";
-    } else {
-        num_expected = num_max;
-        more_or_less = "at most";
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    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 (exact) {
-        more_or_less = "exactly";
+    if (value == Py_None)
+        value = 0;
+
+    if (PyExceptionInstance_Check(type)) {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto bad;
+        }
+        value = type;
+        type = (PyObject*) Py_TYPE(value);
+    } else if (!PyExceptionClass_Check(type)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: exception class must be a subclass of BaseException");
+        goto bad;
     }
-    number = (num_expected == 1) ? "" : "s";
-    PyErr_Format(PyExc_TypeError,
-        #if PY_VERSION_HEX < 0x02050000
-            "%s() takes %s %d positional argument%s (%d given)",
+
+    PyErr_SetObject(type, value);
+
+    if (tb) {
+        PyThreadState *tstate = PyThreadState_GET();
+        PyObject* tmp_tb = tstate->curexc_traceback;
+        if (tb != tmp_tb) {
+            Py_INCREF(tb);
+            tstate->curexc_traceback = tb;
+            Py_XDECREF(tmp_tb);
+        }
+    }
+
+bad:
+    return;
+}
+#endif
+
+static 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() takes %s %zd positional argument%s (%zd given)",
+        "%s() got multiple values for keyword argument '%s'", func_name,
+        PyString_AS_STRING(kw_name));
         #endif
-        func_name, more_or_less, num_expected, number, num_found);
 }
 
 static int __Pyx_ParseOptionalKeywords(
@@ -38024,33 +33938,36 @@ bad:
     return -1;
 }
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-
-    tmp_type = tstate->curexc_type;
-    tmp_value = tstate->curexc_value;
-    tmp_tb = tstate->curexc_traceback;
-    tstate->curexc_type = type;
-    tstate->curexc_value = value;
-    tstate->curexc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-}
-
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->curexc_type;
-    *value = tstate->curexc_value;
-    *tb = tstate->curexc_traceback;
+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 *number, *more_or_less;
 
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
+    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";
+    }
+    number = (num_expected == 1) ? "" : "s";
+    PyErr_Format(PyExc_TypeError,
+        #if PY_VERSION_HEX < 0x02050000
+            "%s() takes %s %d positional argument%s (%d given)",
+        #else
+            "%s() takes %s %zd positional argument%s (%zd given)",
+        #endif
+        func_name, more_or_less, num_expected, number, num_found);
 }
 
-
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact)
 {
@@ -38118,10 +34035,6 @@ bad:
 
 
 
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-}
-
 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
 }
@@ -38197,31 +34110,92 @@ bad:
     return module;
 }
 
-static PyObject *__Pyx_CreateClass(
-    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
-{
-    PyObject *py_modname;
-    PyObject *result = 0;
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
+    PyObject *metaclass;
+    /* Default metaclass */
+#if PY_MAJOR_VERSION < 3
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = PyObject_GetAttrString(base, "__class__");
+        if (!metaclass) {
+            PyErr_Clear();
+            metaclass = (PyObject*) Py_TYPE(base);
+        }
+    } else {
+        metaclass = (PyObject *) &PyClass_Type;
+    }
+#else
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = (PyObject*) Py_TYPE(base);
+    } else {
+        metaclass = (PyObject *) &PyType_Type;
+    }
+#endif
+    Py_INCREF(metaclass);
+    return metaclass;
+}
 
-    #if PY_MAJOR_VERSION < 3
-    py_modname = PyString_FromString(modname);
-    #else
-    py_modname = PyUnicode_FromString(modname);
-    #endif
-    if (!py_modname)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
-        goto bad;
-    #if PY_MAJOR_VERSION < 3
-    result = PyClass_New(bases, dict, name);
-    #else
-    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
-    #endif
-bad:
-    Py_XDECREF(py_modname);
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *modname) {
+    PyObject *result;
+    PyObject *metaclass;
+
+    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
+        return NULL;
+
+    /* Python2 __metaclass__ */
+    metaclass = PyDict_GetItemString(dict, "__metaclass__");
+    if (metaclass) {
+        Py_INCREF(metaclass);
+    } else {
+        metaclass = __Pyx_FindPy2Metaclass(bases);
+    }
+    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
+    Py_DECREF(metaclass);
     return result;
 }
 
+
+static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
+       __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
+    if (op == NULL)
+        return NULL;
+       op->func.m_ml = ml;
+       Py_XINCREF(self);
+       op->func.m_self = self;
+       Py_XINCREF(module);
+       op->func.m_module = module;
+       PyObject_GC_Track(op);
+       return (PyObject *)op;
+}
+
+static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
+       PyObject_GC_UnTrack(m);
+       Py_XDECREF(m->func.m_self);
+       Py_XDECREF(m->func.m_module);
+    PyObject_GC_Del(m);
+}
+
+static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
+       if (obj == Py_None)
+               obj = NULL;
+       return PyMethod_New(func, obj, type);
+}
+
+static int __pyx_binding_PyCFunctionType_init(void) {
+    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
+    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
+    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
+    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
+    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
+        return -1;
+    }
+    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
+    return 0;
+
+}
+
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -38247,116 +34221,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     }
 }
 
-#if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    Py_XINCREF(type);
-    Py_XINCREF(value);
-    Py_XINCREF(tb);
-    /* First, check the traceback argument, replacing None with NULL. */
-    if (tb == Py_None) {
-        Py_DECREF(tb);
-        tb = 0;
-    }
-    else if (tb != NULL && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto raise_error;
-    }
-    /* Next, replace a missing value with None */
-    if (value == NULL) {
-        value = Py_None;
-        Py_INCREF(value);
-    }
-    #if PY_VERSION_HEX < 0x02050000
-    if (!PyClass_Check(type))
-    #else
-    if (!PyType_Check(type))
-    #endif
-    {
-        /* Raising an instance.  The value should be a dummy. */
-        if (value != Py_None) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto raise_error;
-        }
-        /* Normalize to raise <class>, <instance> */
-        Py_DECREF(value);
-        value = type;
-        #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
-            Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
-        #endif
-    }
-
-    __Pyx_ErrRestore(type, value, tb);
-    return;
-raise_error:
-    Py_XDECREF(value);
-    Py_XDECREF(type);
-    Py_XDECREF(tb);
-    return;
-}
-
-#else /* Python 3+ */
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    if (tb == Py_None) {
-        tb = 0;
-    } else if (tb && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto bad;
-    }
-    if (value == Py_None)
-        value = 0;
-
-    if (PyExceptionInstance_Check(type)) {
-        if (value) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto bad;
-        }
-        value = type;
-        type = (PyObject*) Py_TYPE(value);
-    } else if (!PyExceptionClass_Check(type)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: exception class must be a subclass of BaseException");
-        goto bad;
-    }
-
-    PyErr_SetObject(type, value);
-
-    if (tb) {
-        PyThreadState *tstate = PyThreadState_GET();
-        PyObject* tmp_tb = tstate->curexc_traceback;
-        if (tb != tmp_tb) {
-            Py_INCREF(tb);
-            tstate->curexc_traceback = tb;
-            Py_XDECREF(tmp_tb);
-        }
-    }
-
-bad:
-    return;
-}
-#endif
-
 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) {
     const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -38588,143 +34452,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t val) {
     }
 }
 
-#if PY_MAJOR_VERSION < 3
-static PyObject *__Pyx_GetStdout(void) {
-    PyObject *f = PySys_GetObject((char *)"stdout");
-    if (!f) {
-        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
-    }
-    return f;
-}
-
-static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
-    PyObject* v;
-    int i;
-
-    if (!f) {
-        if (!(f = __Pyx_GetStdout()))
-            return -1;
-    }
-    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
-        if (PyFile_SoftSpace(f, 1)) {
-            if (PyFile_WriteString(" ", f) < 0)
-                return -1;
-        }
-        v = PyTuple_GET_ITEM(arg_tuple, i);
-        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
-            return -1;
-        if (PyString_Check(v)) {
-            char *s = PyString_AsString(v);
-            Py_ssize_t len = PyString_Size(v);
-            if (len > 0 &&
-                isspace(Py_CHARMASK(s[len-1])) &&
-                s[len-1] != ' ')
-                    PyFile_SoftSpace(f, 0);
-        }
-    }
-    if (newline) {
-        if (PyFile_WriteString("\n", f) < 0)
-            return -1;
-        PyFile_SoftSpace(f, 0);
-    }
-    return 0;
-}
-
-#else /* Python 3 has a print function */
-
-static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
-    PyObject* kwargs = 0;
-    PyObject* result = 0;
-    PyObject* end_string;
-    if (unlikely(!__pyx_print)) {
-        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
-        if (!__pyx_print)
-            return -1;
-    }
-    if (stream) {
-        kwargs = PyDict_New();
-        if (unlikely(!kwargs))
-            return -1;
-        if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
-            goto bad;
-        if (!newline) {
-            end_string = PyUnicode_FromStringAndSize(" ", 1);
-            if (unlikely(!end_string))
-                goto bad;
-            if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
-                Py_DECREF(end_string);
-                goto bad;
-            }
-            Py_DECREF(end_string);
-        }
-    } else if (!newline) {
-        if (unlikely(!__pyx_print_kwargs)) {
-            __pyx_print_kwargs = PyDict_New();
-            if (unlikely(!__pyx_print_kwargs))
-                return -1;
-            end_string = PyUnicode_FromStringAndSize(" ", 1);
-            if (unlikely(!end_string))
-                return -1;
-            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
-                Py_DECREF(end_string);
-                return -1;
-            }
-            Py_DECREF(end_string);
-        }
-        kwargs = __pyx_print_kwargs;
-    }
-    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
-    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
-        Py_DECREF(kwargs);
-    if (!result)
-        return -1;
-    Py_DECREF(result);
-    return 0;
-bad:
-    if (kwargs != __pyx_print_kwargs)
-        Py_XDECREF(kwargs);
-    return -1;
-}
-
-#endif
-
-#if PY_MAJOR_VERSION < 3
-
-static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
-    if (!f) {
-        if (!(f = __Pyx_GetStdout()))
-            return -1;
-    }
-    if (PyFile_SoftSpace(f, 0)) {
-        if (PyFile_WriteString(" ", f) < 0)
-            return -1;
-    }
-    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
-        return -1;
-    if (PyFile_WriteString("\n", f) < 0)
-        return -1;
-    return 0;
-    /* the line below is just to avoid compiler
-     * compiler warnings about unused functions */
-    return __Pyx_Print(f, NULL, 0);
-}
-
-#else /* Python 3 has a print function */
-
-static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
-    int res;
-    PyObject* arg_tuple = PyTuple_New(1);
-    if (unlikely(!arg_tuple))
-        return -1;
-    Py_INCREF(o);
-    PyTuple_SET_ITEM(arg_tuple, 0, o);
-    res = __Pyx_Print(stream, arg_tuple, 1);
-    Py_DECREF(arg_tuple);
-    return res;
-}
-
-#endif
-
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t val) {
     const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -39196,13 +34923,13 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     if (!result)
         goto bad;
     if (!PyType_Check(result)) {
-        PyErr_Format(PyExc_TypeError, 
+        PyErr_Format(PyExc_TypeError,
             "%s.%s is not a type object",
             module_name, class_name);
         goto bad;
     }
     if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
-        PyOS_snprintf(warning, sizeof(warning), 
+        PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
         #if PY_VERSION_HEX < 0x02050000
@@ -39212,7 +34939,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         #endif
     }
     else if (((PyTypeObject *)result)->tp_basicsize != size) {
-        PyErr_Format(PyExc_ValueError, 
+        PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
         goto bad;
index df3763802d7ee5742a5379acbfc43b4d052ddf6d..4ec74e3693c86aea8cc7052db6ace9a770c6bb6d 100644 (file)
@@ -126,7 +126,8 @@ cdef extern from "bam.h":
      char *text
 
   ctypedef struct bam_index_t:
-      pass
+      int32_t n
+      uint64_t n_no_coor
 
   ctypedef struct bam_plbuf_t:
       pass
@@ -203,6 +204,7 @@ cdef extern from "bam.h":
   void bam_plp_set_mask(bam_plp_t iter, int mask)
   void bam_plp_reset(bam_plp_t iter)
   void bam_plp_destroy(bam_plp_t iter)
+  void bam_plp_set_maxcnt(bam_plp_t iter, int maxcnt)
 
   ##################################################
 
@@ -263,67 +265,67 @@ cdef extern from "sam.h":
   int bam_cap_mapQ(bam1_t *b, char *ref, int thres)
 
 
-cdef extern from "glf.h":
-   ctypedef struct glf1_t:
-      pass
-
-cdef extern from "bam_maqcns.h":
-
-  ctypedef struct bam_maqcns_t:
-     float het_rate, theta
-     int n_hap, cap_mapQ, errmod, min_baseQ
-     float eta, q_r
-     double *fk, *coef
-     double *lhet
-     void *aux
-
-  glf1_t *bam_maqcns_glfgen(int n, 
-                            bam_pileup1_t *pl, 
-                            uint8_t ref_base, 
-                            bam_maqcns_t *bm)
-
-  ctypedef struct bam_maqindel_opt_t:
-      int q_indel
-      float r_indel
-      float r_snp
-      int mm_penalty, indel_err, ambi_thres
+#cdef extern from "glf.h":
+#   ctypedef struct glf1_t:
+#      pass
+
+#cdef extern from "bam_maqcns.h":
+#
+#  ctypedef struct bam_maqcns_t:
+#     float het_rate, theta
+#     int n_hap, cap_mapQ, errmod, min_baseQ
+#     float eta, q_r
+#     double *fk, *coef
+#     double *lhet
+#     void *aux
+
+#  glf1_t *bam_maqcns_glfgen(int n, 
+#                            bam_pileup1_t *pl, 
+#                            uint8_t ref_base, 
+#                            bam_maqcns_t *bm)
+
+#  ctypedef struct bam_maqindel_opt_t:
+#      int q_indel
+#      float r_indel
+#      float r_snp
+#      int mm_penalty, indel_err, ambi_thres
      
-  uint32_t bam_maqcns_call(int n, bam_pileup1_t *pl, bam_maqcns_t *bm)
-  bam_maqcns_t * bam_maqcns_init()
-  void bam_maqcns_destroy(bam_maqcns_t *bm)
-  void bam_maqcns_prepare(bam_maqcns_t *bm)
+#  uint32_t bam_maqcns_call(int n, bam_pileup1_t *pl, bam_maqcns_t *bm)
+#  bam_maqcns_t * bam_maqcns_init()
+#  void bam_maqcns_destroy(bam_maqcns_t *bm)
+#  void bam_maqcns_prepare(bam_maqcns_t *bm)
   
-  uint32_t glf2cns(glf1_t *g, int q_r)
-
-  int BAM_ERRMOD_MAQ2
-  int BAM_ERRMOD_MAQ
-  int BAM_ERRMOD_SOAP
-
-  ctypedef struct bam_maqindel_ret_t: 
-    int indel1
-    int indel2        
-    int cnt1
-    int cnt2
-    int cnt_anti
-    int cnt_ref
-    int cnt_ambi
-    char *s[2]
-    int gt
-    int gl[2]
-    int q_cns
-    int q_ref
+#  uint32_t glf2cns(glf1_t *g, int q_r)
+
+#  int BAM_ERRMOD_MAQ2
+#  int BAM_ERRMOD_MAQ
+#  int BAM_ERRMOD_SOAP
+
+#  ctypedef struct bam_maqindel_ret_t: 
+#    int indel1
+#    int indel2        
+#    int cnt1
+#    int cnt2
+#    int cnt_anti
+#    int cnt_ref
+#    int cnt_ambi
+#    char *s[2]
+#    int gt
+#    int gl[2]
+#    int q_cns
+#    int q_ref
     
-  void bam_maqindel_ret_destroy( bam_maqindel_ret_t * )
+#  void bam_maqindel_ret_destroy( bam_maqindel_ret_t * )
 
-  bam_maqindel_opt_t *bam_maqindel_opt_init()
+#  bam_maqindel_opt_t *bam_maqindel_opt_init()
 
-  bam_maqindel_ret_t * bam_maqindel(int n, 
-                    int pos, 
-                    bam_maqindel_opt_t * mi, 
-                    bam_pileup1_t * pl, 
-                    char *ref,
-                    int _n_types, 
-                    int * _types )
+#  bam_maqindel_ret_t * bam_maqindel(int n, 
+#                   int pos, 
+#                   bam_maqindel_opt_t * mi, 
+#                   bam_pileup1_t * pl, 
+#                   char *ref,
+#                   int _n_types, 
+#                   int * _types )
                                                                
 
 cdef extern from "faidx.h":
@@ -375,9 +377,13 @@ cdef extern from "pysam_util.h":
 
     void pysam_set_stderr( FILE * file )
 
-    uint32_t pysam_glf_depth( glf1_t * g )
+    # return mapped/unmapped reads on tid
+    uint32_t pysam_get_mapped( bam_index_t *idx, int tid )
+    uint32_t pysam_get_unmapped( bam_index_t *idx, int tid )
+
+#    uint32_t pysam_glf_depth( glf1_t * g )
 
-    void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c )
+#    void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c )
 
 # need to declare all C fields and methods here
 cdef class AlignedRead:
@@ -393,6 +399,8 @@ cdef class Samfile:
     cdef bam_index_t *index
     # true if file is a bam file
     cdef int isbam
+    # true if not a file but a stream
+    cdef int isstream
     # true if file is not on the local filesystem
     cdef int isremote
     # current read within iteration
@@ -400,6 +408,9 @@ cdef class Samfile:
     # file opening mode
     cdef char * mode
 
+    # beginning of read section
+    cdef int64_t start_offset 
+
     cdef bam_header_t * _buildHeader( self, new_header )
     cdef bam1_t * getCurrent( self )
     cdef int cnext(self)
@@ -409,3 +420,17 @@ cdef class Samfile:
 
     cdef char * _getrname( self, int tid )
 
+cdef class IteratorRow:
+    pass
+
+cdef class IteratorRowAll(IteratorRow):
+    cdef bam1_t * b
+    cdef samfile_t * fp
+    # true if samfile belongs to this object
+    cdef int owns_samfile
+
+    cdef bam1_t * getCurrent( self )
+
+    cdef int cnext(self)
+
+
index 471a445bed09a53bb137f9f2023ef56879d5b5fc..ddd599889b4525548417a43246de4c408d8faaea 100644 (file)
@@ -413,7 +413,8 @@ cdef int mate_callback( bam1_t *alignment, void *f):
 
 
 cdef class Samfile:
-    '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None)*
+    '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,
+         add_sq_text = False )*
               
     A :term:`SAM`/:term:`BAM` formatted file. The file is automatically opened.
     
@@ -427,11 +428,11 @@ cdef class Samfile:
 
         f = pysam.Samfile('ex1.bam','rb')
 
-    If mode is not specified, we will try to auto-detect in the order 'r', 'rb', thus both the following
+    If mode is not specified, we will try to auto-detect in the order 'rb', 'r', thus both the following
     should work::
 
         f1 = pysam.Samfile('ex1.bam' )
-        f2 = pysam.Samfile('ex1.bam' )
+        f2 = pysam.Samfile('ex1.sam' )
 
     If an index for a BAM file exists (.bai), it will be opened automatically. Without an index random
     access to reads via :meth:`fetch` and :meth:`pileup` is disabled.
@@ -449,6 +450,8 @@ cdef class Samfile:
         3. If *text* is given, new header text is copied from raw text.
 
         4. The names (*referencenames*) and lengths (*referencelengths*) are supplied directly as lists. 
+           By default, 'SQ' and 'LN' tags will be added to the header text. This option can be
+           changed by unsetting the flag *add_sq_text*. 
 
     '''
 
@@ -456,6 +459,7 @@ cdef class Samfile:
         self.samfile = NULL
         self._filename = NULL
         self.isbam = False
+        self.isstream = False
         self._open( *args, **kwargs )
 
         # allocate memory for iterator
@@ -478,6 +482,7 @@ cdef class Samfile:
                text = None,
                header = None,
                port = None,
+               add_sq_text = True,
               ):
         '''open a sam/bam file.
 
@@ -488,20 +493,21 @@ cdef class Samfile:
         # read mode autodetection
         if mode is None:
             try:
-                self._open(filename, 'r', template=template,
+                self._open(filename, 'rb', template=template,
                            referencenames=referencenames,
                            referencelengths=referencelengths,
                            text=text, header=header, port=port)
                 return
             except ValueError, msg:
                 pass
-            self._open(filename, 'rb', template=template,
+            
+            self._open(filename, 'r', template=template,
                        referencenames=referencenames,
                        referencelengths=referencelengths,
                        text=text, header=header, port=port)
             return
 
-        assert mode in ( "r","w","rb","wb", "wh", "wbu" ), "invalid file opening mode `%s`" % mode
+        assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode
         assert filename != NULL
 
         # close a previously opened file
@@ -513,6 +519,7 @@ cdef class Samfile:
         
         if self._filename != NULL: free(self._filename )
         self._filename = strdup( filename )
+        self.isstream = strcmp( filename, "-" ) == 0
 
         self.isbam = len(mode) > 1 and mode[1] == 'b'
 
@@ -551,6 +558,13 @@ cdef class Samfile:
                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
                     strncpy( header_to_write.target_name[x], name, len(name) )
 
+                # Optionally, if there is no text, add a SAM compatible header to output
+                # file.
+                if text is None and add_sq_text:
+                    text = ''
+                    for x from 0 <= x < header_to_write.n_targets:
+                        text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
+
                 if text != None:
                     # copy without \0
                     ctext = text
@@ -587,8 +601,9 @@ cdef class Samfile:
                 raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode )
             
             #disabled for autodetection to work
-            if self.samfile.header.n_targets == 0:
-                raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
+            # needs to be disabled so that reading from sam-files without headers works
+            #if self.samfile.header.n_targets == 0:
+            #    raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
 
         if self.samfile == NULL:
             raise IOError("could not open file `%s`" % filename )
@@ -608,7 +623,10 @@ cdef class Samfile:
                 self.index = bam_index_load(filename)
                 if self.index == NULL:
                     raise IOError("error while opening index `%s` " % filename )
-                                    
+
+            if not self.isstream:
+                self.start_offset = bam_tell( self.samfile.x.bam )
+
     def gettid( self, reference ):
         '''
         convert :term:`reference` name into numerical :term:`tid`
@@ -688,6 +706,10 @@ cdef class Samfile:
 
         return 1, rtid, rstart, rend
     
+    def reset( self ):
+        '''reset file position to beginning of read section.'''
+        return self.seek( self.start_offset, 0 )
+
     def seek( self, uint64_t offset, int where = 0):
         '''
         move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.
@@ -697,6 +719,9 @@ cdef class Samfile:
             raise ValueError( "I/O operation on closed file" )
         if not self.isbam:
             raise NotImplementedError("seek only available in bam files")
+        if self.isstream:
+            raise OSError("seek no available in streams")
+        
         return bam_seek( self.samfile.x.bam, offset, where )
 
     def tell( self ):
@@ -722,10 +747,11 @@ cdef class Samfile:
         :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can 
         be supplied.
 
-        Without *reference* or *region* all reads will be fetched. The reads will be returned
+        Without *reference* or *region* all mapped reads will be fetched. The reads will be returned
         ordered by reference sequence, which will not necessarily be the order within the file.
+
         If *until_eof* is given, all reads from the current file position will be returned
-        *in order as they are within the file*.  
+        in order as they are within the file. Using this option will also fetch unmapped reads. 
         
         If only *reference* is set, all reads aligned to *reference* will be fetched.
 
@@ -744,6 +770,9 @@ cdef class Samfile:
 
         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
         
+        if self.isstream: reopen = False
+        else: reopen = True
+
         if self.isbam:
             if not until_eof and not self._hasIndex() and not self.isremote: 
                 raise ValueError( "fetch called on bamfile without index" )
@@ -760,24 +789,26 @@ cdef class Samfile:
                                  fetch_callback )
             else:
                 if has_coord:
-                    return IteratorRowRegion( self, rtid, rstart, rend )
+                    return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
                 else:
                     if until_eof:
-                        return IteratorRowAll( self )
+                        return IteratorRowAll( self, reopen=reopen )
                     else:
-                        return IteratorRowAllRefs(self)
+                        # AH: check - reason why no reopen for AllRefs?
+                        return IteratorRowAllRefs(self ) # , reopen=reopen )
         else:   
             # check if header is present - otherwise sam_read1 aborts
             # this happens if a bamfile is opened with mode 'r'
+            if has_coord:
+                raise ValueError ("fetching by region is not available for sam files" )
+
             if self.samfile.header.n_targets == 0:
                 raise ValueError( "fetch called for samfile without header")
-                  
-            if region != None:
-                raise ValueError ("fetch for a region is not available for sam files" )
+
             if callback:
                 raise NotImplementedError( "callback not implemented yet" )
             else:
-                return IteratorRowAll( self )
+                return IteratorRowAll( self, reopen=reopen )
 
     def mate( self, 
               AlignedRead read ):
@@ -905,15 +936,14 @@ cdef class Samfile:
          mask
            Skip all reads with bits set in mask.
 
+         max_depth
+           Maximum read depth permitted. The default limit is *8000*.
 
         .. note::
 
             *all* reads which overlap the region are returned. The first base returned will be the 
             first base of the first read *not* necessarily the first base of the region used in the query.
 
-            The maximum number of reads considered for pileup is *8000*. This limit is set by
-            :term:`csamtools`.
-
         '''
         cdef int rtid, rstart, rend, has_coord
         cdef bam_plbuf_t *buf
@@ -1021,6 +1051,33 @@ cdef class Samfile:
                 t.append( self.samfile.header.target_len[x] )
             return tuple(t)
 
+    property mapped:
+        """total number of mapped reads in file.
+        """
+        def __get__(self):
+            if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+            if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
+            
+            cdef int tid
+            cdef uint32_t total = 0
+            for tid from 0 <= tid < self.samfile.header.n_targets:
+                total += pysam_get_mapped( self.index, tid )
+            return total
+
+    property unmapped:
+        """total number of unmapped reads in file.
+        """
+        def __get__(self):
+            if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+            if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
+            cdef int tid
+            cdef uint32_t total = 0
+            for tid from 0 <= tid < self.samfile.header.n_targets:
+                total += pysam_get_unmapped( self.index, tid )
+            # get unmapped reads without coordinates
+            total += pysam_get_unmapped( self.index, -1 )
+            return total
+
     property text:
         '''full contents of the :term:`sam file` header as a string.'''
         def __get__(self):
@@ -1158,6 +1215,8 @@ cdef class Samfile:
     ###############################################################
     def __iter__(self):
         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+        if not self.isbam and self.samfile.header.n_targets == 0:
+                raise NotImplementedError( "can not iterate over samfile without header")
         return self 
 
     cdef bam1_t * getCurrent( self ):
@@ -1299,10 +1358,10 @@ cdef class IteratorRowAll(IteratorRow):
     to not re-open *samfile*.
     """
 
-    cdef bam1_t * b
-    cdef samfile_t * fp
-    # true if samfile belongs to this object
-    cdef int owns_samfile
+    cdef bam1_t * b
+    cdef samfile_t * fp
+    # true if samfile belongs to this object
+    cdef int owns_samfile
 
     def __cinit__(self, Samfile samfile, int reopen = True ):
 
@@ -1579,8 +1638,8 @@ cdef class IteratorColumn:
        A :class:`FastaFile` object
     mask
        Skip all reads with bits set in mask.
-       
-    
+    max_depth
+       maximum read depth. The default is 8000.
     '''
 
     # result of the last plbuf_push
@@ -1595,12 +1654,14 @@ cdef class IteratorColumn:
     cdef Samfile samfile
     cdef Fastafile fastafile
     cdef stepper
+    cdef int max_depth
 
     def __cinit__( self, Samfile samfile, **kwargs ):
         self.samfile = samfile
         self.mask = kwargs.get("mask", BAM_DEF_MASK )
         self.fastafile = kwargs.get( "fastafile", None )
         self.stepper = kwargs.get( "stepper", None )
+        self.max_depth = kwargs.get( "max_depth", 8000 )
         self.iterdata.seq = NULL
         self.tid = 0
         self.pos = 0
@@ -1608,6 +1669,7 @@ cdef class IteratorColumn:
         self.plp = NULL
         self.pileup_iter = <bam_plp_t>NULL
 
+
     def __iter__(self):
         return self 
 
@@ -1677,6 +1739,9 @@ cdef class IteratorColumn:
         else:
             raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
 
+        if self.max_depth:
+            bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
+
         bam_plp_set_mask( self.pileup_iter, self.mask )
 
     cdef reset( self, tid, start, end ):
@@ -2200,6 +2265,9 @@ cdef class AlignedRead:
 
             read.tags = read.tags + [("RG",0)]
 
+
+        This method will happily write the same tag
+        multiple times.
         """
         def __get__(self):
             cdef char * ctag
@@ -2209,7 +2277,7 @@ cdef class AlignedRead:
             cdef char auxtype
             
             src = self._delegate
-            if src.l_aux == 0: return None
+            if src.l_aux == 0: return []
             
             s = bam1_aux( src )
             result = []
@@ -2381,7 +2449,7 @@ cdef class AlignedRead:
         '''length of the read (read only). Returns 0 if not given.'''
         def __get__(self): return self._delegate.core.l_qseq
     property aend:
-        '''aligned end position of the read (read only).  Returns
+        '''aligned end position of the read on the reference genome.  Returns
         None if not available.'''
         def __get__(self):
             cdef bam1_t * src
@@ -2390,7 +2458,7 @@ cdef class AlignedRead:
                 return None
             return bam_calend(&src.core, bam1_cigar(src))
     property alen:
-        '''aligned length of the read (read only).  Returns None if
+        '''aligned length of the read on the reference genome.  Returns None if
         not available.'''
         def __get__(self):
             cdef bam1_t * src
@@ -2406,14 +2474,30 @@ cdef class AlignedRead:
         def __get__(self): return self._delegate.core.qual
         def __set__(self, qual): self._delegate.core.qual = qual
     property mrnm:
+        """the :term:`reference` id of the mate 
+        deprecated, use RNEXT instead.
+        """     
+        def __get__(self): return self._delegate.core.mtid
+        def __set__(self, mtid): self._delegate.core.mtid = mtid
+    property rnext:
         """the :term:`reference` id of the mate """     
         def __get__(self): return self._delegate.core.mtid
         def __set__(self, mtid): self._delegate.core.mtid = mtid
     property mpos: 
+        """the position of the mate
+        deprecated, use PNEXT instead."""
+        def __get__(self): return self._delegate.core.mpos
+        def __set__(self, mpos): self._delegate.core.mpos = mpos
+    property pnext: 
         """the position of the mate"""
         def __get__(self): return self._delegate.core.mpos
         def __set__(self, mpos): self._delegate.core.mpos = mpos
     property isize: 
+        """the insert size
+        deprecated: use tlen instead"""
+        def __get__(self): return self._delegate.core.isize
+        def __set__(self, isize): self._delegate.core.isize = isize
+    property tlen: 
         """the insert size"""
         def __get__(self): return self._delegate.core.isize
         def __set__(self, isize): self._delegate.core.isize = isize
@@ -2509,8 +2593,10 @@ cdef class AlignedRead:
                     pos += l
 
             return result
+
     def overlap( self, uint32_t start, uint32_t end ):
-        """return number of bases on reference overlapping *start* and *end*
+        """return number of aligned bases of read overlapping the interval *start* and *end*
+        on the reference sequence.
         """
         cdef uint32_t k, i, pos, overlap
         cdef int op, o
@@ -2739,7 +2825,7 @@ def _samtools_dispatch( method,
     '''call ``method`` in samtools providing arguments in args.
     
     .. note:: 
-       This method redirects stdout and stderr to capture it 
+       This method redirects stdout and (optionally) stderr to capture it 
        from samtools. If for some reason stdout/stderr disappears
        the reason might be in this method.
 
@@ -2756,8 +2842,8 @@ def _samtools_dispatch( method,
     '''
 
     # note that debugging this module can be a problem
-    # as stdout/stderr will not appear
-
+    # as stdout/stderr will not appear on the terminal
+    
     # some special cases
     if method == "index":
         if not os.path.exists( args[0] ):
@@ -2781,7 +2867,6 @@ def _samtools_dispatch( method,
             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
             args = ( "-o", stdout_f ) + args
 
-
     # do the function call to samtools
     cdef char ** cargs
     cdef int i, n, retval
@@ -2792,6 +2877,7 @@ def _samtools_dispatch( method,
     cargs[0] = "samtools"
     cargs[1] = method
     for i from 0 <= i < n: cargs[i+2] = args[i]
+
     retval = pysam_dispatch(n+2, cargs)
     free( cargs )
 
@@ -2870,500 +2956,500 @@ cdef class SNPCall:
                     self.coverage ) ) )
 
 
-cdef class SNPCallerBase:
-    '''Base class for SNP callers.
-
-    *min_baseQ*
-       minimum base quality (possibly capped by BAQ)
-    *capQ_threshold*
-       coefficient for adjusting mapQ of poor mappings
-    *theta*
-       theta in maq consensus calling model
-    *n_haplotypes*
-       number of haplotypes in the sample
-    *het_rate*
-       prior of a difference between two haplotypes
-    '''
-
-    cdef bam_maqcns_t * c
-    cdef IteratorColumn iter
-
-    def __cinit__(self, 
-                  IteratorColumn iterator_column, 
-                  **kwargs ):
-
-        self.iter = iterator_column
-        self.c =  bam_maqcns_init()
-
-        # set the default parameterization according to
-        # samtools
-
-        # new default mode for samtools >0.1.10
-        self.c.errmod = kwargs.get( "errmod", BAM_ERRMOD_MAQ2 )
-
-        self.c.min_baseQ = kwargs.get( "min_baseQ", 13 )
-        # self.c.capQ_thres = kwargs.get( "capQ_threshold", 60 )
-        self.c.n_hap = kwargs.get( "n_haplotypes", 2 )
-        self.c.het_rate = kwargs.get( "het_rate", 0.001 )
-        self.c.theta = kwargs.get( "theta", 0.83 )
-
-        if self.c.errmod != BAM_ERRMOD_MAQ2:
-            self.c.theta += 0.02
-
-        # call prepare AFTER setting parameters
-        bam_maqcns_prepare( self.c )
-
-    def __dealloc__(self):
-        bam_maqcns_destroy( self.c )
-
-    cdef __dump( self, glf1_t * g, uint32_t cns, int rb ):
-        '''debugging output.'''
-
-        pysam_dump_glf( g, self.c );
-        print ""
-        for x in range(self.iter.n_plp):
-            print "--> read %i %s %i" % (x, 
-                                         bam1_qname(self.iter.plp[x].b),
-                                         self.iter.plp[x].qpos,
-                                         )
-
-        print "pos=%i, cns=%i, q_r = %f, depth=%i, n=%i, rb=%i, cns-cq=%i %i %i %i" \
-            % (self.iter.pos, 
-               cns, 
-               self.c.q_r,
-               self.iter.n_plp,
-               self.iter.n_plp,
-               rb,
-               cns >> 8 & 0xff,
-               cns >> 16 & 0xff,
-               cns & 0xff,
-               cns >> 28,
-               )
-
-        printf("-------------------------------------\n");
-        sys.stdout.flush()
-
-cdef class IteratorSNPCalls( SNPCallerBase ):
-    """*(IteratorColumn iterator)*
-
-    call SNPs within a region.
-
-    *iterator* is a pileup iterator. SNPs will be called
-    on all positions returned by this iterator.
-
-    This caller is fast if SNPs are called over large continuous
-    regions. It is slow, if instantiated frequently and in random
-    order as the sequence will have to be reloaded.
-
-    """
+cdef class SNPCallerBase:
+    '''Base class for SNP callers.
+
+    *min_baseQ*
+       minimum base quality (possibly capped by BAQ)
+    *capQ_threshold*
+       coefficient for adjusting mapQ of poor mappings
+    *theta*
+       theta in maq consensus calling model
+    *n_haplotypes*
+       number of haplotypes in the sample
+    *het_rate*
+       prior of a difference between two haplotypes
+    '''
+
+    cdef bam_maqcns_t * c
+    cdef IteratorColumn iter
+
+    def __cinit__(self, 
+                  IteratorColumn iterator_column, 
+                  **kwargs ):
+
+        self.iter = iterator_column
+        self.c =  bam_maqcns_init()
+
+        # set the default parameterization according to
+        # samtools
+
+        # new default mode for samtools >0.1.10
+        self.c.errmod = kwargs.get( "errmod", BAM_ERRMOD_MAQ2 )
+
+        self.c.min_baseQ = kwargs.get( "min_baseQ", 13 )
+        # self.c.capQ_thres = kwargs.get( "capQ_threshold", 60 )
+        self.c.n_hap = kwargs.get( "n_haplotypes", 2 )
+        self.c.het_rate = kwargs.get( "het_rate", 0.001 )
+        self.c.theta = kwargs.get( "theta", 0.83 )
+
+        if self.c.errmod != BAM_ERRMOD_MAQ2:
+            self.c.theta += 0.02
+
+        # call prepare AFTER setting parameters
+        bam_maqcns_prepare( self.c )
+
+    def __dealloc__(self):
+        bam_maqcns_destroy( self.c )
+
+    cdef __dump( self, glf1_t * g, uint32_t cns, int rb ):
+        '''debugging output.'''
+
+        pysam_dump_glf( g, self.c );
+        print ""
+        for x in range(self.iter.n_plp):
+            print "--> read %i %s %i" % (x, 
+                                         bam1_qname(self.iter.plp[x].b),
+                                         self.iter.plp[x].qpos,
+                                         )
+
+        print "pos=%i, cns=%i, q_r = %f, depth=%i, n=%i, rb=%i, cns-cq=%i %i %i %i" \
+            % (self.iter.pos, 
+               cns, 
+               self.c.q_r,
+               self.iter.n_plp,
+               self.iter.n_plp,
+               rb,
+               cns >> 8 & 0xff,
+               cns >> 16 & 0xff,
+               cns & 0xff,
+               cns >> 28,
+               )
+
+        printf("-------------------------------------\n");
+        sys.stdout.flush()
+
+cdef class IteratorSNPCalls( SNPCallerBase ):
+    """*(IteratorColumn iterator)*
+
+    call SNPs within a region.
+
+    *iterator* is a pileup iterator. SNPs will be called
+    on all positions returned by this iterator.
+
+    This caller is fast if SNPs are called over large continuous
+    regions. It is slow, if instantiated frequently and in random
+    order as the sequence will have to be reloaded.
+
+    """
     
-    def __cinit__(self, 
-                  IteratorColumn iterator_column,
-                  **kwargs ):
+    def __cinit__(self, 
+                  IteratorColumn iterator_column,
+                  **kwargs ):
 
-        assert self.iter.hasReference(), "IteratorSNPCalls requires an pileup iterator with reference sequence"
+        assert self.iter.hasReference(), "IteratorSNPCalls requires an pileup iterator with reference sequence"
 
-    def __iter__(self):
-        return self 
+    def __iter__(self):
+        return self 
 
-    def __next__(self): 
-        """python version of next().
-        """
+    def __next__(self): 
+        """python version of next().
+        """
 
-        # the following code was adapted from bam_plcmd.c:pileup_func()
-        self.iter.cnext()
+        # the following code was adapted from bam_plcmd.c:pileup_func()
+        self.iter.cnext()
 
-        if self.iter.n_plp < 0:
-            raise ValueError("error during iteration" )
+        if self.iter.n_plp < 0:
+            raise ValueError("error during iteration" )
 
-        if self.iter.plp == NULL:
-           raise StopIteration
+        if self.iter.plp == NULL:
+           raise StopIteration
 
-        cdef char * seq = self.iter.getSequence()
-        cdef int seq_len = self.iter.seq_len
+        cdef char * seq = self.iter.getSequence()
+        cdef int seq_len = self.iter.seq_len
 
-        assert seq != NULL
+        assert seq != NULL
 
-        # reference base
-        if self.iter.pos >= seq_len:
-            raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
+        # reference base
+        if self.iter.pos >= seq_len:
+            raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
 
-        cdef int rb = seq[self.iter.pos]
-        cdef uint32_t cns 
-        cdef glf1_t * g
+        cdef int rb = seq[self.iter.pos]
+        cdef uint32_t cns 
+#        cdef glf1_t * g
 
-        g = bam_maqcns_glfgen( self.iter.n_plp,
-                               self.iter.plp,
-                               bam_nt16_table[rb],
-                               self.c )
+#        g = bam_maqcns_glfgen( self.iter.n_plp,
+#                               self.iter.plp,
+#                               bam_nt16_table[rb],
+#                               self.c )
 
-        if pysam_glf_depth( g ) == 0:
-            cns = 0xfu << 28 | 0xf << 24
-        else:
-            cns = glf2cns(g, <int>(self.c.q_r + .499))
-            
-        free(g)
+#        if pysam_glf_depth( g ) == 0:
+#            cns = 0xfu << 28 | 0xf << 24
+#        else:
+#            cns = glf2cns(g, <int>(self.c.q_r + .499))
+           
+#        free(g)
             
-        cdef SNPCall call
+        cdef SNPCall call
 
-        call = SNPCall()
-        call._tid = self.iter.tid
-        call._pos = self.iter.pos
-        call._reference_base = rb
-        call._genotype = bam_nt16_rev_table[cns>>28]
-        call._consensus_quality = cns >> 8 & 0xff
-        call._snp_quality = cns & 0xff
-        call._rms_mapping_quality = cns >> 16&0xff
-        call._coverage = self.iter.n_plp
+        call = SNPCall()
+        call._tid = self.iter.tid
+        call._pos = self.iter.pos
+        call._reference_base = rb
+        call._genotype = bam_nt16_rev_table[cns>>28]
+        call._consensus_quality = cns >> 8 & 0xff
+        call._snp_quality = cns & 0xff
+        call._rms_mapping_quality = cns >> 16&0xff
+        call._coverage = self.iter.n_plp
 
-        return call 
+        return call 
 
-cdef class SNPCaller( SNPCallerBase ):
-    '''*(IteratorColumn iterator_column )*
+cdef class SNPCaller( SNPCallerBase ):
+    '''*(IteratorColumn iterator_column )*
 
-    The samtools SNP caller.
+    The samtools SNP caller.
 
-    This object will call SNPs in *samfile* against the reference
-    sequence in *fasta*.
+    This object will call SNPs in *samfile* against the reference
+    sequence in *fasta*.
 
-    This caller is fast for calling few SNPs in selected regions.
+    This caller is fast for calling few SNPs in selected regions.
 
-    It is slow, if called over large genomic regions.
-    '''
+    It is slow, if called over large genomic regions.
+    '''
 
 
-    def __cinit__(self, 
-                  IteratorColumn iterator_column, 
-                  **kwargs ):
+    def __cinit__(self, 
+                  IteratorColumn iterator_column, 
+                  **kwargs ):
 
-        pass
+        pass
 
-    def call(self, reference, int pos ): 
-        """call a snp on chromosome *reference*
-        and position *pos*.
+    def call(self, reference, int pos ): 
+        """call a snp on chromosome *reference*
+        and position *pos*.
 
-        returns a :class:`SNPCall` object.
-        """
+        returns a :class:`SNPCall` object.
+        """
 
-        cdef int tid = self.iter.samfile.gettid( reference )
+        cdef int tid = self.iter.samfile.gettid( reference )
 
-        self.iter.reset( tid, pos, pos + 1 )
+        self.iter.reset( tid, pos, pos + 1 )
 
-        while 1:
-            self.iter.cnext()
+        while 1:
+            self.iter.cnext()
             
-            if self.iter.n_plp < 0:
-                raise ValueError("error during iteration" )
+            if self.iter.n_plp < 0:
+                raise ValueError("error during iteration" )
 
-            if self.iter.plp == NULL:
-                raise ValueError( "no reads in region - no call" )
+            if self.iter.plp == NULL:
+                raise ValueError( "no reads in region - no call" )
              
-            if self.iter.pos == pos: break
-
-        cdef char * seq = self.iter.getSequence()
-        cdef int seq_len = self.iter.seq_len
-
-        assert seq != NULL
-
-        # reference base
-        if self.iter.pos >= seq_len:
-            raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
-
-        cdef int rb = seq[self.iter.pos]
-        cdef uint32_t cns 
-        cdef glf1_t * g
-
-        g = bam_maqcns_glfgen( self.iter.n_plp,
-                               self.iter.plp,
-                               bam_nt16_table[rb],
-                               self.c )
-
-
-        if pysam_glf_depth( g ) == 0:
-            cns = 0xfu << 28 | 0xf << 24
-        else:
-            cns = glf2cns(g, <int>(self.c.q_r + .499))
-
-        free(g)
+            if self.iter.pos == pos: break
+
+        cdef char * seq = self.iter.getSequence()
+        cdef int seq_len = self.iter.seq_len
+
+        assert seq != NULL
+
+        # reference base
+        if self.iter.pos >= seq_len:
+            raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
+
+        cdef int rb = seq[self.iter.pos]
+        cdef uint32_t cns 
+# #        cdef glf1_t * g
+# #
+# #        g = bam_maqcns_glfgen( self.iter.n_plp,
+# #                               self.iter.plp,
+# #                               bam_nt16_table[rb],
+# #                               self.c )
+# ##
+# #
+# #        if pysam_glf_depth( g ) == 0:
+# #            cns = 0xfu << 28 | 0xf << 24
+# #        else:
+# #            cns = glf2cns(g, <int>(self.c.q_r + .499))
+# #
+# #        free(g)
             
-        cdef SNPCall call
-
-        call = SNPCall()
-        call._tid = self.iter.tid
-        call._pos = self.iter.pos
-        call._reference_base = rb
-        call._genotype = bam_nt16_rev_table[cns>>28]
-        call._consensus_quality = cns >> 8 & 0xff
-        call._snp_quality = cns & 0xff
-        call._rms_mapping_quality = cns >> 16&0xff
-        call._coverage = self.iter.n_plp
-
-        return call 
-
-cdef class IndelCall:
-    '''the results of an indel call.'''
-    cdef int _tid
-    cdef int _pos
-    cdef int _coverage
-    cdef int _rms_mapping_quality
-    cdef bam_maqindel_ret_t * _r 
-
-    def __cinit__(self):
-        #assert r != NULL
-        #self._r = r
-        pass
-
-    property tid:
-        '''the chromosome ID as is defined in the header'''
-        def __get__(self): 
-            return self._tid
+        cdef SNPCall call
+
+        call = SNPCall()
+        call._tid = self.iter.tid
+        call._pos = self.iter.pos
+        call._reference_base = rb
+        call._genotype = bam_nt16_rev_table[cns>>28]
+        call._consensus_quality = cns >> 8 & 0xff
+        call._snp_quality = cns & 0xff
+        call._rms_mapping_quality = cns >> 16&0xff
+        call._coverage = self.iter.n_plp
+
+        return call 
+
+cdef class IndelCall:
+    '''the results of an indel call.'''
+    cdef int _tid
+    cdef int _pos
+    cdef int _coverage
+    cdef int _rms_mapping_quality
+    cdef bam_maqindel_ret_t * _r 
+
+    def __cinit__(self):
+        #assert r != NULL
+        #self._r = r
+        pass
+
+    property tid:
+        '''the chromosome ID as is defined in the header'''
+        def __get__(self): 
+            return self._tid
     
-    property pos:
-       '''nucleotide position of SNP.'''
-       def __get__(self): return self._pos
-
-    property genotype:
-       '''the genotype called.'''
-       def __get__(self): 
-           if self._r.gt == 0:
-               s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
-               return "%s/%s" % (s,s)
-           elif self._r.gt == 1:
-               s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
-               return "%s/%s" % (s,s)
-           else:
-               return "%s/%s" % (self.first_allele, self.second_allele )
-
-    property consensus_quality:
-       '''the genotype quality (Phred-scaled).'''
-       def __get__(self): return self._r.q_cns
-
-    property snp_quality:
-       '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
-       def __get__(self): return self._r.q_ref
-
-    property mapping_quality:
-       '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
-       def __get__(self): return self._rms_mapping_quality
-
-    property coverage:
-       '''coverage or read depth - the number of reads involved in the call.'''
-       def __get__(self): return self._coverage
-
-    property first_allele:
-       '''sequence of first allele.'''
-       def __get__(self): return PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
-
-    property second_allele:
-       '''sequence of second allele.'''
-       def __get__(self): return PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
-
-    property reads_first:
-       '''reads supporting first allele.'''
-       def __get__(self): return self._r.cnt1
-
-    property reads_second:
-       '''reads supporting first allele.'''
-       def __get__(self): return self._r.cnt2
-
-    property reads_diff:
-       '''reads supporting first allele.'''
-       def __get__(self): return self._r.cnt_anti
-
-    def __str__(self):
-
-        return "\t".join( map(str, (
-                    self.tid,
-                    self.pos,
-                    self.genotype,
-                    self.consensus_quality,
-                    self.snp_quality,
-                    self.mapping_quality,
-                    self.coverage,
-                    self.first_allele,
-                    self.second_allele,
-                    self.reads_first,
-                    self.reads_second,
-                    self.reads_diff ) ) )
-
-    def __dealloc__(self ):
-        bam_maqindel_ret_destroy(self._r)
-
-cdef class IndelCallerBase:
-    '''Base class for SNP callers.
-
-    *min_baseQ*
-       minimum base quality (possibly capped by BAQ)
-    *capQ_threshold*
-       coefficient for adjusting mapQ of poor mappings
-    *theta*
-       theta in maq consensus calling model
-    *n_haplotypes*
-       number of haplotypes in the sample
-    *het_rate*
-       prior of a difference between two haplotypes
-    '''
-
-    cdef bam_maqindel_opt_t * options
-    cdef IteratorColumn iter
-    cdef int cap_mapQ
-    cdef int max_depth
-
-    def __cinit__(self, 
-                  IteratorColumn iterator_column, 
-                  **kwargs ):
+#     property pos:
+#        '''nucleotide position of SNP.'''
+#        def __get__(self): return self._pos
+
+#     property genotype:
+#        '''the genotype called.'''
+#        def __get__(self): 
+#            if self._r.gt == 0:
+#                s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
+#                return "%s/%s" % (s,s)
+#            elif self._r.gt == 1:
+#                s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
+#                return "%s/%s" % (s,s)
+#            else:
+#                return "%s/%s" % (self.first_allele, self.second_allele )
+
+#     property consensus_quality:
+#        '''the genotype quality (Phred-scaled).'''
+#        def __get__(self): return self._r.q_cns
+
+#     property snp_quality:
+#        '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
+#        def __get__(self): return self._r.q_ref
+
+#     property mapping_quality:
+#        '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
+#        def __get__(self): return self._rms_mapping_quality
+
+#     property coverage:
+#        '''coverage or read depth - the number of reads involved in the call.'''
+#        def __get__(self): return self._coverage
+
+#     property first_allele:
+#        '''sequence of first allele.'''
+#        def __get__(self): return PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1)
+
+#     property second_allele:
+#        '''sequence of second allele.'''
+#        def __get__(self): return PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1)
+
+#     property reads_first:
+#        '''reads supporting first allele.'''
+#        def __get__(self): return self._r.cnt1
+
+#     property reads_second:
+#        '''reads supporting first allele.'''
+#        def __get__(self): return self._r.cnt2
+
+#     property reads_diff:
+#        '''reads supporting first allele.'''
+#        def __get__(self): return self._r.cnt_anti
+
+#     def __str__(self):
+
+#         return "\t".join( map(str, (
+#                     self.tid,
+#                     self.pos,
+#                     self.genotype,
+#                     self.consensus_quality,
+#                     self.snp_quality,
+#                     self.mapping_quality,
+#                     self.coverage,
+#                     self.first_allele,
+#                     self.second_allele,
+#                     self.reads_first,
+#                     self.reads_second,
+#                     self.reads_diff ) ) )
+
+#     def __dealloc__(self ):
+#         bam_maqindel_ret_destroy(self._r)
+
+# cdef class IndelCallerBase:
+#     '''Base class for SNP callers.
+
+#     *min_baseQ*
+#        minimum base quality (possibly capped by BAQ)
+#     *capQ_threshold*
+#        coefficient for adjusting mapQ of poor mappings
+#     *theta*
+#        theta in maq consensus calling model
+#     *n_haplotypes*
+#        number of haplotypes in the sample
+#     *het_rate*
+#        prior of a difference between two haplotypes
+#     '''
+
+#     cdef bam_maqindel_opt_t * options
+#     cdef IteratorColumn iter
+#     cdef int cap_mapQ
+#     cdef int max_depth
+
+#     def __cinit__(self, 
+#                   IteratorColumn iterator_column, 
+#                   **kwargs ):
+
+
+#         self.iter = iterator_column
+
+#         assert iterator_column.hasReference(), "IndelCallerBase requires an pileup iterator with reference sequence"
+
+#         self.options = bam_maqindel_opt_init()
+
+#         # set the default parameterization according to
+#         # samtools
+
+#         self.options.r_indel = kwargs.get( "r_indel", 0.00015 )
+#         self.options.q_indel = kwargs.get( "q_indel", 40 )
+#         self.cap_mapQ = kwargs.get( "cap_mapQ", 60 )
+#         self.max_depth = kwargs.get( "max_depth", 1024 )
+
+#     def __dealloc__(self):
+#         free( self.options )
 
+#     def _call( self ):
 
-        self.iter = iterator_column
+#         cdef char * seq = self.iter.getSequence()
+#         cdef int seq_len = self.iter.seq_len
 
-        assert iterator_column.hasReference(), "IndelCallerBase requires an pileup iterator with reference sequence"
-
-        self.options = bam_maqindel_opt_init()
-
-        # set the default parameterization according to
-        # samtools
-
-        self.options.r_indel = kwargs.get( "r_indel", 0.00015 )
-        self.options.q_indel = kwargs.get( "q_indel", 40 )
-        self.cap_mapQ = kwargs.get( "cap_mapQ", 60 )
-        self.max_depth = kwargs.get( "max_depth", 1024 )
-
-    def __dealloc__(self):
-        free( self.options )
+#         assert seq != NULL
 
-    def _call( self ):
+#         # reference base
+#         if self.iter.pos >= seq_len:
+#             raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
 
-        cdef char * seq = self.iter.getSequence()
-        cdef int seq_len = self.iter.seq_len
+#         cdef bam_maqindel_ret_t * r 
+        
+#         cdef int m = min( self.max_depth, self.iter.n_plp )
+
+#         # printf("pysam: m=%i, q_indel=%i, r_indel=%f, r_snp=%i, mm_penalty=%i, indel_err=%i, ambi_thres=%i\n",
+#         #        m, self.options.q_indel, self.options.r_indel, self.options.r_snp, self.options.mm_penalty,
+#         #        self.options.indel_err, self.options.ambi_thres );
+
+#         r = bam_maqindel(m, 
+#                          self.iter.pos, 
+#                          self.options,
+#                          self.iter.plp, 
+#                          seq,
+#                          0, 
+#                          NULL)
+        
+#         if r == NULL: return None
 
-        assert seq != NULL
+#         cdef IndelCall call
+#         call = IndelCall()
+#         call._r = r
+#         call._tid = self.iter.tid
+#         call._pos = self.iter.pos
+#         call._coverage = self.iter.n_plp
 
-        # reference base
-        if self.iter.pos >= seq_len:
-            raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) )
+#         cdef uint64_t rms_aux = 0
+#         cdef int i = 0
+#         cdef bam_pileup1_t * p
+#         cdef int tmp
 
-        cdef bam_maqindel_ret_t * r 
-        
-        cdef int m = min( self.max_depth, self.iter.n_plp )
-
-        # printf("pysam: m=%i, q_indel=%i, r_indel=%f, r_snp=%i, mm_penalty=%i, indel_err=%i, ambi_thres=%i\n",
-        #        m, self.options.q_indel, self.options.r_indel, self.options.r_snp, self.options.mm_penalty,
-        #        self.options.indel_err, self.options.ambi_thres );
-
-        r = bam_maqindel(m, 
-                         self.iter.pos, 
-                         self.options,
-                         self.iter.plp, 
-                         seq,
-                         0, 
-                         NULL)
-        
-        if r == NULL: return None
-
-        cdef IndelCall call
-        call = IndelCall()
-        call._r = r
-        call._tid = self.iter.tid
-        call._pos = self.iter.pos
-        call._coverage = self.iter.n_plp
-
-        cdef uint64_t rms_aux = 0
-        cdef int i = 0
-        cdef bam_pileup1_t * p
-        cdef int tmp
-
-        for i from 0 <= i < self.iter.n_plp:
-            p = self.iter.plp + i
-            if p.b.core.qual < self.cap_mapQ:
-                tmp = p.b.core.qual 
-            else:
-                tmp = self.cap_mapQ
-            rms_aux += tmp * tmp
+#         for i from 0 <= i < self.iter.n_plp:
+#             p = self.iter.plp + i
+#             if p.b.core.qual < self.cap_mapQ:
+#                 tmp = p.b.core.qual 
+#             else:
+#                 tmp = self.cap_mapQ
+#             rms_aux += tmp * tmp
 
-        call._rms_mapping_quality = <uint64_t>(sqrt(<double>rms_aux / self.iter.n_plp) + .499)
+        call._rms_mapping_quality = <uint64_t>(sqrt(<double>rms_aux / self.iter.n_plp) + .499)
 
-        return call 
+        return call 
 
-cdef class IndelCaller( IndelCallerBase ):
-    '''*(IteratorColumn iterator_column )*
+cdef class IndelCaller( IndelCallerBase ):
+    '''*(IteratorColumn iterator_column )*
 
-    The samtools SNP caller.
+    The samtools SNP caller.
 
-    This object will call SNPs in *samfile* against the reference
-    sequence in *fasta*.
+    This object will call SNPs in *samfile* against the reference
+    sequence in *fasta*.
 
-    This caller is fast for calling few SNPs in selected regions.
+    This caller is fast for calling few SNPs in selected regions.
 
-    It is slow, if called over large genomic regions.
-    '''
+    It is slow, if called over large genomic regions.
+    '''
 
-    def __cinit__(self, 
-                  IteratorColumn iterator_column, 
-                  **kwargs ):
+    def __cinit__(self, 
+                  IteratorColumn iterator_column, 
+                  **kwargs ):
 
-        pass
+        pass
 
-    def call(self, reference, int pos ): 
-        """call a snp on chromosome *reference*
-        and position *pos*.
+    def call(self, reference, int pos ): 
+        """call a snp on chromosome *reference*
+        and position *pos*.
 
-        returns a :class:`SNPCall` object or None, if no indel call could be made.
-        """
+        returns a :class:`SNPCall` object or None, if no indel call could be made.
+        """
 
-        cdef int tid = self.iter.samfile.gettid( reference )
+        cdef int tid = self.iter.samfile.gettid( reference )
 
-        self.iter.reset( tid, pos, pos + 1 )
+        self.iter.reset( tid, pos, pos + 1 )
 
-        while 1:
-            self.iter.cnext()
+        while 1:
+            self.iter.cnext()
             
-            if self.iter.n_plp < 0:
-                raise ValueError("error during iteration" )
+            if self.iter.n_plp < 0:
+                raise ValueError("error during iteration" )
 
-            if self.iter.plp == NULL:
-                raise ValueError( "no reads in region - no call" )
+            if self.iter.plp == NULL:
+                raise ValueError( "no reads in region - no call" )
              
-            if self.iter.pos == pos: break
+            if self.iter.pos == pos: break
 
-        return self._call()
+        return self._call()
 
-cdef class IteratorIndelCalls( IndelCallerBase ):
-    """*(IteratorColumn iterator)*
+cdef class IteratorIndelCalls( IndelCallerBase ):
+    """*(IteratorColumn iterator)*
 
-    call indels within a region.
+    call indels within a region.
 
-    *iterator* is a pileup iterator. SNPs will be called
-    on all positions returned by this iterator.
+    *iterator* is a pileup iterator. SNPs will be called
+    on all positions returned by this iterator.
 
-    This caller is fast if SNPs are called over large continuous
-    regions. It is slow, if instantiated frequently and in random
-    order as the sequence will have to be reloaded.
+    This caller is fast if SNPs are called over large continuous
+    regions. It is slow, if instantiated frequently and in random
+    order as the sequence will have to be reloaded.
 
-    """
+    """
     
-    def __cinit__(self, 
-                  IteratorColumn iterator_column,
-                  **kwargs ):
-        pass
+    def __cinit__(self, 
+                  IteratorColumn iterator_column,
+                  **kwargs ):
+        pass
 
 
-    def __iter__(self):
-        return self 
+    def __iter__(self):
+        return self 
 
-    def __next__(self): 
-        """python version of next().
-        """
+    def __next__(self): 
+        """python version of next().
+        """
 
-        # the following code was adapted from bam_plcmd.c:pileup_func()
-        self.iter.cnext()
+        # the following code was adapted from bam_plcmd.c:pileup_func()
+        self.iter.cnext()
 
-        if self.iter.n_plp < 0:
-            raise ValueError("error during iteration" )
+        if self.iter.n_plp < 0:
+            raise ValueError("error during iteration" )
 
-        if self.iter.plp == NULL:
-           raise StopIteration
+        if self.iter.plp == NULL:
+           raise StopIteration
 
-        return self._call()
+        return self._call()
 
 
 
@@ -3441,10 +3527,10 @@ __all__ = ["Samfile",
            "PileupColumn", 
            "PileupProxy", 
            "PileupRead",
-           "IteratorSNPCalls",
-           "SNPCaller",
-           "IndelCaller",
-           "IteratorIndelCalls", 
+           "IteratorSNPCalls",
+           "SNPCaller",
+           "IndelCaller",
+           "IteratorIndelCalls", 
            "IndexedReads" ]
 
                
index 11a2c6f1310af4bc4bbd785d3fb8a17885e4c339..7badd4a4333ca5364c9c861be34c8f202cc42372 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13 on Thu May  5 14:57:46 2011 */
+/* Generated by Cython 0.14.1 on Fri Nov 25 20:32:50 2011 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
   #define PyBytes_Repr                 PyString_Repr
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
 #endif
-
 #ifndef PySet_CheckExact
-#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
+  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
 
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
   #define PyInt_Check(op)              PyLong_Check(op)
   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
 #endif
 
 #if PY_MAJOR_VERSION >= 3
-  #define PyBoolObject PyLongObject
+  #define PyBoolObject                 PyLongObject
 #endif
 
 
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
 #endif
 
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
 #include "tabix.h"
 #include "pythread.h"
 
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
 /* inline attribute */
 #ifndef CYTHON_INLINE
   #if defined(__GNUC__)
   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
     #define CYTHON_INLINE inline
   #else
-    #define CYTHON_INLINE 
+    #define CYTHON_INLINE
   #endif
 #endif
 
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
 #   else
 #     define CYTHON_UNUSED
 #   endif
 # elif defined(__ICC) || defined(__INTEL_COMPILER)
-#   define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
-#   define CYTHON_UNUSED 
+#   define CYTHON_UNUSED
 # endif
 #endif
 
@@ -258,7 +287,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
 #ifdef __GNUC__
 /* Test for GCC > 2.95 */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
 #define likely(x)   __builtin_expect(!!(x), 1)
 #define unlikely(x) __builtin_expect(!!(x), 0)
 #else /* __GNUC__ > 2 ... */
@@ -283,12 +312,13 @@ static const char *__pyx_filename;
 static const char *__pyx_f[] = {
   "ctabix.pyx",
   "bool.pxd",
+  "complex.pxd",
   "TabProxies.pxd",
 };
 
 /* Type declarations */
 
-/* "pysam/ctabix.pxd":178
+/* "ctabix.pxd":178
  *     cdef tabix_t * tabixfile
  * 
  * cdef class Parser:             # <<<<<<<<<<<<<<
@@ -299,19 +329,19 @@ struct __pyx_obj_6ctabix_Parser {
   PyObject_HEAD
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":293
+/* "ctabix.pyx":389
  *         return r
  * 
  * cdef class asVCF( Parser ):             # <<<<<<<<<<<<<<
- *     '''converts a :term:`tabix row` into a VCF record.'''
- *     def __call__(self, char * buffer, int len ):
+ *     '''converts a :term:`tabix row` into a VCF record with
+ *     the following fields:
  */
 
 struct __pyx_obj_6ctabix_asVCF {
   struct __pyx_obj_6ctabix_Parser __pyx_base;
 };
 
-/* "pysam/TabProxies.pxd":42
+/* "TabProxies.pxd":42
  *   ctypedef int uint64_t
  * 
  * cdef class TupleProxy:             # <<<<<<<<<<<<<<
@@ -331,7 +361,7 @@ struct __pyx_obj_10TabProxies_TupleProxy {
   int is_modified;
 };
 
-/* "pysam/TabProxies.pxd":77
+/* "TabProxies.pxd":78
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -343,7 +373,7 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
   struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
 };
 
-/* "pysam/TabProxies.pxd":80
+/* "TabProxies.pxd":81
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -359,7 +389,7 @@ struct __pyx_obj_10TabProxies_BedProxy {
   int bedfields;
 };
 
-/* "pysam/TabProxies.pxd":91
+/* "TabProxies.pxd":92
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -373,7 +403,7 @@ struct __pyx_obj_10TabProxies_VCFProxy {
   uint32_t pos;
 };
 
-/* "pysam/TabProxies.pxd":60
+/* "TabProxies.pxd":61
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -395,8 +425,8 @@ struct __pyx_obj_10TabProxies_GTFProxy {
   int hasOwnAttributes;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":161
- *             return result
+/* "ctabix.pyx":193
+ *         if self._filename != NULL: free( self._filename )
  * 
  * cdef class TabixIterator:             # <<<<<<<<<<<<<<
  *     """iterates over rows in *tabixfile* in region
@@ -409,7 +439,7 @@ struct __pyx_obj_6ctabix_TabixIterator {
   tabix_t *tabixfile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":304
+/* "ctabix.pyx":428
  * #########################################################
  * #########################################################
  * cdef class TabixIteratorParsed:             # <<<<<<<<<<<<<<
@@ -424,7 +454,7 @@ struct __pyx_obj_6ctabix_TabixIteratorParsed {
   struct __pyx_obj_6ctabix_Parser *parser;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":216
+/* "ctabix.pyx":248
  *             ti_iter_destroy(self.iterator)
  * 
  * cdef class TabixHeaderIterator:             # <<<<<<<<<<<<<<
@@ -438,50 +468,50 @@ struct __pyx_obj_6ctabix_TabixHeaderIterator {
   tabix_t *tabixfile;
 };
 
-/* "pysam/ctabix.pxd":172
+/* "ctabix.pxd":172
  *   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
  * 
  * cdef class Tabixfile:             # <<<<<<<<<<<<<<
- *     cdef char * filename
+ *     cdef char * _filename
  * 
  */
 
 struct __pyx_obj_6ctabix_Tabixfile {
   PyObject_HEAD
-  char *filename;
+  char *_filename;
   tabix_t *tabixfile;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":277
+/* "ctabix.pyx":312
  *         return r
  * 
  * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
- *     '''converts a :term:`tabix row` into a GTF record.'''
- *     def __call__(self, char * buffer, int len):
+ *     '''converts a :term:`tabix row` into a GTF record with the following
+ *     fields:
  */
 
 struct __pyx_obj_6ctabix_asGTF {
   struct __pyx_obj_6ctabix_Parser __pyx_base;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":285
+/* "ctabix.pyx":349
  *         return r
  * 
  * cdef class asBed( Parser ):             # <<<<<<<<<<<<<<
- *     '''converts a :term:`tabix row` into a GTF record.'''
- *     def __call__(self, char * buffer, int len):
+ *     '''converts a :term:`tabix row` into a bed record
+ *     with the following fields:
  */
 
 struct __pyx_obj_6ctabix_asBed {
   struct __pyx_obj_6ctabix_Parser __pyx_base;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":267
+/* "ctabix.pyx":299
  *     pass
  * 
  * cdef class asTuple(Parser):             # <<<<<<<<<<<<<<
- *     '''converts a :term:`tabix row` into a python tuple.'''
- *     def __call__(self, char * buffer, int len):
+ *     '''converts a :term:`tabix row` into a python tuple.
+ * 
  */
 
 struct __pyx_obj_6ctabix_asTuple {
@@ -489,7 +519,7 @@ struct __pyx_obj_6ctabix_asTuple {
 };
 
 
-/* "pysam/TabProxies.pxd":42
+/* "TabProxies.pxd":42
  *   ctypedef int uint64_t
  * 
  * cdef class TupleProxy:             # <<<<<<<<<<<<<<
@@ -507,7 +537,7 @@ struct __pyx_vtabstruct_10TabProxies_TupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
 
 
-/* "pysam/TabProxies.pxd":77
+/* "TabProxies.pxd":78
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -521,7 +551,7 @@ struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
 
 
-/* "pysam/TabProxies.pxd":91
+/* "TabProxies.pxd":92
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -535,7 +565,7 @@ struct __pyx_vtabstruct_10TabProxies_VCFProxy {
 static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
 
 
-/* "pysam/TabProxies.pxd":80
+/* "TabProxies.pxd":81
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -549,7 +579,7 @@ struct __pyx_vtabstruct_10TabProxies_BedProxy {
 static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
 
 
-/* "pysam/TabProxies.pxd":60
+/* "TabProxies.pxd":61
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -616,11 +646,11 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
 static void __Pyx_RaiseDoubleKeywordsError(
     const char* func_name, PyObject* kw_name); /*proto*/
 
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
-
 
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
     PyObject *r;
@@ -695,6 +725,11 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
     return r;
 }
 
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
@@ -707,7 +742,6 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
 
 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
 
-
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
@@ -735,11 +769,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
 
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
@@ -778,7 +807,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
 
 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
-static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
+static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
 
 static void __Pyx_AddTraceback(const char *funcname); /*proto*/
 
@@ -822,8 +851,11 @@ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
 
 /* 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 */
@@ -875,7 +907,7 @@ static PyTypeObject *__pyx_ptype_6ctabix_asBed = 0;
 static PyTypeObject *__pyx_ptype_6ctabix_asVCF = 0;
 static PyTypeObject *__pyx_ptype_6ctabix_TabixIteratorParsed = 0;
 #define __Pyx_MODULE_NAME "ctabix"
-int __pyx_module_is_main_ctabix = 0;
+static int __pyx_module_is_main_ctabix = 0;
 
 /* Implementation of ctabix */
 static PyObject *__pyx_builtin_IOError;
@@ -895,29 +927,21 @@ static char __pyx_k_8[] = "invalid region: start (%i) > end (%i)";
 static char __pyx_k_9[] = "start out of range (%i)";
 static char __pyx_k_10[] = "end out of range (%i)";
 static char __pyx_k_11[] = "I/O operation on closed file";
-static char __pyx_k_12[] = "malformatted query or wrong sequence name.\n";
-static char __pyx_k_13[] = "can't open header.\n";
-static char __pyx_k_15[] = "Filename '%s' already exists, use *force* to overwrite";
-static char __pyx_k_16[] = "could not open '%s' for writing";
-static char __pyx_k_17[] = "could not open '%s' for reading";
-static char __pyx_k_18[] = "writing failed";
-static char __pyx_k_20[] = "#";
-static char __pyx_k_22[] = "No such file '%s'";
-static char __pyx_k_23[] = ".gz";
-static char __pyx_k_24[] = "Filename '%s.tbi' already exists, use *force* to overwrite";
-static char __pyx_k_25[] = "unknown preset '%s', valid presets are '%s'";
-static char __pyx_k_26[] = ",";
-static char __pyx_k_27[] = "chromosome names";
-static char __pyx_k_28[] = "Tabixfile._isOpen (line 19)";
-static char __pyx_k_29[] = "Tabixfile._open (line 23)";
-static char __pyx_k_30[] = "Tabixfile._parseRegion (line 57)";
-static char __pyx_k_31[] = "Tabixfile.fetch (line 102)";
-static char __pyx_k_32[] = "Tabixfile.header.__get__ (line 140)";
-static char __pyx_k_33[] = "TabixIterator.__next__ (line 192)";
-static char __pyx_k_34[] = "TabixHeaderIterator.__next__ (line 239)";
-static char __pyx_k_35[] = "TabixIteratorParsed.__next__ (line 342)";
-static char __pyx_k_36[] = "tabix_compress (line 362)";
-static char __pyx_k_37[] = "tabix_index (line 407)";
+static char __pyx_k_14[] = "malformatted query or wrong sequence name.\n";
+static char __pyx_k_16[] = "can't open header.\n";
+static char __pyx_k_20[] = "Filename '%s' already exists, use *force* to overwrite";
+static char __pyx_k_21[] = "could not open '%s' for writing";
+static char __pyx_k_23[] = "could not open '%s' for reading";
+static char __pyx_k_25[] = "writing failed";
+static char __pyx_k_29[] = "#";
+static char __pyx_k_31[] = "No such file '%s'";
+static char __pyx_k_32[] = ".gz";
+static char __pyx_k_34[] = "Filename '%s.tbi' already exists, use *force* to overwrite";
+static char __pyx_k_42[] = "unknown preset '%s', valid presets are '%s'";
+static char __pyx_k_43[] = ",";
+static char __pyx_k_44[] = "filename associated with this object.";
+static char __pyx_k_45[] = "the file header.\n          \n        .. note::\n            The header is returned as an iterator over lines without the\n            newline character.\n        ";
+static char __pyx_k_46[] = "chromosome names";
 static char __pyx_k__r[] = "r";
 static char __pyx_k__w[] = "w";
 static char __pyx_k__bc[] = "bc";
@@ -946,14 +970,14 @@ static char __pyx_k__asBed[] = "asBed";
 static char __pyx_k__asGTF[] = "asGTF";
 static char __pyx_k__asVCF[] = "asVCF";
 static char __pyx_k__close[] = "close";
-static char __pyx_k__fetch[] = "fetch";
 static char __pyx_k__force[] = "force";
 static char __pyx_k__start[] = "start";
 static char __pyx_k__types[] = "types";
+static char __pyx_k__append[] = "append";
 static char __pyx_k__buffer[] = "buffer";
+static char __pyx_k__ctabix[] = "ctabix";
 static char __pyx_k__ctypes[] = "ctypes";
 static char __pyx_k__exists[] = "exists";
-static char __pyx_k__header[] = "header";
 static char __pyx_k__parser[] = "parser";
 static char __pyx_k__pileup[] = "pileup";
 static char __pyx_k__preset[] = "preset";
@@ -964,7 +988,6 @@ static char __pyx_k__unlink[] = "unlink";
 static char __pyx_k__IOError[] = "IOError";
 static char __pyx_k__OSError[] = "OSError";
 static char __pyx_k____all__[] = "__all__";
-static char __pyx_k____get__[] = "__get__";
 static char __pyx_k___isOpen[] = "_isOpen";
 static char __pyx_k__asTuple[] = "asTuple";
 static char __pyx_k__end_col[] = "end_col";
@@ -972,13 +995,13 @@ static char __pyx_k__seq_col[] = "seq_col";
 static char __pyx_k__KeyError[] = "KeyError";
 static char __pyx_k__O_RDONLY[] = "O_RDONLY";
 static char __pyx_k____main__[] = "__main__";
-static char __pyx_k____next__[] = "__next__";
 static char __pyx_k____test__[] = "__test__";
 static char __pyx_k__endswith[] = "endswith";
 static char __pyx_k__filename[] = "filename";
 static char __pyx_k__iterator[] = "iterator";
 static char __pyx_k__tempfile[] = "tempfile";
 static char __pyx_k__Tabixfile[] = "Tabixfile";
+static char __pyx_k___filename[] = "_filename";
 static char __pyx_k__itertools[] = "itertools";
 static char __pyx_k__line_skip[] = "line_skip";
 static char __pyx_k__meta_char[] = "meta_char";
@@ -992,38 +1015,25 @@ static char __pyx_k__tabix_index[] = "tabix_index";
 static char __pyx_k___parseRegion[] = "_parseRegion";
 static char __pyx_k__filename_out[] = "filename_out";
 static char __pyx_k__StopIteration[] = "StopIteration";
-static char __pyx_k__TabixIterator[] = "TabixIterator";
 static char __pyx_k__tabix_compress[] = "tabix_compress";
-static char __pyx_k__TabixHeaderIterator[] = "TabixHeaderIterator";
-static char __pyx_k__TabixIteratorParsed[] = "TabixIteratorParsed";
 static PyObject *__pyx_kp_s_1;
 static PyObject *__pyx_kp_s_10;
 static PyObject *__pyx_kp_s_11;
-static PyObject *__pyx_kp_s_12;
-static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_kp_s_14;
 static PyObject *__pyx_kp_s_16;
-static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_18;
 static PyObject *__pyx_kp_s_2;
 static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_s_22;
+static PyObject *__pyx_kp_s_21;
 static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_kp_s_25;
-static PyObject *__pyx_kp_s_26;
-static PyObject *__pyx_kp_u_28;
-static PyObject *__pyx_kp_u_29;
+static PyObject *__pyx_kp_s_29;
 static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_u_30;
-static PyObject *__pyx_kp_u_31;
-static PyObject *__pyx_kp_u_32;
-static PyObject *__pyx_kp_u_33;
-static PyObject *__pyx_kp_u_34;
-static PyObject *__pyx_kp_u_35;
-static PyObject *__pyx_kp_u_36;
-static PyObject *__pyx_kp_u_37;
+static PyObject *__pyx_kp_s_31;
+static PyObject *__pyx_kp_s_32;
+static PyObject *__pyx_kp_s_34;
 static PyObject *__pyx_kp_s_4;
+static PyObject *__pyx_kp_s_42;
+static PyObject *__pyx_kp_s_43;
 static PyObject *__pyx_kp_s_5;
 static PyObject *__pyx_kp_s_6;
 static PyObject *__pyx_kp_s_7;
@@ -1034,19 +1044,16 @@ static PyObject *__pyx_n_s__KeyError;
 static PyObject *__pyx_n_s__OSError;
 static PyObject *__pyx_n_s__O_RDONLY;
 static PyObject *__pyx_n_s__StopIteration;
-static PyObject *__pyx_n_s__TabixHeaderIterator;
-static PyObject *__pyx_n_s__TabixIterator;
-static PyObject *__pyx_n_s__TabixIteratorParsed;
 static PyObject *__pyx_n_s__Tabixfile;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____all__;
-static PyObject *__pyx_n_s____get__;
 static PyObject *__pyx_n_s____main__;
-static PyObject *__pyx_n_s____next__;
 static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s___filename;
 static PyObject *__pyx_n_s___isOpen;
 static PyObject *__pyx_n_s___open;
 static PyObject *__pyx_n_s___parseRegion;
+static PyObject *__pyx_n_s__append;
 static PyObject *__pyx_n_s__asBed;
 static PyObject *__pyx_n_s__asGTF;
 static PyObject *__pyx_n_s__asTuple;
@@ -1056,13 +1063,13 @@ static PyObject *__pyx_n_s__bed;
 static PyObject *__pyx_n_s__buffer;
 static PyObject *__pyx_n_s__close;
 static PyObject *__pyx_n_s__copy;
+static PyObject *__pyx_n_s__ctabix;
 static PyObject *__pyx_n_s__ctypes;
 static PyObject *__pyx_n_s__ec;
 static PyObject *__pyx_n_s__end;
 static PyObject *__pyx_n_s__end_col;
 static PyObject *__pyx_n_s__endswith;
 static PyObject *__pyx_n_s__exists;
-static PyObject *__pyx_n_s__fetch;
 static PyObject *__pyx_n_s__filename;
 static PyObject *__pyx_n_s__filename_in;
 static PyObject *__pyx_n_s__filename_out;
@@ -1070,7 +1077,6 @@ static PyObject *__pyx_n_s__force;
 static PyObject *__pyx_n_s__fp;
 static PyObject *__pyx_n_s__gff;
 static PyObject *__pyx_n_s__gzip;
-static PyObject *__pyx_n_s__header;
 static PyObject *__pyx_n_s__idx;
 static PyObject *__pyx_n_s__iterator;
 static PyObject *__pyx_n_s__itertools;
@@ -1117,12 +1123,29 @@ static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_int_15;
 static PyObject *__pyx_int_17;
 static PyObject *__pyx_int_18;
-static PyObject *__pyx_int_0x10000;
-static PyObject *__pyx_k_14;
+static PyObject *__pyx_int_65536;
 static PyObject *__pyx_k_19;
-static PyObject *__pyx_k_21;
-
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":15
+static PyObject *__pyx_k_28;
+static PyObject *__pyx_k_30;
+static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_17;
+static PyObject *__pyx_k_tuple_18;
+static PyObject *__pyx_k_tuple_22;
+static PyObject *__pyx_k_tuple_24;
+static PyObject *__pyx_k_tuple_26;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_33;
+static PyObject *__pyx_k_tuple_35;
+static PyObject *__pyx_k_tuple_36;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_38;
+static PyObject *__pyx_k_tuple_39;
+static PyObject *__pyx_k_tuple_40;
+static PyObject *__pyx_k_tuple_41;
+
+/* "ctabix.pyx":15
  *     '''
  * 
  *     def __cinit__(self, *args, **kwargs ):             # <<<<<<<<<<<<<<
@@ -1146,7 +1169,7 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObjec
   __Pyx_INCREF(__pyx_args);
   __pyx_v_args = __pyx_args;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":16
+  /* "ctabix.pyx":16
  * 
  *     def __cinit__(self, *args, **kwargs ):
  *         self.tabixfile = NULL             # <<<<<<<<<<<<<<
@@ -1155,7 +1178,7 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObjec
  */
   ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":17
+  /* "ctabix.pyx":17
  *     def __cinit__(self, *args, **kwargs ):
  *         self.tabixfile = NULL
  *         self._open( *args, **kwargs )             # <<<<<<<<<<<<<<
@@ -1187,7 +1210,7 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":19
+/* "ctabix.pyx":19
  *         self._open( *args, **kwargs )
  * 
  *     def _isOpen( self ):             # <<<<<<<<<<<<<<
@@ -1195,14 +1218,14 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObjec
  *         return self.tabixfile != NULL
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile__isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile__isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pf_6ctabix_9Tabixfile__isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6ctabix_9Tabixfile_1_isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened.";
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("_isOpen");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":21
+  /* "ctabix.pyx":21
  *     def _isOpen( self ):
  *         '''return true if samfile has been opened.'''
  *         return self.tabixfile != NULL             # <<<<<<<<<<<<<<
@@ -1228,7 +1251,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__isOpen(PyObject *__pyx_v_self, CYT
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":23
+/* "ctabix.pyx":23
  *         return self.tabixfile != NULL
  * 
  *     def _open( self,             # <<<<<<<<<<<<<<
@@ -1236,9 +1259,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__isOpen(PyObject *__pyx_v_self, CYT
  *                mode ='r',
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile__open[] = "Tabixfile._open(self, char *filename, mode='r')\nopen a :term:`tabix file` for reading.\n        ";
-static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6ctabix_9Tabixfile_2_open[] = "Tabixfile._open(self, char *filename, mode='r')\nopen a :term:`tabix file` for reading.\n        ";
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_filename;
   PyObject *__pyx_v_mode = 0;
   PyObject *__pyx_v_filename_index;
@@ -1296,14 +1319,14 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObj
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_filename_index = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":30
+  /* "ctabix.pyx":30
  *         '''
  * 
  *         assert mode in ( "r",), "invalid file opening mode `%s`" % mode             # <<<<<<<<<<<<<<
  * 
  *         # close a previously opened file
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   __Pyx_INCREF(__pyx_v_mode);
   __pyx_t_1 = __pyx_v_mode;
   __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1320,7 +1343,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObj
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":33
+  /* "ctabix.pyx":33
  * 
  *         # close a previously opened file
  *         if self.tabixfile != NULL: self.close()             # <<<<<<<<<<<<<<
@@ -1339,200 +1362,214 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObj
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":34
+  /* "ctabix.pyx":34
  *         # close a previously opened file
  *         if self.tabixfile != NULL: self.close()
  *         self.tabixfile = NULL             # <<<<<<<<<<<<<<
  * 
- *         self.filename = filename
+ *         if self._filename != NULL: free(self._filename )
  */
   ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":36
+  /* "ctabix.pyx":36
  *         self.tabixfile = NULL
  * 
- *         self.filename = filename             # <<<<<<<<<<<<<<
- *         filename_index = filename + ".tbi"
+ *         if self._filename != NULL: free(self._filename )             # <<<<<<<<<<<<<<
+ *         self._filename = strdup( filename )
+ * 
+ */
+  __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename != NULL);
+  if (__pyx_t_3) {
+    free(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename);
+    goto __pyx_L7;
+  }
+  __pyx_L7:;
+
+  /* "ctabix.pyx":37
+ * 
+ *         if self._filename != NULL: free(self._filename )
+ *         self._filename = strdup( filename )             # <<<<<<<<<<<<<<
  * 
+ *         filename_index = filename + ".tbi"
  */
-  ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->filename = __pyx_v_filename;
+  ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":37
+  /* "ctabix.pyx":39
+ *         self._filename = strdup( filename )
  * 
- *         self.filename = filename
  *         filename_index = filename + ".tbi"             # <<<<<<<<<<<<<<
  * 
  *         if mode[0] == 'w':
  */
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_filename_index);
   __pyx_v_filename_index = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":39
+  /* "ctabix.pyx":41
  *         filename_index = filename + ".tbi"
  * 
  *         if mode[0] == 'w':             # <<<<<<<<<<<<<<
  *             # open file for writing
  *             pass
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
-    goto __pyx_L7;
+    goto __pyx_L8;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":43
+  /* "ctabix.pyx":45
  *             pass
  * 
  *         elif mode[0] == "r":             # <<<<<<<<<<<<<<
  *             # open file for reading
- *             if not os.path.exists( self.filename ):
+ *             if not os.path.exists( self._filename ):
  */
-  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":45
+    /* "ctabix.pyx":47
  *         elif mode[0] == "r":
  *             # open file for reading
- *             if not os.path.exists( self.filename ):             # <<<<<<<<<<<<<<
- *                 raise IOError( "file `%s` not found" % self.filename)
+ *             if not os.path.exists( self._filename ):             # <<<<<<<<<<<<<<
+ *                 raise IOError( "file `%s` not found" % self._filename)
  * 
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_5 = (!__pyx_t_3);
     if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":46
+      /* "ctabix.pyx":48
  *             # open file for reading
- *             if not os.path.exists( self.filename ):
- *                 raise IOError( "file `%s` not found" % self.filename)             # <<<<<<<<<<<<<<
+ *             if not os.path.exists( self._filename ):
+ *                 raise IOError( "file `%s` not found" % self._filename)             # <<<<<<<<<<<<<<
  * 
  *             if not os.path.exists( filename_index ):
  */
-      __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
       __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_4, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L9;
     }
-    __pyx_L8:;
+    __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":48
- *                 raise IOError( "file `%s` not found" % self.filename)
+    /* "ctabix.pyx":50
+ *                 raise IOError( "file `%s` not found" % self._filename)
  * 
  *             if not os.path.exists( filename_index ):             # <<<<<<<<<<<<<<
  *                 raise IOError( "index `%s` not found" % filename_index)
  * 
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_filename_index);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename_index);
     __Pyx_GIVEREF(__pyx_v_filename_index);
-    __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = (!__pyx_t_5);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":49
+      /* "ctabix.pyx":51
  * 
  *             if not os.path.exists( filename_index ):
  *                 raise IOError( "index `%s` not found" % filename_index)             # <<<<<<<<<<<<<<
  * 
  *             # open file and load index
  */
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_1, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L9;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L10;
     }
-    __pyx_L9:;
+    __pyx_L10:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":52
+    /* "ctabix.pyx":54
  * 
  *             # open file and load index
- *             self.tabixfile = ti_open( self.filename, filename_index )             # <<<<<<<<<<<<<<
+ *             self.tabixfile = ti_open( self._filename, filename_index )             # <<<<<<<<<<<<<<
  * 
  *         if self.tabixfile == NULL:
  */
-    __pyx_t_6 = PyBytes_AsString(__pyx_v_filename_index); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = ti_open(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->filename, __pyx_t_6);
-    goto __pyx_L7;
+    __pyx_t_6 = PyBytes_AsString(__pyx_v_filename_index); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = ti_open(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename, __pyx_t_6);
+    goto __pyx_L8;
   }
-  __pyx_L7:;
+  __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":54
- *             self.tabixfile = ti_open( self.filename, filename_index )
+  /* "ctabix.pyx":56
+ *             self.tabixfile = ti_open( self._filename, filename_index )
  * 
  *         if self.tabixfile == NULL:             # <<<<<<<<<<<<<<
  *             raise IOError("could not open file `%s`" % filename )
@@ -1541,32 +1578,32 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObj
   __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile == NULL);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":55
+    /* "ctabix.pyx":57
  * 
  *         if self.tabixfile == NULL:
  *             raise IOError("could not open file `%s`" % filename )             # <<<<<<<<<<<<<<
  * 
  *     def _parseRegion( self,
  */
-    __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L10;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L11;
   }
-  __pyx_L10:;
+  __pyx_L11:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -1583,7 +1620,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObj
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":57
+/* "ctabix.pyx":59
  *             raise IOError("could not open file `%s`" % filename )
  * 
  *     def _parseRegion( self,             # <<<<<<<<<<<<<<
@@ -1591,9 +1628,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__open(PyObject *__pyx_v_self, PyObj
  *                       start = None,
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile__parseRegion[] = "Tabixfile._parseRegion(self, reference=None, start=None, end=None, region=None)\nparse region information.\n\n        raise ValueError for for invalid regions.\n\n        returns a tuple of region, tid, start and end. Region\n        is a valid samtools :term:`region` or None if the region\n        extends over the whole file.\n\n        Note that regions are 1-based, while start,end are python coordinates.\n        ";
-static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_3_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6ctabix_9Tabixfile_3_parseRegion[] = "Tabixfile._parseRegion(self, reference=None, start=None, end=None, region=None)\nparse region information.\n\n        raise ValueError for for invalid regions.\n\n        returns a tuple of region, tid, start and end. Region\n        is a valid samtools :term:`region` or None if the region\n        extends over the whole file.\n\n        Note that regions are 1-based, while start,end are python coordinates.\n        ";
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_3_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -1617,7 +1654,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[4] = {0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":58
+    /* "ctabix.pyx":60
  * 
  *     def _parseRegion( self,
  *                       reference = None,             # <<<<<<<<<<<<<<
@@ -1626,7 +1663,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":59
+    /* "ctabix.pyx":61
  *     def _parseRegion( self,
  *                       reference = None,
  *                       start = None,             # <<<<<<<<<<<<<<
@@ -1635,7 +1672,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":60
+    /* "ctabix.pyx":62
  *                       reference = None,
  *                       start = None,
  *                       end = None,             # <<<<<<<<<<<<<<
@@ -1644,7 +1681,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":61
+    /* "ctabix.pyx":63
  *                       start = None,
  *                       end = None,
  *                       region = None ):             # <<<<<<<<<<<<<<
@@ -1683,7 +1720,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_reference = values[0];
     __pyx_v_start = values[1];
@@ -1691,7 +1728,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     __pyx_v_region = values[3];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":58
+    /* "ctabix.pyx":60
  * 
  *     def _parseRegion( self,
  *                       reference = None,             # <<<<<<<<<<<<<<
@@ -1700,7 +1737,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":59
+    /* "ctabix.pyx":61
  *     def _parseRegion( self,
  *                       reference = None,
  *                       start = None,             # <<<<<<<<<<<<<<
@@ -1709,7 +1746,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":60
+    /* "ctabix.pyx":62
  *                       reference = None,
  *                       start = None,
  *                       end = None,             # <<<<<<<<<<<<<<
@@ -1718,7 +1755,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":61
+    /* "ctabix.pyx":63
  *                       start = None,
  *                       end = None,
  *                       region = None ):             # <<<<<<<<<<<<<<
@@ -1737,7 +1774,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion");
   __Pyx_RefNannyFinishContext();
@@ -1745,7 +1782,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   __pyx_L4_argument_unpacking_done:;
   __Pyx_INCREF(__pyx_v_region);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":72
+  /* "ctabix.pyx":74
  *         Note that regions are 1-based, while start,end are python coordinates.
  *         '''
  *         ti_lazy_index_load( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -1754,7 +1791,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
   ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":78
+  /* "ctabix.pyx":80
  *         cdef int rend
  *         cdef int max_pos
  *         max_pos = 2 << 29             # <<<<<<<<<<<<<<
@@ -1763,7 +1800,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
   __pyx_v_max_pos = 1073741824;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":80
+  /* "ctabix.pyx":82
  *         max_pos = 2 << 29
  * 
  *         rtid = rstart = rend = 0             # <<<<<<<<<<<<<<
@@ -1774,31 +1811,31 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   __pyx_v_rstart = 0;
   __pyx_v_rend = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":83
+  /* "ctabix.pyx":85
  * 
  *         # translate to a region
  *         if reference:             # <<<<<<<<<<<<<<
  *             if start != None and end != None:
  *                 region = "%s:%i-%i" % (reference, start+1, end)
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":84
+    /* "ctabix.pyx":86
  *         # translate to a region
  *         if reference:
  *             if start != None and end != None:             # <<<<<<<<<<<<<<
  *                 region = "%s:%i-%i" % (reference, start+1, end)
  *             elif start == None and end != None:
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_1) {
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_4 = __pyx_t_3;
     } else {
@@ -1806,17 +1843,17 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     }
     if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":85
+      /* "ctabix.pyx":87
  *         if reference:
  *             if start != None and end != None:
  *                 region = "%s:%i-%i" % (reference, start+1, end)             # <<<<<<<<<<<<<<
  *             elif start == None and end != None:
  *                 region = "%s:%i-%i" % (reference, 1, end)
  */
-      __pyx_t_2 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_reference);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference);
       __Pyx_GIVEREF(__pyx_v_reference);
@@ -1826,30 +1863,30 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
       PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end);
       __Pyx_GIVEREF(__pyx_v_end);
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_v_region);
       __pyx_v_region = ((PyObject *)__pyx_t_2);
       __pyx_t_2 = 0;
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":86
+    /* "ctabix.pyx":88
  *             if start != None and end != None:
  *                 region = "%s:%i-%i" % (reference, start+1, end)
  *             elif start == None and end != None:             # <<<<<<<<<<<<<<
  *                 region = "%s:%i-%i" % (reference, 1, end)
  *             elif end == None and start != None:
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_4) {
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_3 = __pyx_t_1;
     } else {
@@ -1857,15 +1894,15 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     }
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":87
+      /* "ctabix.pyx":89
  *                 region = "%s:%i-%i" % (reference, start+1, end)
  *             elif start == None and end != None:
  *                 region = "%s:%i-%i" % (reference, 1, end)             # <<<<<<<<<<<<<<
  *             elif end == None and start != None:
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)
  */
-      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_reference);
       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
       __Pyx_GIVEREF(__pyx_v_reference);
@@ -1875,30 +1912,30 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
       __Pyx_INCREF(__pyx_v_end);
       PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
       __Pyx_GIVEREF(__pyx_v_end);
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_v_region);
       __pyx_v_region = ((PyObject *)__pyx_t_5);
       __pyx_t_5 = 0;
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":88
+    /* "ctabix.pyx":90
  *             elif start == None and end != None:
  *                 region = "%s:%i-%i" % (reference, 1, end)
  *             elif end == None and start != None:             # <<<<<<<<<<<<<<
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)
  *             else:
  */
-    __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_3) {
-      __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_1 = __pyx_t_4;
     } else {
@@ -1906,19 +1943,19 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     }
     if (__pyx_t_1) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":89
+      /* "ctabix.pyx":91
  *                 region = "%s:%i-%i" % (reference, 1, end)
  *             elif end == None and start != None:
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)             # <<<<<<<<<<<<<<
  *             else:
  *                 region = reference
  */
-      __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyInt_FromLong((__pyx_v_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong((__pyx_v_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_INCREF(__pyx_v_reference);
       PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference);
       __Pyx_GIVEREF(__pyx_v_reference);
@@ -1928,9 +1965,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
       __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_5 = 0;
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_v_region);
       __pyx_v_region = ((PyObject *)__pyx_t_2);
       __pyx_t_2 = 0;
@@ -1938,7 +1975,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":91
+      /* "ctabix.pyx":93
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)
  *             else:
  *                 region = reference             # <<<<<<<<<<<<<<
@@ -1954,27 +1991,27 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":93
+  /* "ctabix.pyx":95
  *                 region = reference
  * 
  *         if region:             # <<<<<<<<<<<<<<
  *             ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)
  *             if rtid < 0: raise ValueError( "invalid region `%s`" % region )
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":94
+    /* "ctabix.pyx":96
  * 
  *         if region:
  *             ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)             # <<<<<<<<<<<<<<
  *             if rtid < 0: raise ValueError( "invalid region `%s`" % region )
  *             if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
  */
-    __pyx_t_7 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     ti_parse_region(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile->idx, __pyx_t_7, (&__pyx_v_rtid), (&__pyx_v_rstart), (&__pyx_v_rend));
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":95
+    /* "ctabix.pyx":97
  *         if region:
  *             ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)
  *             if rtid < 0: raise ValueError( "invalid region `%s`" % region )             # <<<<<<<<<<<<<<
@@ -1983,24 +2020,24 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     __pyx_t_1 = (__pyx_v_rtid < 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_v_region); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_v_region); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":96
+    /* "ctabix.pyx":98
  *             ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)
  *             if rtid < 0: raise ValueError( "invalid region `%s`" % region )
  *             if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )             # <<<<<<<<<<<<<<
@@ -2009,37 +2046,37 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  */
     __pyx_t_1 = (__pyx_v_rstart > __pyx_v_rend);
     if (__pyx_t_1) {
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
       __Pyx_GIVEREF(__pyx_t_6);
       __pyx_t_2 = 0;
       __pyx_t_6 = 0;
-      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
       __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __Pyx_Raise(__pyx_t_6, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L10;
     }
     __pyx_L10:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":97
+    /* "ctabix.pyx":99
  *             if rtid < 0: raise ValueError( "invalid region `%s`" % region )
  *             if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
  *             if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )             # <<<<<<<<<<<<<<
@@ -2052,27 +2089,27 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     }
     __pyx_t_3 = (!__pyx_t_1);
     if (__pyx_t_3) {
-      __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_Raise(__pyx_t_5, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L11;
     }
     __pyx_L11:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":98
+    /* "ctabix.pyx":100
  *             if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
  *             if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
  *             if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )             # <<<<<<<<<<<<<<
@@ -2085,22 +2122,22 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
     }
     __pyx_t_1 = (!__pyx_t_3);
     if (__pyx_t_1) {
-      __pyx_t_5 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
       __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __Pyx_Raise(__pyx_t_6, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L12;
     }
     __pyx_L12:;
@@ -2108,7 +2145,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":100
+  /* "ctabix.pyx":102
  *             if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
  * 
  *         return region, rtid, rstart, rend             # <<<<<<<<<<<<<<
@@ -2116,14 +2153,14 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  *     def fetch( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
   __Pyx_INCREF(__pyx_v_region);
   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_region);
   __Pyx_GIVEREF(__pyx_v_region);
@@ -2136,7 +2173,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   __pyx_t_6 = 0;
   __pyx_t_5 = 0;
   __pyx_t_2 = 0;
-  __pyx_r = __pyx_t_8;
+  __pyx_r = ((PyObject *)__pyx_t_8);
   __pyx_t_8 = 0;
   goto __pyx_L0;
 
@@ -2156,7 +2193,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":102
+/* "ctabix.pyx":104
  *         return region, rtid, rstart, rend
  * 
  *     def fetch( self,             # <<<<<<<<<<<<<<
@@ -2164,9 +2201,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile__parseRegion(PyObject *__pyx_v_self
  *                start = None,
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile_fetch[] = "Tabixfile.fetch(self, reference=None, start=None, end=None, region=None, parser=None)\n\n               \n        fetch one or more rows in a :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n        Without *reference* or *region* all entries will be fetched. \n        \n        If only *reference* is set, all reads matching on *reference* will be fetched.\n\n        If *parser* is None, the results are returned as an unparsed string.\n        Otherwise, *parser* is assumed to be a functor that will return parsed \n        data (see for example :meth:`asTuple` and :meth:`asGTF`).\n        ";
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_4fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6ctabix_9Tabixfile_4fetch[] = "Tabixfile.fetch(self, reference=None, start=None, end=None, region=None, parser=None)\n\n               \n        fetch one or more rows in a :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n        Without *reference* or *region* all entries will be fetched. \n        \n        If only *reference* is set, all reads matching on *reference* will be fetched.\n\n        If *parser* is None, the results are returned as an unparsed string.\n        Otherwise, *parser* is assumed to be a functor that will return parsed \n        data (see for example :meth:`asTuple` and :meth:`asGTF`).\n        ";
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_4fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
@@ -2190,7 +2227,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[5] = {0,0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":103
+    /* "ctabix.pyx":105
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -2199,7 +2236,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":104
+    /* "ctabix.pyx":106
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -2208,7 +2245,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":105
+    /* "ctabix.pyx":107
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -2217,7 +2254,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":106
+    /* "ctabix.pyx":108
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -2226,7 +2263,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":107
+    /* "ctabix.pyx":109
  *                end = None,
  *                region = None,
  *                parser = None ):             # <<<<<<<<<<<<<<
@@ -2271,7 +2308,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_reference = values[0];
     __pyx_v_start = values[1];
@@ -2280,7 +2317,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
     __pyx_v_parser = values[4];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":103
+    /* "ctabix.pyx":105
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -2289,7 +2326,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":104
+    /* "ctabix.pyx":106
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -2298,7 +2335,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":105
+    /* "ctabix.pyx":107
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -2307,7 +2344,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":106
+    /* "ctabix.pyx":108
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -2316,7 +2353,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
     __pyx_v_region = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":107
+    /* "ctabix.pyx":109
  *                end = None,
  *                region = None,
  *                parser = None ):             # <<<<<<<<<<<<<<
@@ -2336,7 +2373,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.Tabixfile.fetch");
   __Pyx_RefNannyFinishContext();
@@ -2347,7 +2384,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
   __pyx_v_rstart = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_rend = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":121
+  /* "ctabix.pyx":123
  *         data (see for example :meth:`asTuple` and :meth:`asGTF`).
  *         '''
  *         ti_lazy_index_load( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -2356,85 +2393,79 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  */
   ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":123
+  /* "ctabix.pyx":125
  *         ti_lazy_index_load( self.tabixfile )
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":124
+    /* "ctabix.pyx":126
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_11));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":126
+  /* "ctabix.pyx":128
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
  *         if parser == None:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
   __Pyx_INCREF(__pyx_v_start);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_start);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
   __Pyx_GIVEREF(__pyx_v_start);
   __Pyx_INCREF(__pyx_v_end);
-  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
   __Pyx_GIVEREF(__pyx_v_end);
   __Pyx_INCREF(__pyx_v_region);
-  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_region);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
   __Pyx_GIVEREF(__pyx_v_region);
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
     PyObject* tuple = __pyx_t_5;
-    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
-    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
     __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
     __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_v_region);
-    __pyx_v_region = __pyx_t_2;
-    __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_v_rtid);
-    __pyx_v_rtid = __pyx_t_1;
+    __pyx_v_region = __pyx_t_1;
     __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_rtid);
+    __pyx_v_rtid = __pyx_t_2;
+    __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_rstart);
     __pyx_v_rstart = __pyx_t_6;
     __pyx_t_6 = 0;
@@ -2442,25 +2473,25 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
     __pyx_v_rend = __pyx_t_7;
     __pyx_t_7 = 0;
   } else {
-    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    if (__Pyx_EndUnpack(__pyx_t_8, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_EndUnpack(__pyx_t_8, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __Pyx_DECREF(__pyx_v_region);
-    __pyx_v_region = __pyx_t_2;
-    __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_v_rtid);
-    __pyx_v_rtid = __pyx_t_1;
+    __pyx_v_region = __pyx_t_1;
     __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_rtid);
+    __pyx_v_rtid = __pyx_t_2;
+    __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_rstart);
     __pyx_v_rstart = __pyx_t_6;
     __pyx_t_6 = 0;
@@ -2469,30 +2500,30 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
     __pyx_t_7 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":128
+  /* "ctabix.pyx":130
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  * 
  *         if parser == None:             # <<<<<<<<<<<<<<
  *             if region:
  *                 return TabixIterator( self, rtid, rstart, rend )
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":129
+    /* "ctabix.pyx":131
  * 
  *         if parser == None:
  *             if region:             # <<<<<<<<<<<<<<
  *                 return TabixIterator( self, rtid, rstart, rend )
  *             else:
  */
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":130
+      /* "ctabix.pyx":132
  *         if parser == None:
  *             if region:
  *                 return TabixIterator( self, rtid, rstart, rend )             # <<<<<<<<<<<<<<
@@ -2500,8 +2531,8 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  *                 return TabixIterator( self, -1, 0, 0 )
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_self);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
       __Pyx_GIVEREF(__pyx_v_self);
@@ -2514,9 +2545,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
       __Pyx_INCREF(__pyx_v_rend);
       PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend);
       __Pyx_GIVEREF(__pyx_v_rend);
-      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __pyx_r = __pyx_t_7;
       __pyx_t_7 = 0;
       goto __pyx_L0;
@@ -2524,7 +2555,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":132
+      /* "ctabix.pyx":134
  *                 return TabixIterator( self, rtid, rstart, rend )
  *             else:
  *                 return TabixIterator( self, -1, 0, 0 )             # <<<<<<<<<<<<<<
@@ -2532,8 +2563,8 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  *             if region:
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_INCREF(__pyx_v_self);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
       __Pyx_GIVEREF(__pyx_v_self);
@@ -2546,9 +2577,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
       __Pyx_INCREF(__pyx_int_0);
       PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0);
       __Pyx_GIVEREF(__pyx_int_0);
-      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __pyx_r = __pyx_t_5;
       __pyx_t_5 = 0;
       goto __pyx_L0;
@@ -2558,17 +2589,17 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":134
+    /* "ctabix.pyx":136
  *                 return TabixIterator( self, -1, 0, 0 )
  *         else:
  *             if region:             # <<<<<<<<<<<<<<
  *                 return TabixIteratorParsed( self, rtid, rstart, rend, parser )
  *             else:
  */
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":135
+      /* "ctabix.pyx":137
  *         else:
  *             if region:
  *                 return TabixIteratorParsed( self, rtid, rstart, rend, parser )             # <<<<<<<<<<<<<<
@@ -2576,8 +2607,8 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
  *                 return TabixIteratorParsed( self, -1, 0, 0, parser )
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_self);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
       __Pyx_GIVEREF(__pyx_v_self);
@@ -2593,9 +2624,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
       __Pyx_INCREF(__pyx_v_parser);
       PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_parser);
       __Pyx_GIVEREF(__pyx_v_parser);
-      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __pyx_r = __pyx_t_7;
       __pyx_t_7 = 0;
       goto __pyx_L0;
@@ -2603,16 +2634,16 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":137
+      /* "ctabix.pyx":139
  *                 return TabixIteratorParsed( self, rtid, rstart, rend, parser )
  *             else:
  *                 return TabixIteratorParsed( self, -1, 0, 0, parser )             # <<<<<<<<<<<<<<
  * 
- *     property header:
+ *     ###############################################################
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_INCREF(__pyx_v_self);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
       __Pyx_GIVEREF(__pyx_v_self);
@@ -2628,9 +2659,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
       __Pyx_INCREF(__pyx_v_parser);
       PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_parser);
       __Pyx_GIVEREF(__pyx_v_parser);
-      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __pyx_r = __pyx_t_5;
       __pyx_t_5 = 0;
       goto __pyx_L0;
@@ -2660,11 +2691,80 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_fetch(PyObject *__pyx_v_self, PyObj
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":140
+/* "ctabix.pyx":148
+ *     property filename:
+ *         '''filename associated with this object.'''
+ *         def __get__(self):             # <<<<<<<<<<<<<<
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             return self._filename
+ */
+
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  __Pyx_RefNannySetupContext("__get__");
+
+  /* "ctabix.pyx":149
+ *         '''filename associated with this object.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return self._filename
+ * 
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_4 = (!__pyx_t_3);
+  if (__pyx_t_4) {
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "ctabix.pyx":150
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+ *             return self._filename             # <<<<<<<<<<<<<<
  * 
  *     property header:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("ctabix.Tabixfile.filename.__get__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "ctabix.pyx":160
+ *         '''
+ * 
  *         def __get__( self ):             # <<<<<<<<<<<<<<
- *             '''return header lines as an iterator.
+ *             return TabixHeaderIterator( self )
  * 
  */
 
@@ -2675,22 +2775,22 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(PyObject *__pyx_v_s
   PyObject *__pyx_t_2 = NULL;
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":145
- *             Note that the header lines do not contain the newline '\n' character.
- *             '''
+  /* "ctabix.pyx":161
+ * 
+ *         def __get__( self ):
  *             return TabixHeaderIterator( self )             # <<<<<<<<<<<<<<
  * 
  *     property contigs:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
   __Pyx_GIVEREF(__pyx_v_self);
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixHeaderIterator)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixHeaderIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
   goto __pyx_L0;
@@ -2708,7 +2808,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":149
+/* "ctabix.pyx":165
  *     property contigs:
  *         '''chromosome names'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -2727,9 +2827,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_
   int __pyx_t_2;
   int __pyx_t_3;
   __Pyx_RefNannySetupContext("__get__");
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":153
+  /* "ctabix.pyx":169
  *             cdef int nsequences
  * 
  *             ti_lazy_index_load( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -2738,7 +2838,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_
  */
   ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":154
+  /* "ctabix.pyx":170
  * 
  *             ti_lazy_index_load( self.tabixfile )
  *             sequences = ti_seqname( self.tabixfile.idx, &nsequences )             # <<<<<<<<<<<<<<
@@ -2747,20 +2847,20 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_
  */
   __pyx_v_sequences = ti_seqname(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile->idx, (&__pyx_v_nsequences));
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":156
+  /* "ctabix.pyx":172
  *             sequences = ti_seqname( self.tabixfile.idx, &nsequences )
  *             cdef int x
  *             result = []             # <<<<<<<<<<<<<<
  *             for x from 0 <= x < nsequences:
  *                 result.append( sequences[x] )
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_v_result));
   __pyx_v_result = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":157
+  /* "ctabix.pyx":173
  *             cdef int x
  *             result = []
  *             for x from 0 <= x < nsequences:             # <<<<<<<<<<<<<<
@@ -2770,7 +2870,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_
   __pyx_t_2 = __pyx_v_nsequences;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":158
+    /* "ctabix.pyx":174
  *             result = []
  *             for x from 0 <= x < nsequences:
  *                 result.append( sequences[x] )             # <<<<<<<<<<<<<<
@@ -2778,20 +2878,20 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_
  * 
  */
     if (unlikely(__pyx_v_result == Py_None)) {
-      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_1 = PyBytes_FromString((__pyx_v_sequences[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyBytes_FromString((__pyx_v_sequences[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":159
+  /* "ctabix.pyx":175
  *             for x from 0 <= x < nsequences:
  *                 result.append( sequences[x] )
  *             return result             # <<<<<<<<<<<<<<
  * 
- * cdef class TabixIterator:
+ *     def close( self ):
  */
   __Pyx_XDECREF(__pyx_r);
   __Pyx_INCREF(((PyObject *)__pyx_v_result));
@@ -2811,7 +2911,120 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":169
+/* "ctabix.pyx":177
+ *             return result
+ * 
+ *     def close( self ):             # <<<<<<<<<<<<<<
+ *         '''
+ *         closes the :class:`pysam.Tabixfile`.'''
+ */
+
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_6ctabix_9Tabixfile_5close[] = "Tabixfile.close(self)\n\n        closes the :class:`pysam.Tabixfile`.";
+static PyObject *__pyx_pf_6ctabix_9Tabixfile_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+  PyObject *__pyx_r = NULL;
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("close");
+
+  /* "ctabix.pyx":180
+ *         '''
+ *         closes the :class:`pysam.Tabixfile`.'''
+ *         if self.tabixfile != NULL:             # <<<<<<<<<<<<<<
+ *             ti_close( self.tabixfile )
+ *             self.tabixfile = NULL
+ */
+  __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL);
+  if (__pyx_t_1) {
+
+    /* "ctabix.pyx":181
+ *         closes the :class:`pysam.Tabixfile`.'''
+ *         if self.tabixfile != NULL:
+ *             ti_close( self.tabixfile )             # <<<<<<<<<<<<<<
+ *             self.tabixfile = NULL
+ * 
+ */
+    ti_close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
+
+    /* "ctabix.pyx":182
+ *         if self.tabixfile != NULL:
+ *             ti_close( self.tabixfile )
+ *             self.tabixfile = NULL             # <<<<<<<<<<<<<<
+ * 
+ *     def __dealloc__( self ):
+ */
+    ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "ctabix.pyx":184
+ *             self.tabixfile = NULL
+ * 
+ *     def __dealloc__( self ):             # <<<<<<<<<<<<<<
+ *         # remember: dealloc cannot call other python methods
+ *         # note: no doc string
+ */
+
+static void __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(PyObject *__pyx_v_self) {
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("__dealloc__");
+
+  /* "ctabix.pyx":188
+ *         # note: no doc string
+ *         # note: __del__ is not called.
+ *         if self.tabixfile != NULL:             # <<<<<<<<<<<<<<
+ *             ti_close( self.tabixfile )
+ *             self.tabixfile = NULL
+ */
+  __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL);
+  if (__pyx_t_1) {
+
+    /* "ctabix.pyx":189
+ *         # note: __del__ is not called.
+ *         if self.tabixfile != NULL:
+ *             ti_close( self.tabixfile )             # <<<<<<<<<<<<<<
+ *             self.tabixfile = NULL
+ *         if self._filename != NULL: free( self._filename )
+ */
+    ti_close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
+
+    /* "ctabix.pyx":190
+ *         if self.tabixfile != NULL:
+ *             ti_close( self.tabixfile )
+ *             self.tabixfile = NULL             # <<<<<<<<<<<<<<
+ *         if self._filename != NULL: free( self._filename )
+ * 
+ */
+    ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "ctabix.pyx":191
+ *             ti_close( self.tabixfile )
+ *             self.tabixfile = NULL
+ *         if self._filename != NULL: free( self._filename )             # <<<<<<<<<<<<<<
+ * 
+ * cdef class TabixIterator:
+ */
+  __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename != NULL);
+  if (__pyx_t_1) {
+    free(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename);
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  __Pyx_RefNannyFinishContext();
+}
+
+/* "ctabix.pyx":201
  *     cdef tabix_t * tabixfile
  * 
  *     def __cinit__(self, Tabixfile tabixfile,             # <<<<<<<<<<<<<<
@@ -2851,68 +3064,68 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
       if (likely(values[2])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  3:
       values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
       if (likely(values[3])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
-    __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
     goto __pyx_L5_argtuple_error;
   } else {
     __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0));
-    __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":172
+  /* "ctabix.pyx":204
  *                   int tid, int start, int end ):
  * 
  *         assert tabixfile._isOpen()             # <<<<<<<<<<<<<<
  * 
  *         # makes sure that samfile stays alive as long as the
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":176
+  /* "ctabix.pyx":208
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive.
  *         self.tabixfile = tabixfile.tabixfile             # <<<<<<<<<<<<<<
@@ -2921,7 +3134,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
  */
   ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":178
+  /* "ctabix.pyx":210
  *         self.tabixfile = tabixfile.tabixfile
  * 
  *         if tid < 0:             # <<<<<<<<<<<<<<
@@ -2931,7 +3144,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
   __pyx_t_3 = (__pyx_v_tid < 0);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":181
+    /* "ctabix.pyx":213
  *             # seek to start of file to ensure iteration is over
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)             # <<<<<<<<<<<<<<
@@ -2940,7 +3153,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
  */
     bgzf_seek(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile->fp, 0, 0);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":182
+    /* "ctabix.pyx":214
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)
  *             self.iterator = ti_iter_first()             # <<<<<<<<<<<<<<
@@ -2952,7 +3165,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":184
+    /* "ctabix.pyx":216
  *             self.iterator = ti_iter_first()
  *         else:
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)             # <<<<<<<<<<<<<<
@@ -2963,7 +3176,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":186
+  /* "ctabix.pyx":218
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)
  * 
  *         if <void*>self.iterator == NULL:             # <<<<<<<<<<<<<<
@@ -2973,24 +3186,18 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
   __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator) == NULL);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":187
+    /* "ctabix.pyx":219
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
  * 
  *     def __iter__(self):
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_12));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
@@ -3007,7 +3214,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":189
+/* "ctabix.pyx":221
  *             raise ValueError("malformatted query or wrong sequence name.\n")
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -3015,12 +3222,12 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, Py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_13TabixIterator___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_6ctabix_13TabixIterator___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_6ctabix_13TabixIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_6ctabix_13TabixIterator_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannySetupContext("__iter__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":190
+  /* "ctabix.pyx":222
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -3039,7 +3246,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___iter__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":192
+/* "ctabix.pyx":224
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -3047,10 +3254,10 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___iter__(PyObject *__pyx_v_sel
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_13TabixIterator___next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_6ctabix_13TabixIterator___next__;
-static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_6ctabix_13TabixIterator_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__;
+static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__next__(PyObject *__pyx_v_self) {
   char *__pyx_v_s;
   int __pyx_v_len;
   PyObject *__pyx_r = NULL;
@@ -3058,7 +3265,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
   PyObject *__pyx_t_2 = NULL;
   __Pyx_RefNannySetupContext("__next__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":205
+  /* "ctabix.pyx":237
  * 
  *         # simply use '#' for now.
  *         while 1:             # <<<<<<<<<<<<<<
@@ -3068,7 +3275,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
   while (1) {
     if (!1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":206
+    /* "ctabix.pyx":238
  *         # simply use '#' for now.
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)             # <<<<<<<<<<<<<<
@@ -3077,7 +3284,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
  */
     __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator, (&__pyx_v_len));
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":207
+    /* "ctabix.pyx":239
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)
  *             if s == NULL: raise StopIteration             # <<<<<<<<<<<<<<
@@ -3087,12 +3294,12 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
     __pyx_t_1 = (__pyx_v_s == NULL);
     if (__pyx_t_1) {
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":208
+    /* "ctabix.pyx":240
  *             s = ti_read(self.tabixfile, self.iterator, &len)
  *             if s == NULL: raise StopIteration
  *             if s[0] != '#': break             # <<<<<<<<<<<<<<
@@ -3108,7 +3315,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
   }
   __pyx_L6_break:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":210
+  /* "ctabix.pyx":242
  *             if s[0] != '#': break
  * 
  *         return s             # <<<<<<<<<<<<<<
@@ -3116,7 +3323,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
  *     def __dealloc__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
@@ -3134,7 +3341,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":212
+/* "ctabix.pyx":244
  *         return s
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -3142,12 +3349,12 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator___next__(PyObject *__pyx_v_sel
  *             ti_iter_destroy(self.iterator)
  */
 
-static void __pyx_pf_6ctabix_13TabixIterator___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_6ctabix_13TabixIterator___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(PyObject *__pyx_v_self) {
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":213
+  /* "ctabix.pyx":245
  * 
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:             # <<<<<<<<<<<<<<
@@ -3157,7 +3364,7 @@ static void __pyx_pf_6ctabix_13TabixIterator___dealloc__(PyObject *__pyx_v_self)
   __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator) != NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":214
+    /* "ctabix.pyx":246
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:
  *             ti_iter_destroy(self.iterator)             # <<<<<<<<<<<<<<
@@ -3172,7 +3379,7 @@ static void __pyx_pf_6ctabix_13TabixIterator___dealloc__(PyObject *__pyx_v_self)
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":223
+/* "ctabix.pyx":255
  *     cdef tabix_t * tabixfile
  * 
  *     def __cinit__(self, Tabixfile tabixfile ):             # <<<<<<<<<<<<<<
@@ -3204,7 +3411,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
       else goto __pyx_L5_argtuple_error;
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
   } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
@@ -3214,36 +3421,36 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":225
+  /* "ctabix.pyx":257
  *     def __cinit__(self, Tabixfile tabixfile ):
  * 
  *         assert tabixfile._isOpen()             # <<<<<<<<<<<<<<
  * 
  *         # makes sure that samfile stays alive as long as the
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":229
+  /* "ctabix.pyx":261
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive.
  *         self.tabixfile = tabixfile.tabixfile             # <<<<<<<<<<<<<<
@@ -3252,7 +3459,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
  */
   ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":231
+  /* "ctabix.pyx":263
  *         self.tabixfile = tabixfile.tabixfile
  * 
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)             # <<<<<<<<<<<<<<
@@ -3261,7 +3468,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
  */
   ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator = ti_query(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile, NULL, 0, 0);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":233
+  /* "ctabix.pyx":265
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
  * 
  *         if <void*>self.iterator == NULL:             # <<<<<<<<<<<<<<
@@ -3271,24 +3478,18 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
   __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator) == NULL);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":234
+    /* "ctabix.pyx":266
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("can't open header.\n")             # <<<<<<<<<<<<<<
  * 
  *     def __iter__(self):
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
@@ -3305,7 +3506,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":236
+/* "ctabix.pyx":268
  *             raise ValueError("can't open header.\n")
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -3313,12 +3514,12 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannySetupContext("__iter__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":237
+  /* "ctabix.pyx":269
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -3337,7 +3538,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___iter__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":239
+/* "ctabix.pyx":271
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -3345,10 +3546,10 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___iter__(PyObject *__pyx
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_19TabixHeaderIterator___next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixHeaderIterator___next__;
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_6ctabix_19TabixHeaderIterator_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__;
+static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__(PyObject *__pyx_v_self) {
   char *__pyx_v_s;
   int __pyx_v_len;
   PyObject *__pyx_r = NULL;
@@ -3356,7 +3557,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
   PyObject *__pyx_t_2 = NULL;
   __Pyx_RefNannySetupContext("__next__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":250
+  /* "ctabix.pyx":282
  *         # Getting the metachar is a pain as ti_index_t is incomplete type.
  *         # simply use '#' for now.
  *         s = ti_read(self.tabixfile, self.iterator, &len)             # <<<<<<<<<<<<<<
@@ -3365,7 +3566,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
  */
   __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator, (&__pyx_v_len));
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":251
+  /* "ctabix.pyx":283
  *         # simply use '#' for now.
  *         s = ti_read(self.tabixfile, self.iterator, &len)
  *         if s == NULL: raise StopIteration             # <<<<<<<<<<<<<<
@@ -3375,12 +3576,12 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
   __pyx_t_1 = (__pyx_v_s == NULL);
   if (__pyx_t_1) {
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":253
+  /* "ctabix.pyx":285
  *         if s == NULL: raise StopIteration
  *         # stop at first non-header line
  *         if s[0] != '#': raise StopIteration             # <<<<<<<<<<<<<<
@@ -3390,12 +3591,12 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
   __pyx_t_1 = ((__pyx_v_s[0]) != '#');
   if (__pyx_t_1) {
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":255
+  /* "ctabix.pyx":287
  *         if s[0] != '#': raise StopIteration
  * 
  *         return s             # <<<<<<<<<<<<<<
@@ -3403,7 +3604,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
  *     def __dealloc__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
@@ -3421,7 +3622,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":257
+/* "ctabix.pyx":289
  *         return s
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -3429,12 +3630,12 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator___next__(PyObject *__pyx
  *             ti_iter_destroy(self.iterator)
  */
 
-static void __pyx_pf_6ctabix_19TabixHeaderIterator___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_6ctabix_19TabixHeaderIterator___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(PyObject *__pyx_v_self) {
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":258
+  /* "ctabix.pyx":290
  * 
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:             # <<<<<<<<<<<<<<
@@ -3444,7 +3645,7 @@ static void __pyx_pf_6ctabix_19TabixHeaderIterator___dealloc__(PyObject *__pyx_v
   __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator) != NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":259
+    /* "ctabix.pyx":291
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:
  *             ti_iter_destroy(self.iterator)             # <<<<<<<<<<<<<<
@@ -3459,9 +3660,9 @@ static void __pyx_pf_6ctabix_19TabixHeaderIterator___dealloc__(PyObject *__pyx_v
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":269
- * cdef class asTuple(Parser):
- *     '''converts a :term:`tabix row` into a python tuple.'''
+/* "ctabix.pyx":304
+ *     Access is by numeric index.
+ *     '''
  *     def __call__(self, char * buffer, int len):             # <<<<<<<<<<<<<<
  *         cdef TabProxies.TupleProxy r
  *         r = TabProxies.TupleProxy()
@@ -3494,23 +3695,23 @@ static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyOb
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     goto __pyx_L5_argtuple_error;
   } else {
-    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.asTuple.__call__");
   __Pyx_RefNannyFinishContext();
@@ -3518,31 +3719,31 @@ static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyOb
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":271
+  /* "ctabix.pyx":306
  *     def __call__(self, char * buffer, int len):
  *         cdef TabProxies.TupleProxy r
  *         r = TabProxies.TupleProxy()             # <<<<<<<<<<<<<<
  *         # need to copy - there were some
  *         # persistence issues with "present"
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_v_r));
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":274
+  /* "ctabix.pyx":309
  *         # need to copy - there were some
  *         # persistence issues with "present"
  *         r.copy( buffer, len )             # <<<<<<<<<<<<<<
  *         return r
  * 
  */
-  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_r->__pyx_vtab)->copy(__pyx_v_r, __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_r->__pyx_vtab)->copy(__pyx_v_r, __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":275
+  /* "ctabix.pyx":310
  *         # persistence issues with "present"
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -3567,9 +3768,9 @@ static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":279
- * cdef class asGTF(Parser):
- *     '''converts a :term:`tabix row` into a GTF record.'''
+/* "ctabix.pyx":343
+ * 
+ *     '''
  *     def __call__(self, char * buffer, int len):             # <<<<<<<<<<<<<<
  *         cdef TabProxies.GTFProxy r
  *         r = TabProxies.GTFProxy()
@@ -3602,23 +3803,23 @@ static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObje
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     goto __pyx_L5_argtuple_error;
   } else {
-    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.asGTF.__call__");
   __Pyx_RefNannyFinishContext();
@@ -3626,31 +3827,31 @@ static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObje
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":281
+  /* "ctabix.pyx":345
  *     def __call__(self, char * buffer, int len):
  *         cdef TabProxies.GTFProxy r
  *         r = TabProxies.GTFProxy()             # <<<<<<<<<<<<<<
  *         r.copy( buffer, len )
  *         return r
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_GTFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_GTFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_v_r));
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":282
+  /* "ctabix.pyx":346
  *         cdef TabProxies.GTFProxy r
  *         r = TabProxies.GTFProxy()
  *         r.copy( buffer, len )             # <<<<<<<<<<<<<<
  *         return r
  * 
  */
-  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_GTFProxy *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_GTFProxy *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":283
+  /* "ctabix.pyx":347
  *         r = TabProxies.GTFProxy()
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -3675,9 +3876,9 @@ static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":287
- * cdef class asBed( Parser ):
- *     '''converts a :term:`tabix row` into a GTF record.'''
+/* "ctabix.pyx":383
+ * 
+ *     '''
  *     def __call__(self, char * buffer, int len):             # <<<<<<<<<<<<<<
  *         cdef TabProxies.BedProxy r
  *         r = TabProxies.BedProxy()
@@ -3710,23 +3911,23 @@ static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObje
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     goto __pyx_L5_argtuple_error;
   } else {
-    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.asBed.__call__");
   __Pyx_RefNannyFinishContext();
@@ -3734,31 +3935,31 @@ static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObje
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":289
+  /* "ctabix.pyx":385
  *     def __call__(self, char * buffer, int len):
  *         cdef TabProxies.BedProxy r
  *         r = TabProxies.BedProxy()             # <<<<<<<<<<<<<<
  *         r.copy( buffer, len )
  *         return r
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_BedProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_BedProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_v_r));
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":290
+  /* "ctabix.pyx":386
  *         cdef TabProxies.BedProxy r
  *         r = TabProxies.BedProxy()
  *         r.copy( buffer, len )             # <<<<<<<<<<<<<<
  *         return r
  * 
  */
-  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_BedProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_BedProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":291
+  /* "ctabix.pyx":387
  *         r = TabProxies.BedProxy()
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -3783,9 +3984,9 @@ static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":295
- * cdef class asVCF( Parser ):
- *     '''converts a :term:`tabix row` into a VCF record.'''
+/* "ctabix.pyx":419
+ * 
+ *     '''
  *     def __call__(self, char * buffer, int len ):             # <<<<<<<<<<<<<<
  *         cdef TabProxies.VCFProxy r
  *         r = TabProxies.VCFProxy()
@@ -3818,23 +4019,23 @@ static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObje
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
-    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
     goto __pyx_L5_argtuple_error;
   } else {
-    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.asVCF.__call__");
   __Pyx_RefNannyFinishContext();
@@ -3842,31 +4043,31 @@ static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObje
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":297
+  /* "ctabix.pyx":421
  *     def __call__(self, char * buffer, int len ):
  *         cdef TabProxies.VCFProxy r
  *         r = TabProxies.VCFProxy()             # <<<<<<<<<<<<<<
  *         r.copy( buffer, len )
  *         return r
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_VCFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_VCFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_v_r));
   __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":298
+  /* "ctabix.pyx":422
  *         cdef TabProxies.VCFProxy r
  *         r = TabProxies.VCFProxy()
  *         r.copy( buffer, len )             # <<<<<<<<<<<<<<
  *         return r
  * 
  */
-  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_VCFProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_VCFProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":299
+  /* "ctabix.pyx":423
  *         r = TabProxies.VCFProxy()
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -3891,7 +4092,7 @@ static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObje
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":314
+/* "ctabix.pyx":438
  *     cdef Parser parser
  * 
  *     def __cinit__(self,             # <<<<<<<<<<<<<<
@@ -3933,77 +4134,77 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
       if (likely(values[2])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  3:
       values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
       if (likely(values[3])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  4:
       values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
       if (likely(values[4])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
-    __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[4]);
   } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
     goto __pyx_L5_argtuple_error;
   } else {
     __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0));
-    __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)PyTuple_GET_ITEM(__pyx_args, 4));
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__");
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":321
+  /* "ctabix.pyx":445
  *                   Parser parser ):
  * 
  *         assert tabixfile._isOpen()             # <<<<<<<<<<<<<<
  *         self.parser = parser
  * 
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":322
+  /* "ctabix.pyx":446
  * 
  *         assert tabixfile._isOpen()
  *         self.parser = parser             # <<<<<<<<<<<<<<
@@ -4016,7 +4217,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
   __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser));
   ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser = __pyx_v_parser;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":326
+  /* "ctabix.pyx":450
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive.
  *         self.tabixfile = tabixfile.tabixfile             # <<<<<<<<<<<<<<
@@ -4025,7 +4226,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
  */
   ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":328
+  /* "ctabix.pyx":452
  *         self.tabixfile = tabixfile.tabixfile
  * 
  *         if tid < 0:             # <<<<<<<<<<<<<<
@@ -4035,7 +4236,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
   __pyx_t_3 = (__pyx_v_tid < 0);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":331
+    /* "ctabix.pyx":455
  *             # seek to start of file to ensure iteration is over
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)             # <<<<<<<<<<<<<<
@@ -4044,7 +4245,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
  */
     bgzf_seek(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile->fp, 0, 0);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":332
+    /* "ctabix.pyx":456
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)
  *             self.iterator = ti_iter_first()             # <<<<<<<<<<<<<<
@@ -4056,7 +4257,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":334
+    /* "ctabix.pyx":458
  *             self.iterator = ti_iter_first()
  *         else:
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)             # <<<<<<<<<<<<<<
@@ -4067,7 +4268,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":336
+  /* "ctabix.pyx":460
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)
  * 
  *         if <void*>self.iterator == NULL:             # <<<<<<<<<<<<<<
@@ -4077,24 +4278,18 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
   __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator) == NULL);
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":337
+    /* "ctabix.pyx":461
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
  * 
  *     def __iter__(self):
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_12));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_2, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_Raise(__pyx_t_1, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
@@ -4111,7 +4306,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":339
+/* "ctabix.pyx":463
  *             raise ValueError("malformatted query or wrong sequence name.\n")
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -4119,12 +4314,12 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannySetupContext("__iter__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":340
+  /* "ctabix.pyx":464
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -4143,7 +4338,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___iter__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":342
+/* "ctabix.pyx":466
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -4151,10 +4346,10 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___iter__(PyObject *__pyx
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_19TabixIteratorParsed___next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixIteratorParsed___next__;
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_6ctabix_19TabixIteratorParsed_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__;
+static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__(PyObject *__pyx_v_self) {
   char *__pyx_v_s;
   int __pyx_v_len;
   PyObject *__pyx_r = NULL;
@@ -4164,7 +4359,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
   PyObject *__pyx_t_4 = NULL;
   __Pyx_RefNannySetupContext("__next__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":350
+  /* "ctabix.pyx":474
  *         cdef char * s
  *         cdef int len
  *         while 1:             # <<<<<<<<<<<<<<
@@ -4174,7 +4369,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
   while (1) {
     if (!1) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":351
+    /* "ctabix.pyx":475
  *         cdef int len
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)             # <<<<<<<<<<<<<<
@@ -4183,7 +4378,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
  */
     __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator, (&__pyx_v_len));
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":352
+    /* "ctabix.pyx":476
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)
  *             if s == NULL: raise StopIteration             # <<<<<<<<<<<<<<
@@ -4193,12 +4388,12 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
     __pyx_t_1 = (__pyx_v_s == NULL);
     if (__pyx_t_1) {
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":354
+    /* "ctabix.pyx":478
  *             if s == NULL: raise StopIteration
  *             # todo: read metachar from configuration
  *             if s[0] != '#': break             # <<<<<<<<<<<<<<
@@ -4214,7 +4409,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
   }
   __pyx_L6_break:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":356
+  /* "ctabix.pyx":480
  *             if s[0] != '#': break
  * 
  *         return self.parser(s, len)             # <<<<<<<<<<<<<<
@@ -4222,21 +4417,21 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
  *     def __dealloc__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(__pyx_v_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
   goto __pyx_L0;
@@ -4255,7 +4450,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":358
+/* "ctabix.pyx":482
  *         return self.parser(s, len)
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -4263,12 +4458,12 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed___next__(PyObject *__pyx
  *             ti_iter_destroy(self.iterator)
  */
 
-static void __pyx_pf_6ctabix_19TabixIteratorParsed___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_6ctabix_19TabixIteratorParsed___dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(PyObject *__pyx_v_self) {
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":359
+  /* "ctabix.pyx":483
  * 
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:             # <<<<<<<<<<<<<<
@@ -4278,7 +4473,7 @@ static void __pyx_pf_6ctabix_19TabixIteratorParsed___dealloc__(PyObject *__pyx_v
   __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator) != NULL);
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":360
+    /* "ctabix.pyx":484
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:
  *             ti_iter_destroy(self.iterator)             # <<<<<<<<<<<<<<
@@ -4293,7 +4488,7 @@ static void __pyx_pf_6ctabix_19TabixIteratorParsed___dealloc__(PyObject *__pyx_v
   __Pyx_RefNannyFinishContext();
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":362
+/* "ctabix.pyx":486
  *             ti_iter_destroy(self.iterator)
  * 
  * def tabix_compress( filename_in,             # <<<<<<<<<<<<<<
@@ -4303,6 +4498,7 @@ static void __pyx_pf_6ctabix_19TabixIteratorParsed___dealloc__(PyObject *__pyx_v
 
 static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6ctabix_tabix_compress[] = "tabix_compress(filename_in, filename_out, force=False)\n\n    compress *filename_in* writing the output to *filename_out*.\n    \n    Raise an IOError if *filename_out* already exists, unless *force* is set.\n    ";
+static PyMethodDef __pyx_mdef_6ctabix_tabix_compress = {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pf_6ctabix_tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_compress)};
 static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename_in = 0;
   PyObject *__pyx_v_filename_out = 0;
@@ -4329,7 +4525,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
-    values[2] = __pyx_k_14;
+    values[2] = __pyx_k_19;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -4346,7 +4542,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       if (kw_args > 0) {
@@ -4355,13 +4551,13 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_compress") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_compress") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_filename_in = values[0];
     __pyx_v_filename_out = values[1];
     __pyx_v_force = values[2];
   } else {
-    __pyx_v_force = __pyx_k_14;
+    __pyx_v_force = __pyx_k_19;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3:
       __pyx_v_force = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -4374,41 +4570,41 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.tabix_compress");
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":372
+  /* "ctabix.pyx":496
  *     '''
  * 
  *     if not force and os.path.exists(filename_out ):             # <<<<<<<<<<<<<<
  *         raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out)
  * 
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = (!__pyx_t_1);
   if (__pyx_t_2) {
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_INCREF(__pyx_v_filename_out);
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename_out);
     __Pyx_GIVEREF(__pyx_v_filename_out);
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_6 = __pyx_t_1;
   } else {
@@ -4416,47 +4612,47 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
   }
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":373
+    /* "ctabix.pyx":497
  * 
  *     if not force and os.path.exists(filename_out ):
  *         raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out)             # <<<<<<<<<<<<<<
  * 
  *     cdef int WINDOW_SIZE
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_v_filename_out); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_v_filename_out); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_Raise(__pyx_t_5, 0, 0);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":382
+  /* "ctabix.pyx":506
  * 
  *     cdef int O_RDONLY
  *     O_RDONLY = os.O_RDONLY             # <<<<<<<<<<<<<<
  * 
  *     WINDOW_SIZE = 64 * 1024
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__O_RDONLY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__O_RDONLY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_O_RDONLY = __pyx_t_7;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":384
+  /* "ctabix.pyx":508
  *     O_RDONLY = os.O_RDONLY
  * 
  *     WINDOW_SIZE = 64 * 1024             # <<<<<<<<<<<<<<
@@ -4465,17 +4661,17 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
   __pyx_v_WINDOW_SIZE = 65536;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":386
+  /* "ctabix.pyx":510
  *     WINDOW_SIZE = 64 * 1024
  * 
  *     fp = bgzf_open( filename_out, "w")             # <<<<<<<<<<<<<<
  *     if fp == NULL:
  *         raise IOError( "could not open '%s' for writing" )
  */
-  __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_out); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_out); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fp = bgzf_open(__pyx_t_8, __pyx_k__w);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":387
+  /* "ctabix.pyx":511
  * 
  *     fp = bgzf_open( filename_out, "w")
  *     if fp == NULL:             # <<<<<<<<<<<<<<
@@ -4485,39 +4681,33 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
   __pyx_t_6 = (__pyx_v_fp == NULL);
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":388
+    /* "ctabix.pyx":512
  *     fp = bgzf_open( filename_out, "w")
  *     if fp == NULL:
  *         raise IOError( "could not open '%s' for writing" )             # <<<<<<<<<<<<<<
  * 
  *     fd_src = open(filename_in, O_RDONLY)
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_16));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_Raise(__pyx_t_4, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":390
+  /* "ctabix.pyx":514
  *         raise IOError( "could not open '%s' for writing" )
  * 
  *     fd_src = open(filename_in, O_RDONLY)             # <<<<<<<<<<<<<<
  *     if fd_src == 0:
  *         raise IOError( "could not open '%s' for reading" )
  */
-  __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_in); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_in); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fd_src = open(__pyx_t_8, __pyx_v_O_RDONLY);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":391
+  /* "ctabix.pyx":515
  * 
  *     fd_src = open(filename_in, O_RDONLY)
  *     if fd_src == 0:             # <<<<<<<<<<<<<<
@@ -4527,29 +4717,23 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
   __pyx_t_6 = (__pyx_v_fd_src == 0);
   if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":392
+    /* "ctabix.pyx":516
  *     fd_src = open(filename_in, O_RDONLY)
  *     if fd_src == 0:
  *         raise IOError( "could not open '%s' for reading" )             # <<<<<<<<<<<<<<
  * 
  *     buffer = malloc(WINDOW_SIZE)
  */
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_17));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L8;
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":394
+  /* "ctabix.pyx":518
  *         raise IOError( "could not open '%s' for reading" )
  * 
  *     buffer = malloc(WINDOW_SIZE)             # <<<<<<<<<<<<<<
@@ -4558,7 +4742,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
   __pyx_v_buffer = malloc(__pyx_v_WINDOW_SIZE);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":396
+  /* "ctabix.pyx":520
  *     buffer = malloc(WINDOW_SIZE)
  * 
  *     while c > 0:             # <<<<<<<<<<<<<<
@@ -4569,7 +4753,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
     __pyx_t_6 = (__pyx_v_c > 0);
     if (!__pyx_t_6) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":397
+    /* "ctabix.pyx":521
  * 
  *     while c > 0:
  *         c = read(fd_src, buffer, WINDOW_SIZE)             # <<<<<<<<<<<<<<
@@ -4578,7 +4762,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
     __pyx_v_c = read(__pyx_v_fd_src, __pyx_v_buffer, __pyx_v_WINDOW_SIZE);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":398
+    /* "ctabix.pyx":522
  *     while c > 0:
  *         c = read(fd_src, buffer, WINDOW_SIZE)
  *         r = bgzf_write(fp, buffer, c)             # <<<<<<<<<<<<<<
@@ -4587,7 +4771,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
     __pyx_v_r = bgzf_write(__pyx_v_fp, __pyx_v_buffer, __pyx_v_c);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":399
+    /* "ctabix.pyx":523
  *         c = read(fd_src, buffer, WINDOW_SIZE)
  *         r = bgzf_write(fp, buffer, c)
  *         if r < 0:             # <<<<<<<<<<<<<<
@@ -4597,7 +4781,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
     __pyx_t_6 = (__pyx_v_r < 0);
     if (__pyx_t_6) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":400
+      /* "ctabix.pyx":524
  *         r = bgzf_write(fp, buffer, c)
  *         if r < 0:
  *             free( buffer )             # <<<<<<<<<<<<<<
@@ -4606,30 +4790,24 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
       free(__pyx_v_buffer);
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":401
+      /* "ctabix.pyx":525
  *         if r < 0:
  *             free( buffer )
  *             raise OSError("writing failed")             # <<<<<<<<<<<<<<
  * 
  *     free( buffer )
  */
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_18));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_OSError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_4, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L11;
     }
     __pyx_L11:;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":403
+  /* "ctabix.pyx":527
  *             raise OSError("writing failed")
  * 
  *     free( buffer )             # <<<<<<<<<<<<<<
@@ -4638,7 +4816,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
   free(__pyx_v_buffer);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":404
+  /* "ctabix.pyx":528
  * 
  *     free( buffer )
  *     r = bgzf_close(fp)             # <<<<<<<<<<<<<<
@@ -4647,7 +4825,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
   __pyx_v_r = bgzf_close(__pyx_v_fp);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":405
+  /* "ctabix.pyx":529
  *     free( buffer )
  *     r = bgzf_close(fp)
  *     if r < 0: raise OSError("writing failed")             # <<<<<<<<<<<<<<
@@ -4656,17 +4834,11 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  */
   __pyx_t_6 = (__pyx_v_r < 0);
   if (__pyx_t_6) {
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_18));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L12;
   }
   __pyx_L12:;
@@ -4685,7 +4857,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":407
+/* "ctabix.pyx":531
  *     if r < 0: raise OSError("writing failed")
  * 
  * def tabix_index( filename,             # <<<<<<<<<<<<<<
@@ -4693,9 +4865,10 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject
  *                  seq_col = None,
  */
 
-static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_tabix_index[] = "tabix_index(filename, force=False, seq_col=None, start_col=None, end_col=None, preset=None, meta_char='#', zerobased=False)\n\n    index tab-separated *filename* using tabix.\n\n    An existing index will not be overwritten unless\n    *force* is set.\n\n    The index will be built from coordinates\n    in columns *seq_col*, *start_col* and *end_col*.\n\n    The contents of *filename* have to be sorted by \n    contig and position - the method does not check\n    if the file is sorted.\n\n    Column indices are 0-based. Coordinates in the file\n    are assumed to be 1-based.\n\n    If *preset* is provided, the column coordinates\n    are taken from a preset. Valid values for preset\n    are \"gff\", \"bed\", \"sam\", \"vcf\", psltbl\", \"pileup\".\n    \n    Lines beginning with *meta_char* and the first\n    *line_skip* lines will be skipped.\n    \n    If *filename* does not end in \".gz\", it will be automatically\n    compressed. The original file will be removed and only the \n    compressed file will be retained. \n\n    If *filename* ends in *gz*, the file is assumed to be already\n    compressed with bgzf.\n\n    returns the filename of the compressed data\n    ";
-static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_6ctabix_1tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6ctabix_1tabix_index[] = "tabix_index(filename, force=False, seq_col=None, start_col=None, end_col=None, preset=None, meta_char='#', zerobased=False)\n\n    index tab-separated *filename* using tabix.\n\n    An existing index will not be overwritten unless\n    *force* is set.\n\n    The index will be built from coordinates\n    in columns *seq_col*, *start_col* and *end_col*.\n\n    The contents of *filename* have to be sorted by \n    contig and position - the method does not check\n    if the file is sorted.\n\n    Column indices are 0-based. Coordinates in the file\n    are assumed to be 1-based.\n\n    If *preset* is provided, the column coordinates\n    are taken from a preset. Valid values for preset\n    are \"gff\", \"bed\", \"sam\", \"vcf\", psltbl\", \"pileup\".\n    \n    Lines beginning with *meta_char* and the first\n    *line_skip* lines will be skipped.\n    \n    If *filename* does not end in \".gz\", it will be automatically\n    compressed. The original file will be removed and only the \n    compressed file will be retained. \n\n    If *filename* ends in *gz*, the file is assumed to be already\n    compressed with bgzf.\n\n    returns the filename of the compressed data\n    ";
+static PyMethodDef __pyx_mdef_6ctabix_1tabix_index = {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pf_6ctabix_1tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_1tabix_index)};
+static PyObject *__pyx_pf_6ctabix_1tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_force = 0;
   PyObject *__pyx_v_seq_col = 0;
@@ -4732,9 +4905,9 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[8] = {0,0,0,0,0,0,0,0};
-    values[1] = __pyx_k_19;
+    values[1] = __pyx_k_28;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":409
+    /* "ctabix.pyx":533
  * def tabix_index( filename,
  *                  force = False,
  *                  seq_col = None,             # <<<<<<<<<<<<<<
@@ -4743,7 +4916,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":410
+    /* "ctabix.pyx":534
  *                  force = False,
  *                  seq_col = None,
  *                  start_col = None,             # <<<<<<<<<<<<<<
@@ -4752,7 +4925,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":411
+    /* "ctabix.pyx":535
  *                  seq_col = None,
  *                  start_col = None,
  *                  end_col = None,             # <<<<<<<<<<<<<<
@@ -4761,7 +4934,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  */
     values[4] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":412
+    /* "ctabix.pyx":536
  *                  start_col = None,
  *                  end_col = None,
  *                  preset = None,             # <<<<<<<<<<<<<<
@@ -4769,8 +4942,8 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  *                  zerobased = False,
  */
     values[5] = ((PyObject *)Py_None);
-    values[6] = ((PyObject *)__pyx_kp_s_20);
-    values[7] = __pyx_k_21;
+    values[6] = ((PyObject *)__pyx_kp_s_29);
+    values[7] = __pyx_k_30;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
       case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
@@ -4825,7 +4998,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_filename = values[0];
     __pyx_v_force = values[1];
@@ -4836,9 +5009,9 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
     __pyx_v_meta_char = values[6];
     __pyx_v_zerobased = values[7];
   } else {
-    __pyx_v_force = __pyx_k_19;
+    __pyx_v_force = __pyx_k_28;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":409
+    /* "ctabix.pyx":533
  * def tabix_index( filename,
  *                  force = False,
  *                  seq_col = None,             # <<<<<<<<<<<<<<
@@ -4847,7 +5020,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  */
     __pyx_v_seq_col = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":410
+    /* "ctabix.pyx":534
  *                  force = False,
  *                  seq_col = None,
  *                  start_col = None,             # <<<<<<<<<<<<<<
@@ -4856,7 +5029,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  */
     __pyx_v_start_col = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":411
+    /* "ctabix.pyx":535
  *                  seq_col = None,
  *                  start_col = None,
  *                  end_col = None,             # <<<<<<<<<<<<<<
@@ -4865,7 +5038,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  */
     __pyx_v_end_col = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":412
+    /* "ctabix.pyx":536
  *                  start_col = None,
  *                  end_col = None,
  *                  preset = None,             # <<<<<<<<<<<<<<
@@ -4873,8 +5046,8 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
  *                  zerobased = False,
  */
     __pyx_v_preset = ((PyObject *)Py_None);
-    __pyx_v_meta_char = ((PyObject *)__pyx_kp_s_20);
-    __pyx_v_zerobased = __pyx_k_21;
+    __pyx_v_meta_char = ((PyObject *)__pyx_kp_s_29);
+    __pyx_v_zerobased = __pyx_k_30;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  8: __pyx_v_zerobased = PyTuple_GET_ITEM(__pyx_args, 7);
       case  7: __pyx_v_meta_char = PyTuple_GET_ITEM(__pyx_args, 6);
@@ -4890,7 +5063,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("tabix_index", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("tabix_index", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.tabix_index");
   __Pyx_RefNannyFinishContext();
@@ -4899,175 +5072,169 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
   __Pyx_INCREF(__pyx_v_filename);
   __Pyx_INCREF(__pyx_v_end_col);
   __Pyx_INCREF(__pyx_v_preset);
-  __pyx_v_preset2conf = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_preset2conf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_conf_data = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":449
+  /* "ctabix.pyx":573
  *     '''
  * 
  *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)             # <<<<<<<<<<<<<<
  * 
  *     if not filename.endswith(".gz"):
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
   __Pyx_GIVEREF(__pyx_v_filename);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_5 = (!__pyx_t_4);
   if (__pyx_t_5) {
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":451
+  /* "ctabix.pyx":575
  *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
  * 
  *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
  * 
  *         tabix_compress( filename, filename + ".gz", force = force )
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_23));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_4 = (!__pyx_t_5);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":453
+    /* "ctabix.pyx":577
  *     if not filename.endswith(".gz"):
  * 
  *         tabix_compress( filename, filename + ".gz", force = force )             # <<<<<<<<<<<<<<
  *         os.unlink( filename )
  *         filename += ".gz"
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_filename);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
     __Pyx_GIVEREF(__pyx_v_filename);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
+    __Pyx_GIVEREF(__pyx_t_3);
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":454
+    /* "ctabix.pyx":578
  * 
  *         tabix_compress( filename, filename + ".gz", force = force )
  *         os.unlink( filename )             # <<<<<<<<<<<<<<
  *         filename += ".gz"
  * 
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__unlink); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__unlink); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_filename);
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename);
     __Pyx_GIVEREF(__pyx_v_filename);
-    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":455
+    /* "ctabix.pyx":579
  *         tabix_compress( filename, filename + ".gz", force = force )
  *         os.unlink( filename )
  *         filename += ".gz"             # <<<<<<<<<<<<<<
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):
  */
-    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_filename);
-    __pyx_v_filename = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_filename = __pyx_t_1;
+    __pyx_t_1 = 0;
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":457
+  /* "ctabix.pyx":581
  *         filename += ".gz"
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):             # <<<<<<<<<<<<<<
  *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )
  * 
  */
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_5 = (!__pyx_t_4);
   if (__pyx_t_5) {
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
     __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_7 = __pyx_t_4;
   } else {
@@ -5075,280 +5242,238 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
   }
   if (__pyx_t_7) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":458
+    /* "ctabix.pyx":582
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):
  *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
  * 
  *     # columns (1-based)
  */
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
-    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_24));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_Raise(__pyx_t_6, 0, 0);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L8;
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":463
+  /* "ctabix.pyx":587
  *     # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning
  *     # 0 is a missing column
  *     preset2conf = {             # <<<<<<<<<<<<<<
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  */
-  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":464
+  /* "ctabix.pyx":588
  *     # 0 is a missing column
  *     preset2conf = {
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_20));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_INCREF(__pyx_int_4);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_4);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_4);
   __Pyx_GIVEREF(__pyx_int_4);
   __Pyx_INCREF(__pyx_int_5);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_int_5);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_5);
   __Pyx_GIVEREF(__pyx_int_5);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
   __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__gff), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":465
+  /* "ctabix.pyx":589
  *     preset2conf = {
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_20));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_int_0x10000);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0x10000);
-  __Pyx_GIVEREF(__pyx_int_0x10000);
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_INCREF(__pyx_int_65536);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536);
+  __Pyx_GIVEREF(__pyx_int_65536);
   __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_2);
+  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
   __Pyx_GIVEREF(__pyx_int_2);
   __Pyx_INCREF(__pyx_int_3);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_int_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_3);
   __Pyx_GIVEREF(__pyx_int_3);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__bed), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":466
+  /* "ctabix.pyx":590
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_20));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_int_0x10000);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0x10000);
-  __Pyx_GIVEREF(__pyx_int_0x10000);
+  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_int_65536);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_65536);
+  __Pyx_GIVEREF(__pyx_int_65536);
   __Pyx_INCREF(__pyx_int_15);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_15);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_15);
   __Pyx_GIVEREF(__pyx_int_15);
   __Pyx_INCREF(__pyx_int_17);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_17);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_17);
   __Pyx_GIVEREF(__pyx_int_17);
   __Pyx_INCREF(__pyx_int_18);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_int_18);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_18);
   __Pyx_GIVEREF(__pyx_int_18);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
   __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__psltbl), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":467
+  /* "ctabix.pyx":591
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_20));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_INCREF(__pyx_int_3);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3);
   __Pyx_GIVEREF(__pyx_int_3);
   __Pyx_INCREF(__pyx_int_4);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_4);
+  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_4);
   __Pyx_GIVEREF(__pyx_int_4);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__sam), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":468
+  /* "ctabix.pyx":592
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),
  *         }
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_20));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_2);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_2);
   __Pyx_GIVEREF(__pyx_int_2);
   __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_2);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_2);
   __Pyx_GIVEREF(__pyx_int_2);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
   __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__vcf), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":469
+  /* "ctabix.pyx":593
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         }
  * 
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_20));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(__pyx_int_3);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
   __Pyx_GIVEREF(__pyx_int_3);
   __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_2);
+  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
   __Pyx_GIVEREF(__pyx_int_2);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__pileup), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__pileup), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_v_preset2conf));
-  __pyx_v_preset2conf = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_v_preset2conf = __pyx_t_6;
+  __pyx_t_6 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":472
+  /* "ctabix.pyx":596
  *         }
  * 
  *     if preset:             # <<<<<<<<<<<<<<
  *         try:
  *             conf_data = preset2conf[preset]
  */
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_7) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":473
+    /* "ctabix.pyx":597
  * 
  *     if preset:
  *         try:             # <<<<<<<<<<<<<<
@@ -5363,30 +5488,30 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
       __Pyx_XGOTREF(__pyx_save_exc_tb);
       /*try:*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":474
+        /* "ctabix.pyx":598
  *     if preset:
  *         try:
  *             conf_data = preset2conf[preset]             # <<<<<<<<<<<<<<
  *         except KeyError:
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
  */
-        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(__pyx_v_conf_data);
-        __pyx_v_conf_data = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_conf_data = __pyx_t_6;
+        __pyx_t_6 = 0;
       }
       __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
       __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
       __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
       goto __pyx_L17_try_end;
       __pyx_L10_error:;
+      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":475
+      /* "ctabix.pyx":599
  *         try:
  *             conf_data = preset2conf[preset]
  *         except KeyError:             # <<<<<<<<<<<<<<
@@ -5396,56 +5521,59 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
       __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
       if (__pyx_t_8) {
         __Pyx_AddTraceback("ctabix.tabix_index");
-        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_GOTREF(__pyx_t_1);
 
-        /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":476
+        /* "ctabix.pyx":600
  *             conf_data = preset2conf[preset]
  *         except KeyError:
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))             # <<<<<<<<<<<<<<
  *     else:
  *         if end_col == None: end_col = -1
  */
-        __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_26), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_9 = PyDict_Keys(((PyObject *)__pyx_v_preset2conf)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_43), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        if (unlikely(__pyx_v_preset2conf == Py_None)) {
+          PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'keys'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} 
+        }
+        __pyx_t_9 = PyDict_Keys(__pyx_v_preset2conf); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
         __Pyx_GIVEREF(__pyx_t_9);
         __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __Pyx_INCREF(__pyx_v_preset);
         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_preset);
         __Pyx_GIVEREF(__pyx_v_preset);
         PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
         __Pyx_GIVEREF(__pyx_t_9);
         __pyx_t_9 = 0;
-        __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
         __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __pyx_t_9 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         __Pyx_Raise(__pyx_t_9, 0, 0);
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L11_exception_handled;
       }
       __pyx_L12_except_error:;
@@ -5465,17 +5593,17 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":478
+    /* "ctabix.pyx":602
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
  *     else:
  *         if end_col == None: end_col = -1             # <<<<<<<<<<<<<<
  *         preset = 0
  * 
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_7) {
       __Pyx_INCREF(__pyx_int_neg_1);
       __Pyx_DECREF(__pyx_v_end_col);
@@ -5484,7 +5612,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
     }
     __pyx_L20:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":479
+    /* "ctabix.pyx":603
  *     else:
  *         if end_col == None: end_col = -1
  *         preset = 0             # <<<<<<<<<<<<<<
@@ -5495,72 +5623,72 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
     __Pyx_DECREF(__pyx_v_preset);
     __pyx_v_preset = __pyx_int_0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":486
+    /* "ctabix.pyx":610
  *         # -1 is subtracted from the start coordinate. To avoid doing this, set
  *         # the TI_FLAG_UCSC=0x10000 flag:
  *         if zerobased: preset = preset | 0x10000             # <<<<<<<<<<<<<<
  * 
  *         conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)
  */
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_7) {
-      __pyx_t_3 = PyNumber_Or(__pyx_v_preset, __pyx_int_0x10000); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_1 = PyNumber_Or(__pyx_v_preset, __pyx_int_65536); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_v_preset);
-      __pyx_v_preset = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_preset = __pyx_t_1;
+      __pyx_t_1 = 0;
       goto __pyx_L21;
     }
     __pyx_L21:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":488
+    /* "ctabix.pyx":612
  *         if zerobased: preset = preset | 0x10000
  * 
  *         conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)             # <<<<<<<<<<<<<<
  * 
  *     cdef ti_conf_t conf
  */
-    __pyx_t_3 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_2 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_INCREF(__pyx_v_meta_char);
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_meta_char);
     __Pyx_GIVEREF(__pyx_v_meta_char);
-    __pyx_t_10 = PyObject_Call(__pyx_builtin_ord, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_INCREF(__pyx_v_preset);
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_preset);
     __Pyx_GIVEREF(__pyx_v_preset);
-    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_6);
+    PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
     PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     __Pyx_INCREF(__pyx_int_0);
     PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_int_0);
     __Pyx_GIVEREF(__pyx_int_0);
+    __pyx_t_1 = 0;
     __pyx_t_3 = 0;
     __pyx_t_6 = 0;
-    __pyx_t_2 = 0;
     __pyx_t_10 = 0;
     __Pyx_DECREF(__pyx_v_conf_data);
-    __pyx_v_conf_data = __pyx_t_9;
+    __pyx_v_conf_data = ((PyObject *)__pyx_t_9);
     __pyx_t_9 = 0;
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":491
+  /* "ctabix.pyx":615
  * 
  *     cdef ti_conf_t conf
  *     conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data             # <<<<<<<<<<<<<<
@@ -5570,23 +5698,23 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
   if (PyTuple_CheckExact(__pyx_v_conf_data) && likely(PyTuple_GET_SIZE(__pyx_v_conf_data) == 6)) {
     PyObject* tuple = __pyx_v_conf_data;
     __pyx_t_9 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_9);
-    __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10);
-    __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_2);
-    __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_6);
-    __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
+    __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_t_3);
-    __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 5); __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 5); __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_v_conf.preset = __pyx_t_11;
     __pyx_v_conf.sc = __pyx_t_12;
     __pyx_v_conf.bc = __pyx_t_13;
@@ -5594,33 +5722,33 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
     __pyx_v_conf.meta_char = __pyx_t_15;
     __pyx_v_conf.line_skip = __pyx_t_16;
   } else {
-    __pyx_t_17 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_17);
-    __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_17, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_17, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_17, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_17, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_17, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_17, 3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_17, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_17, 4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_17, 3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_17, 5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_17, 4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__Pyx_EndUnpack(__pyx_t_17, 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_17, 5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (__Pyx_EndUnpack(__pyx_t_17, 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
     __pyx_v_conf.preset = __pyx_t_16;
     __pyx_v_conf.sc = __pyx_t_15;
@@ -5630,17 +5758,17 @@ static PyObject *__pyx_pf_6ctabix_tabix_index(PyObject *__pyx_self, PyObject *__
     __pyx_v_conf.line_skip = __pyx_t_11;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":493
+  /* "ctabix.pyx":617
  *     conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data
  * 
  *     ti_index_build( filename, &conf)             # <<<<<<<<<<<<<<
  * 
  *     return filename
  */
-  __pyx_t_18 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_18 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ti_index_build(__pyx_t_18, (&__pyx_v_conf));
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":495
+  /* "ctabix.pyx":619
  *     ti_index_build( filename, &conf)
  * 
  *     return filename             # <<<<<<<<<<<<<<
@@ -5685,9 +5813,22 @@ static PyObject *__pyx_tp_new_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, Py
 }
 
 static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) {
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
   (*Py_TYPE(o)->tp_free)(o);
 }
 
+static PyObject *__pyx_getprop_6ctabix_9Tabixfile_filename(PyObject *o, void *x) {
+  return __pyx_pf_6ctabix_9Tabixfile_8filename___get__(o);
+}
+
 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_header(PyObject *o, void *x) {
   return __pyx_pf_6ctabix_9Tabixfile_6header___get__(o);
 }
@@ -5697,16 +5838,18 @@ static PyObject *__pyx_getprop_6ctabix_9Tabixfile_contigs(PyObject *o, void *x)
 }
 
 static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile__isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile__isOpen)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile__open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile__open)},
-  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile__parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile__parseRegion)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_fetch)},
+  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_1_isOpen)},
+  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_2_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_2_open)},
+  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_3_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_3_parseRegion)},
+  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_4fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_4fetch)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_5close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_5close)},
   {0, 0, 0, 0}
 };
 
 static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = {
-  {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, 0, 0},
-  {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_27), 0},
+  {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_44), 0},
+  {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_45), 0},
+  {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_46), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -5808,7 +5951,7 @@ static PyBufferProcs __pyx_tp_as_buffer_Tabixfile = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_Tabixfile = {
+static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.Tabixfile"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_Tabixfile), /*tp_basicsize*/
@@ -5832,7 +5975,7 @@ PyTypeObject __pyx_type_6ctabix_Tabixfile = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_Tabixfile, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("*(filename, mode='r')*\n\n    opens a :term:`tabix file` for reading. A missing\n    index (*filename* + \".tbi\") will raise an exception.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
@@ -5976,7 +6119,7 @@ static PyBufferProcs __pyx_tp_as_buffer_Parser = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_Parser = {
+static PyTypeObject __pyx_type_6ctabix_Parser = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.Parser"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_Parser), /*tp_basicsize*/
@@ -6000,7 +6143,7 @@ PyTypeObject __pyx_type_6ctabix_Parser = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_Parser, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   0, /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
@@ -6046,7 +6189,7 @@ static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_6ctabix_13TabixIterator___dealloc__(o);
+    __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -6055,7 +6198,7 @@ static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_6ctabix_TabixIterator[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_13TabixIterator___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator___next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_13TabixIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator_2__next__)},
   {0, 0, 0, 0}
 };
 
@@ -6157,7 +6300,7 @@ static PyBufferProcs __pyx_tp_as_buffer_TabixIterator = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_TabixIterator = {
+static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.TabixIterator"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_TabixIterator), /*tp_basicsize*/
@@ -6181,14 +6324,14 @@ PyTypeObject __pyx_type_6ctabix_TabixIterator = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_TabixIterator, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("iterates over rows in *tabixfile* in region\n    given by *tid*, *start* and *end*.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_6ctabix_13TabixIterator___iter__, /*tp_iter*/
-  __pyx_pf_6ctabix_13TabixIterator___next__, /*tp_iternext*/
+  __pyx_pf_6ctabix_13TabixIterator_1__iter__, /*tp_iter*/
+  __pyx_pf_6ctabix_13TabixIterator_2__next__, /*tp_iternext*/
   __pyx_methods_6ctabix_TabixIterator, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -6227,7 +6370,7 @@ static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_6ctabix_19TabixHeaderIterator___dealloc__(o);
+    __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -6236,7 +6379,7 @@ static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_6ctabix_TabixHeaderIterator[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixHeaderIterator___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixHeaderIterator___next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixHeaderIterator_2__next__)},
   {0, 0, 0, 0}
 };
 
@@ -6338,7 +6481,7 @@ static PyBufferProcs __pyx_tp_as_buffer_TabixHeaderIterator = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
+static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.TabixHeaderIterator"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_TabixHeaderIterator), /*tp_basicsize*/
@@ -6362,14 +6505,14 @@ PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_TabixHeaderIterator, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
   __Pyx_DOCSTR("return header lines.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_6ctabix_19TabixHeaderIterator___iter__, /*tp_iter*/
-  __pyx_pf_6ctabix_19TabixHeaderIterator___next__, /*tp_iternext*/
+  __pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__, /*tp_iter*/
+  __pyx_pf_6ctabix_19TabixHeaderIterator_2__next__, /*tp_iternext*/
   __pyx_methods_6ctabix_TabixHeaderIterator, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -6502,7 +6645,7 @@ static PyBufferProcs __pyx_tp_as_buffer_asTuple = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_asTuple = {
+static PyTypeObject __pyx_type_6ctabix_asTuple = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.asTuple"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_asTuple), /*tp_basicsize*/
@@ -6526,8 +6669,8 @@ PyTypeObject __pyx_type_6ctabix_asTuple = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_asTuple, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("converts a :term:`tabix row` into a python tuple."), /*tp_doc*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("converts a :term:`tabix row` into a python tuple.\n\n    Access is by numeric index.\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
@@ -6666,7 +6809,7 @@ static PyBufferProcs __pyx_tp_as_buffer_asGTF = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_asGTF = {
+static PyTypeObject __pyx_type_6ctabix_asGTF = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.asGTF"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_asGTF), /*tp_basicsize*/
@@ -6690,8 +6833,8 @@ PyTypeObject __pyx_type_6ctabix_asGTF = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_asGTF, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("converts a :term:`tabix row` into a GTF record."), /*tp_doc*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("converts a :term:`tabix row` into a GTF record with the following \n    fields:\n\n    contig\n       contig\n    feature\n       feature\n    source\n       source\n    start\n       genomic start coordinate (0-based)\n    end\n       genomic end coordinate plus one (0-based)\n    score\n       feature score\n    strand\n       strand\n    frame\n       frame\n    attributes\n       attribute string.\n\n    GTF formatted entries also defined the attributes:\n\n    gene_id\n       the gene identifier\n    transcript_ind\n       the transcript identifier\n    \n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
@@ -6830,7 +6973,7 @@ static PyBufferProcs __pyx_tp_as_buffer_asBed = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_asBed = {
+static PyTypeObject __pyx_type_6ctabix_asBed = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.asBed"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_asBed), /*tp_basicsize*/
@@ -6854,8 +6997,8 @@ PyTypeObject __pyx_type_6ctabix_asBed = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_asBed, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("converts a :term:`tabix row` into a GTF record."), /*tp_doc*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("converts a :term:`tabix row` into a bed record\n    with the following fields:\n\n    contig\n       contig\n    start\n       genomic start coordinate (zero-based)\n    end\n       genomic end coordinate plus one (zero-based)\n    name\n       name of feature.\n    score\n       score of feature\n    strand\n       strand of feature\n    thickStart\n       thickStart\n    thickEnd\n       thickEnd\n    itemRGB\n       itemRGB\n    blockCount\n       number of bocks\n    blockSizes\n       ',' separated string of block sizes\n    blockStarts\n       ',' separated string of block genomic start positions\n\n    Only the first three fields are required. Additional\n    fields are optional, but if one is defined, all the preceeding\n    need to be defined as well.\n\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
@@ -6994,7 +7137,7 @@ static PyBufferProcs __pyx_tp_as_buffer_asVCF = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_asVCF = {
+static PyTypeObject __pyx_type_6ctabix_asVCF = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.asVCF"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_asVCF), /*tp_basicsize*/
@@ -7018,8 +7161,8 @@ PyTypeObject __pyx_type_6ctabix_asVCF = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_asVCF, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
-  __Pyx_DOCSTR("converts a :term:`tabix row` into a VCF record."), /*tp_doc*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("converts a :term:`tabix row` into a VCF record with\n    the following fields:\n    \n    contig\n       contig\n    pos\n       chromosomal position, zero-based\n    id \n       id\n    ref\n       reference\n    alt\n       alt\n    qual\n       qual\n    filter\n       filter\n    info\n       info\n    format\n       format specifier.\n\n    Access to genotypes is via index::\n\n        contig = vcf.contig\n        first_sample_genotype = vcf[0]\n        second_sample_genotype = vcf[1]\n\n    "), /*tp_doc*/
   0, /*tp_traverse*/
   0, /*tp_clear*/
   0, /*tp_richcompare*/
@@ -7068,7 +7211,7 @@ static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pf_6ctabix_19TabixIteratorParsed___dealloc__(o);
+    __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -7096,7 +7239,7 @@ static int __pyx_tp_clear_6ctabix_TabixIteratorParsed(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_6ctabix_TabixIteratorParsed[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixIteratorParsed___next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixIteratorParsed___next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixIteratorParsed_2__next__)},
   {0, 0, 0, 0}
 };
 
@@ -7198,7 +7341,7 @@ static PyBufferProcs __pyx_tp_as_buffer_TabixIteratorParsed = {
   #endif
 };
 
-PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
+static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("ctabix.TabixIteratorParsed"), /*tp_name*/
   sizeof(struct __pyx_obj_6ctabix_TabixIteratorParsed), /*tp_basicsize*/
@@ -7222,14 +7365,14 @@ PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_TabixIteratorParsed, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("iterates over mapped reads in a region.\n\n    Returns parsed data.\n    "), /*tp_doc*/
   __pyx_tp_traverse_6ctabix_TabixIteratorParsed, /*tp_traverse*/
   __pyx_tp_clear_6ctabix_TabixIteratorParsed, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pf_6ctabix_19TabixIteratorParsed___iter__, /*tp_iter*/
-  __pyx_pf_6ctabix_19TabixIteratorParsed___next__, /*tp_iternext*/
+  __pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__, /*tp_iter*/
+  __pyx_pf_6ctabix_19TabixIteratorParsed_2__next__, /*tp_iternext*/
   __pyx_methods_6ctabix_TabixIteratorParsed, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -7255,8 +7398,6 @@ PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
 };
 
 static PyMethodDef __pyx_methods[] = {
-  {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pf_6ctabix_tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_compress)},
-  {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pf_6ctabix_tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_index)},
   {0, 0, 0, 0}
 };
 
@@ -7278,31 +7419,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
   {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
   {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
-  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
-  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
-  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
   {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
-  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
-  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
   {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
   {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
-  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
+  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
   {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
-  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
   {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
-  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
-  {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
-  {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
+  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
   {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
-  {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
-  {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
-  {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
-  {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0},
-  {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
-  {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0},
-  {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
-  {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0},
+  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
+  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
+  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
   {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
+  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
+  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
   {&__pyx_kp_s_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},
@@ -7313,19 +7444,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1},
   {&__pyx_n_s__O_RDONLY, __pyx_k__O_RDONLY, sizeof(__pyx_k__O_RDONLY), 0, 0, 1, 1},
   {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
-  {&__pyx_n_s__TabixHeaderIterator, __pyx_k__TabixHeaderIterator, sizeof(__pyx_k__TabixHeaderIterator), 0, 0, 1, 1},
-  {&__pyx_n_s__TabixIterator, __pyx_k__TabixIterator, sizeof(__pyx_k__TabixIterator), 0, 0, 1, 1},
-  {&__pyx_n_s__TabixIteratorParsed, __pyx_k__TabixIteratorParsed, sizeof(__pyx_k__TabixIteratorParsed), 0, 0, 1, 1},
   {&__pyx_n_s__Tabixfile, __pyx_k__Tabixfile, sizeof(__pyx_k__Tabixfile), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
-  {&__pyx_n_s____get__, __pyx_k____get__, sizeof(__pyx_k____get__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
-  {&__pyx_n_s____next__, __pyx_k____next__, sizeof(__pyx_k____next__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
+  {&__pyx_n_s___filename, __pyx_k___filename, sizeof(__pyx_k___filename), 0, 0, 1, 1},
   {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1},
   {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1},
   {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
+  {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
   {&__pyx_n_s__asBed, __pyx_k__asBed, sizeof(__pyx_k__asBed), 0, 0, 1, 1},
   {&__pyx_n_s__asGTF, __pyx_k__asGTF, sizeof(__pyx_k__asGTF), 0, 0, 1, 1},
   {&__pyx_n_s__asTuple, __pyx_k__asTuple, sizeof(__pyx_k__asTuple), 0, 0, 1, 1},
@@ -7335,13 +7463,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
   {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
   {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
+  {&__pyx_n_s__ctabix, __pyx_k__ctabix, sizeof(__pyx_k__ctabix), 0, 0, 1, 1},
   {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
   {&__pyx_n_s__ec, __pyx_k__ec, sizeof(__pyx_k__ec), 0, 0, 1, 1},
   {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
   {&__pyx_n_s__end_col, __pyx_k__end_col, sizeof(__pyx_k__end_col), 0, 0, 1, 1},
   {&__pyx_n_s__endswith, __pyx_k__endswith, sizeof(__pyx_k__endswith), 0, 0, 1, 1},
   {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
-  {&__pyx_n_s__fetch, __pyx_k__fetch, sizeof(__pyx_k__fetch), 0, 0, 1, 1},
   {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
   {&__pyx_n_s__filename_in, __pyx_k__filename_in, sizeof(__pyx_k__filename_in), 0, 0, 1, 1},
   {&__pyx_n_s__filename_out, __pyx_k__filename_out, sizeof(__pyx_k__filename_out), 0, 0, 1, 1},
@@ -7349,7 +7477,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1},
   {&__pyx_n_s__gff, __pyx_k__gff, sizeof(__pyx_k__gff), 0, 0, 1, 1},
   {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1},
-  {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1},
   {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
   {&__pyx_n_s__iterator, __pyx_k__iterator, sizeof(__pyx_k__iterator), 0, 0, 1, 1},
   {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
@@ -7389,163 +7516,411 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
 }
 
-static int __Pyx_InitGlobals(void) {
-  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_0x10000 = PyInt_FromLong(0x10000); if (unlikely(!__pyx_int_0x10000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
+static int __Pyx_InitCachedConstants(void) {
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
 
-#if PY_MAJOR_VERSION < 3
-PyMODINIT_FUNC initctabix(void); /*proto*/
-PyMODINIT_FUNC initctabix(void)
-#else
-PyMODINIT_FUNC PyInit_ctabix(void); /*proto*/
-PyMODINIT_FUNC PyInit_ctabix(void)
-#endif
-{
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  #if CYTHON_REFNANNY
-  void* __pyx_refnanny = NULL;
-  __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");
-  }
-  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ctabix(void)", __LINE__, __FILE__);
-  #endif
-  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #ifdef __pyx_binding_PyCFunctionType_USED
-  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #endif
-  /*--- Library function declarations ---*/
-  /*--- Threads initialization code ---*/
-  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
-  #ifdef WITH_THREAD /* Python build with threading support? */
-  PyEval_InitThreads();
-  #endif
-  #endif
-  /*--- Module creation code ---*/
-  #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
-  #else
-  __pyx_m = PyModule_Create(&__pyx_moduledef);
-  #endif
-  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  #if PY_MAJOR_VERSION < 3
-  Py_INCREF(__pyx_m);
-  #endif
-  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
-  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  /*--- Initialize various global constants etc. ---*/
-  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_module_is_main_ctabix) {
-    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  }
-  /*--- Builtin init code ---*/
-  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  /*--- Global init code ---*/
-  /*--- Function export code ---*/
-  /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_Tabixfile = &__pyx_type_6ctabix_Tabixfile;
-  if (PyType_Ready(&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_Parser = &__pyx_type_6ctabix_Parser;
-  if (PyType_Ready(&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_6ctabix_13TabixIterator___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_6ctabix_13TabixIterator___next__.doc = __pyx_doc_6ctabix_13TabixIterator___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_13TabixIterator___next__;
-    }
-  }
-  if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_TabixIterator = &__pyx_type_6ctabix_TabixIterator;
-  if (PyType_Ready(&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_6ctabix_19TabixHeaderIterator___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_6ctabix_19TabixHeaderIterator___next__.doc = __pyx_doc_6ctabix_19TabixHeaderIterator___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixHeaderIterator___next__;
-    }
-  }
-  if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_TabixHeaderIterator = &__pyx_type_6ctabix_TabixHeaderIterator;
-  __pyx_type_6ctabix_asTuple.tp_base = __pyx_ptype_6ctabix_Parser;
-  if (PyType_Ready(&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "asTuple", (PyObject *)&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asTuple = &__pyx_type_6ctabix_asTuple;
-  __pyx_type_6ctabix_asGTF.tp_base = __pyx_ptype_6ctabix_Parser;
-  if (PyType_Ready(&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "asGTF", (PyObject *)&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asGTF = &__pyx_type_6ctabix_asGTF;
-  __pyx_type_6ctabix_asBed.tp_base = __pyx_ptype_6ctabix_Parser;
-  if (PyType_Ready(&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "asBed", (PyObject *)&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asBed = &__pyx_type_6ctabix_asBed;
-  __pyx_type_6ctabix_asVCF.tp_base = __pyx_ptype_6ctabix_Parser;
-  if (PyType_Ready(&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asVCF = &__pyx_type_6ctabix_asVCF;
-  if (PyType_Ready(&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /* "ctabix.pyx":126
+ * 
+ *         if not self._isOpen():
+ *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ * 
+ *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
+ */
+  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+
+  /* "ctabix.pyx":149
+ *         '''filename associated with this object.'''
+ *         def __get__(self):
+ *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
+ *             return self._filename
+ * 
+ */
+  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+
+  /* "ctabix.pyx":219
+ * 
+ *         if <void*>self.iterator == NULL:
+ *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
+ * 
+ *     def __iter__(self):
+ */
+  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
+
+  /* "ctabix.pyx":266
+ * 
+ *         if <void*>self.iterator == NULL:
+ *             raise ValueError("can't open header.\n")             # <<<<<<<<<<<<<<
+ * 
+ *     def __iter__(self):
+ */
+  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+
+  /* "ctabix.pyx":461
+ * 
+ *         if <void*>self.iterator == NULL:
+ *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
+ * 
+ *     def __iter__(self):
+ */
+  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
+
+  /* "ctabix.pyx":512
+ *     fp = bgzf_open( filename_out, "w")
+ *     if fp == NULL:
+ *         raise IOError( "could not open '%s' for writing" )             # <<<<<<<<<<<<<<
+ * 
+ *     fd_src = open(filename_in, O_RDONLY)
+ */
+  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
+  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_21));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
+
+  /* "ctabix.pyx":516
+ *     fd_src = open(filename_in, O_RDONLY)
+ *     if fd_src == 0:
+ *         raise IOError( "could not open '%s' for reading" )             # <<<<<<<<<<<<<<
+ * 
+ *     buffer = malloc(WINDOW_SIZE)
+ */
+  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
+  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+
+  /* "ctabix.pyx":525
+ *         if r < 0:
+ *             free( buffer )
+ *             raise OSError("writing failed")             # <<<<<<<<<<<<<<
+ * 
+ *     free( buffer )
+ */
+  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+
+  /* "ctabix.pyx":529
+ *     free( buffer )
+ *     r = bgzf_close(fp)
+ *     if r < 0: raise OSError("writing failed")             # <<<<<<<<<<<<<<
+ * 
+ * def tabix_index( filename,
+ */
+  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
+  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_25));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
+
+  /* "ctabix.pyx":575
+ *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
+ * 
+ *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
+ * 
+ *         tabix_compress( filename, filename + ".gz", force = force )
+ */
+  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_32));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
+
+  /* "ctabix.pyx":582
+ * 
+ *     if not force and os.path.exists(filename + ".tbi" ):
+ *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
+ * 
+ *     # columns (1-based)
+ */
+  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
+
+  /* "ctabix.pyx":588
+ *     # 0 is a missing column
+ *     preset2conf = {
+ *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),             # <<<<<<<<<<<<<<
+ *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
+ *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
+ */
+  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+
+  /* "ctabix.pyx":589
+ *     preset2conf = {
+ *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
+ *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),             # <<<<<<<<<<<<<<
+ *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
+ *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
+ */
+  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
+
+  /* "ctabix.pyx":590
+ *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
+ *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
+ *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),             # <<<<<<<<<<<<<<
+ *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
+ *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
+ */
+  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+
+  /* "ctabix.pyx":591
+ *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
+ *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
+ *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
+ *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
+ *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),
+ */
+  __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
+
+  /* "ctabix.pyx":592
+ *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
+ *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
+ *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
+ *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),
+ *         }
+ */
+  __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+  PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
+
+  /* "ctabix.pyx":593
+ *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
+ *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
+ *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
+ *         }
+ * 
+ */
+  __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+  __Pyx_RefNannyFinishContext();
+  return 0;
+  __pyx_L1_error:;
+  __Pyx_RefNannyFinishContext();
+  return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initctabix(void); /*proto*/
+PyMODINIT_FUNC initctabix(void)
+#else
+PyMODINIT_FUNC PyInit_ctabix(void); /*proto*/
+PyMODINIT_FUNC PyInit_ctabix(void)
+#endif
+{
+  PyObject *__pyx_t_1 = NULL;
+  #if CYTHON_REFNANNY
+  void* __pyx_refnanny = NULL;
+  __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");
+  }
+  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ctabix(void)", __LINE__, __FILE__);
+  #endif
+  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifdef __pyx_binding_PyCFunctionType_USED
+  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  /*--- Library function declarations ---*/
+  /*--- Threads initialization code ---*/
+  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+  #ifdef WITH_THREAD /* Python build with threading support? */
+  PyEval_InitThreads();
+  #endif
+  #endif
+  /*--- Module creation code ---*/
+  #if PY_MAJOR_VERSION < 3
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
+  #else
+  __pyx_m = PyModule_Create(&__pyx_moduledef);
+  #endif
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
+  #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  /*--- Initialize various global constants etc. ---*/
+  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_module_is_main_ctabix) {
+    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  }
+  /*--- Builtin init code ---*/
+  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Constants init code ---*/
+  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Global init code ---*/
+  /*--- Function export code ---*/
+  /*--- Type init code ---*/
+  if (PyType_Ready(&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_Tabixfile = &__pyx_type_6ctabix_Tabixfile;
+  if (PyType_Ready(&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_Parser = &__pyx_type_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_6ctabix_19TabixIteratorParsed___next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_6ctabix_19TabixIteratorParsed___next__.doc = __pyx_doc_6ctabix_19TabixIteratorParsed___next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixIteratorParsed___next__;
+      __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__.doc = __pyx_doc_6ctabix_13TabixIterator_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_13TabixIterator_2__next__;
     }
   }
-  if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_TabixIterator = &__pyx_type_6ctabix_TabixIterator;
+  if (PyType_Ready(&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__.doc = __pyx_doc_6ctabix_19TabixHeaderIterator_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__;
+    }
+  }
+  if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_TabixHeaderIterator = &__pyx_type_6ctabix_TabixHeaderIterator;
+  __pyx_type_6ctabix_asTuple.tp_base = __pyx_ptype_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asTuple", (PyObject *)&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_asTuple = &__pyx_type_6ctabix_asTuple;
+  __pyx_type_6ctabix_asGTF.tp_base = __pyx_ptype_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asGTF", (PyObject *)&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_asGTF = &__pyx_type_6ctabix_asGTF;
+  __pyx_type_6ctabix_asBed.tp_base = __pyx_ptype_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asBed", (PyObject *)&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_asBed = &__pyx_type_6ctabix_asBed;
+  __pyx_type_6ctabix_asVCF.tp_base = __pyx_ptype_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_6ctabix_asVCF = &__pyx_type_6ctabix_asVCF;
+  if (PyType_Ready(&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+      __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__.doc = __pyx_doc_6ctabix_19TabixIteratorParsed_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__;
+    }
+  }
+  if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_6ctabix_TabixIteratorParsed = &__pyx_type_6ctabix_TabixIteratorParsed;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict, &__pyx_vtabptr_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict, &__pyx_vtabptr_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict, &__pyx_vtabptr_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict, &__pyx_vtabptr_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict, &__pyx_vtabptr_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":4
+  /* "ctabix.pyx":4
  * # adds doc-strings for sphinx
  * 
  * import tempfile, os, sys, types, itertools, struct, ctypes, gzip             # <<<<<<<<<<<<<<
@@ -7585,53 +7960,77 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":364
+  /* "ctabix.pyx":488
  * def tabix_compress( filename_in,
  *               filename_out,
  *               force = False ):             # <<<<<<<<<<<<<<
  * 
  *     '''
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_k_14 = __pyx_t_1;
+  __pyx_k_19 = __pyx_t_1;
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":408
+  /* "ctabix.pyx":486
+ *             ti_iter_destroy(self.iterator)
+ * 
+ * def tabix_compress( filename_in,             # <<<<<<<<<<<<<<
+ *               filename_out,
+ *               force = False ):
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_tabix_compress, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_compress, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "ctabix.pyx":532
  * 
  * def tabix_index( filename,
  *                  force = False,             # <<<<<<<<<<<<<<
  *                  seq_col = None,
  *                  start_col = None,
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_k_19 = __pyx_t_1;
+  __pyx_k_28 = __pyx_t_1;
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":414
+  /* "ctabix.pyx":538
  *                  preset = None,
  *                  meta_char = "#",
  *                  zerobased = False,             # <<<<<<<<<<<<<<
  *                 ):
  *     '''
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_k_21 = __pyx_t_1;
+  __pyx_k_30 = __pyx_t_1;
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":497
+  /* "ctabix.pyx":531
+ *     if r < 0: raise OSError("writing failed")
+ * 
+ * def tabix_index( filename,             # <<<<<<<<<<<<<<
+ *                  force = False,
+ *                  seq_col = None,
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_1tabix_index, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_index, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "ctabix.pyx":621
  *     return filename
  * 
  * __all__ = ["tabix_index",             # <<<<<<<<<<<<<<
  *            "tabix_compress",
  *            "Tabixfile",
  */
-  __pyx_t_1 = PyList_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_index));
   PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tabix_index));
@@ -7654,117 +8053,20 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_INCREF(((PyObject *)__pyx_n_s__asBed));
   PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__asBed));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asBed));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/ctabix.pyx":1
+  /* "ctabix.pyx":1
  * # cython: embedsignature=True             # <<<<<<<<<<<<<<
  * # adds doc-strings for sphinx
  * 
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Tabixfile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_28), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Tabixfile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_29), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Tabixfile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_30), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Tabixfile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fetch); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_31), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Tabixfile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____get__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_32), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TabixIterator); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____next__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_33), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TabixHeaderIterator); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____next__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_34), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TabixIteratorParsed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____next__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_35), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_36), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__tabix_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_37), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/apps/apps/python-2.7.1/lib/python2.7/site-packages/Cython-0.13-py2.7-linux-x86_64.egg/Cython/Includes/cpython/type.pxd":2
+  /* "cpython/type.pxd":2
  * 
  * cdef extern from "Python.h":             # <<<<<<<<<<<<<<
  *     # The C structure of the objects used to describe built-in types.
@@ -7773,8 +8075,6 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   if (__pyx_m) {
     __Pyx_AddTraceback("init ctabix");
     Py_DECREF(__pyx_m); __pyx_m = 0;
@@ -7847,6 +8147,85 @@ static void __Pyx_RaiseDoubleKeywordsError(
         #endif
 }
 
+static int __Pyx_ParseOptionalKeywords(
+    PyObject *kwds,
+    PyObject **argnames[],
+    PyObject *kwds2,
+    PyObject *values[],
+    Py_ssize_t num_pos_args,
+    const char* function_name)
+{
+    PyObject *key = 0, *value = 0;
+    Py_ssize_t pos = 0;
+    PyObject*** name;
+    PyObject*** first_kw_arg = argnames + num_pos_args;
+
+    while (PyDict_Next(kwds, &pos, &key, &value)) {
+        name = first_kw_arg;
+        while (*name && (**name != key)) name++;
+        if (*name) {
+            values[name-argnames] = value;
+        } else {
+            #if PY_MAJOR_VERSION < 3
+            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
+            #else
+            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
+            #endif
+                goto invalid_keyword_type;
+            } else {
+                for (name = first_kw_arg; *name; name++) {
+                    #if PY_MAJOR_VERSION >= 3
+                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                        PyUnicode_Compare(**name, key) == 0) break;
+                    #else
+                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                        _PyString_Eq(**name, key)) break;
+                    #endif
+                }
+                if (*name) {
+                    values[name-argnames] = value;
+                } else {
+                    /* unexpected keyword found */
+                    for (name=argnames; name != first_kw_arg; name++) {
+                        if (**name == key) goto arg_passed_twice;
+                        #if PY_MAJOR_VERSION >= 3
+                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
+                        #else
+                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                            _PyString_Eq(**name, key)) goto arg_passed_twice;
+                        #endif
+                    }
+                    if (kwds2) {
+                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+                    } else {
+                        goto invalid_keyword;
+                    }
+                }
+            }
+        }
+    }
+    return 0;
+arg_passed_twice:
+    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
+    goto bad;
+invalid_keyword_type:
+    PyErr_Format(PyExc_TypeError,
+        "%s() keywords must be strings", function_name);
+    goto bad;
+invalid_keyword:
+    PyErr_Format(PyExc_TypeError,
+    #if PY_MAJOR_VERSION < 3
+        "%s() got an unexpected keyword argument '%s'",
+        function_name, PyString_AsString(key));
+    #else
+        "%s() got an unexpected keyword argument '%U'",
+        function_name, key);
+    #endif
+bad:
+    return -1;
+}
+
 static void __Pyx_RaiseArgtupleInvalid(
     const char* func_name,
     int exact,
@@ -7864,98 +8243,156 @@ static void __Pyx_RaiseArgtupleInvalid(
         num_expected = num_max;
         more_or_less = "at most";
     }
-    if (exact) {
-        more_or_less = "exactly";
+    if (exact) {
+        more_or_less = "exactly";
+    }
+    number = (num_expected == 1) ? "" : "s";
+    PyErr_Format(PyExc_TypeError,
+        #if PY_VERSION_HEX < 0x02050000
+            "%s() takes %s %d positional argument%s (%d given)",
+        #else
+            "%s() takes %s %zd positional argument%s (%zd given)",
+        #endif
+        func_name, more_or_less, num_expected, number, num_found);
+}
+
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+
+    tmp_type = tstate->curexc_type;
+    tmp_value = tstate->curexc_value;
+    tmp_tb = tstate->curexc_traceback;
+    tstate->curexc_type = type;
+    tstate->curexc_value = value;
+    tstate->curexc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+}
+
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->curexc_type;
+    *value = tstate->curexc_value;
+    *tb = tstate->curexc_traceback;
+
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+}
+
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    Py_XINCREF(type);
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    /* Next, replace a missing value with None */
+    if (value == NULL) {
+        value = Py_None;
+        Py_INCREF(value);
+    }
+    #if PY_VERSION_HEX < 0x02050000
+    if (!PyClass_Check(type))
+    #else
+    if (!PyType_Check(type))
+    #endif
+    {
+        /* Raising an instance.  The value should be a dummy. */
+        if (value != Py_None) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto raise_error;
+        }
+        /* Normalize to raise <class>, <instance> */
+        Py_DECREF(value);
+        value = type;
+        #if PY_VERSION_HEX < 0x02050000
+            if (PyInstance_Check(type)) {
+                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+                Py_INCREF(type);
+            }
+            else {
+                type = 0;
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception must be an old-style class or instance");
+                goto raise_error;
+            }
+        #else
+            type = (PyObject*) Py_TYPE(type);
+            Py_INCREF(type);
+            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception class must be a subclass of BaseException");
+                goto raise_error;
+            }
+        #endif
+    }
+
+    __Pyx_ErrRestore(type, value, tb);
+    return;
+raise_error:
+    Py_XDECREF(value);
+    Py_XDECREF(type);
+    Py_XDECREF(tb);
+    return;
+}
+
+#else /* Python 3+ */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    if (tb == Py_None) {
+        tb = 0;
+    } else if (tb && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto bad;
+    }
+    if (value == Py_None)
+        value = 0;
+
+    if (PyExceptionInstance_Check(type)) {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto bad;
+        }
+        value = type;
+        type = (PyObject*) Py_TYPE(value);
+    } else if (!PyExceptionClass_Check(type)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: exception class must be a subclass of BaseException");
+        goto bad;
     }
-    number = (num_expected == 1) ? "" : "s";
-    PyErr_Format(PyExc_TypeError,
-        #if PY_VERSION_HEX < 0x02050000
-            "%s() takes %s %d positional argument%s (%d given)",
-        #else
-            "%s() takes %s %zd positional argument%s (%zd given)",
-        #endif
-        func_name, more_or_less, num_expected, number, num_found);
-}
 
-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;
+    PyErr_SetObject(type, value);
 
-    while (PyDict_Next(kwds, &pos, &key, &value)) {
-        name = first_kw_arg;
-        while (*name && (**name != key)) name++;
-        if (*name) {
-            values[name-argnames] = value;
-        } else {
-            #if PY_MAJOR_VERSION < 3
-            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
-            #else
-            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
-            #endif
-                goto invalid_keyword_type;
-            } else {
-                for (name = first_kw_arg; *name; name++) {
-                    #if PY_MAJOR_VERSION >= 3
-                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
-                        PyUnicode_Compare(**name, key) == 0) break;
-                    #else
-                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
-                        _PyString_Eq(**name, key)) break;
-                    #endif
-                }
-                if (*name) {
-                    values[name-argnames] = value;
-                } else {
-                    /* unexpected keyword found */
-                    for (name=argnames; name != first_kw_arg; name++) {
-                        if (**name == key) goto arg_passed_twice;
-                        #if PY_MAJOR_VERSION >= 3
-                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
-                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
-                        #else
-                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
-                            _PyString_Eq(**name, key)) goto arg_passed_twice;
-                        #endif
-                    }
-                    if (kwds2) {
-                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
-                    } else {
-                        goto invalid_keyword;
-                    }
-                }
-            }
+    if (tb) {
+        PyThreadState *tstate = PyThreadState_GET();
+        PyObject* tmp_tb = tstate->curexc_traceback;
+        if (tb != tmp_tb) {
+            Py_INCREF(tb);
+            tstate->curexc_traceback = tb;
+            Py_XDECREF(tmp_tb);
         }
     }
-    return 0;
-arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
-    goto bad;
-invalid_keyword_type:
-    PyErr_Format(PyExc_TypeError,
-        "%s() keywords must be strings", function_name);
-    goto bad;
-invalid_keyword:
-    PyErr_Format(PyExc_TypeError,
-    #if PY_MAJOR_VERSION < 3
-        "%s() got an unexpected keyword argument '%s'",
-        function_name, PyString_AsString(key));
-    #else
-        "%s() got an unexpected keyword argument '%U'",
-        function_name, key);
-    #endif
+
 bad:
-    return -1;
+    return;
 }
-
+#endif
 
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
     PyErr_Format(PyExc_ValueError,
@@ -8126,143 +8563,6 @@ bad:
     return module;
 }
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-
-    tmp_type = tstate->curexc_type;
-    tmp_value = tstate->curexc_value;
-    tmp_tb = tstate->curexc_traceback;
-    tstate->curexc_type = type;
-    tstate->curexc_value = value;
-    tstate->curexc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-}
-
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->curexc_type;
-    *value = tstate->curexc_value;
-    *tb = tstate->curexc_traceback;
-
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-}
-
-
-#if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    Py_XINCREF(type);
-    Py_XINCREF(value);
-    Py_XINCREF(tb);
-    /* First, check the traceback argument, replacing None with NULL. */
-    if (tb == Py_None) {
-        Py_DECREF(tb);
-        tb = 0;
-    }
-    else if (tb != NULL && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto raise_error;
-    }
-    /* Next, replace a missing value with None */
-    if (value == NULL) {
-        value = Py_None;
-        Py_INCREF(value);
-    }
-    #if PY_VERSION_HEX < 0x02050000
-    if (!PyClass_Check(type))
-    #else
-    if (!PyType_Check(type))
-    #endif
-    {
-        /* Raising an instance.  The value should be a dummy. */
-        if (value != Py_None) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto raise_error;
-        }
-        /* Normalize to raise <class>, <instance> */
-        Py_DECREF(value);
-        value = type;
-        #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
-            Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
-        #endif
-    }
-
-    __Pyx_ErrRestore(type, value, tb);
-    return;
-raise_error:
-    Py_XDECREF(value);
-    Py_XDECREF(type);
-    Py_XDECREF(tb);
-    return;
-}
-
-#else /* Python 3+ */
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    if (tb == Py_None) {
-        tb = 0;
-    } else if (tb && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto bad;
-    }
-    if (value == Py_None)
-        value = 0;
-
-    if (PyExceptionInstance_Check(type)) {
-        if (value) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto bad;
-        }
-        value = type;
-        type = (PyObject*) Py_TYPE(value);
-    } else if (!PyExceptionClass_Check(type)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: exception class must be a subclass of BaseException");
-        goto bad;
-    }
-
-    PyErr_SetObject(type, value);
-
-    if (tb) {
-        PyThreadState *tstate = PyThreadState_GET();
-        PyObject* tmp_tb = tstate->curexc_traceback;
-        if (tb != tmp_tb) {
-            Py_INCREF(tb);
-            tstate->curexc_traceback = tb;
-            Py_XDECREF(tmp_tb);
-        }
-    }
-
-bad:
-    return;
-}
-#endif
-
 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
     const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -8743,13 +9043,13 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     if (!result)
         goto bad;
     if (!PyType_Check(result)) {
-        PyErr_Format(PyExc_TypeError, 
+        PyErr_Format(PyExc_TypeError,
             "%s.%s is not a type object",
             module_name, class_name);
         goto bad;
     }
     if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
-        PyOS_snprintf(warning, sizeof(warning), 
+        PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
         #if PY_VERSION_HEX < 0x02050000
@@ -8759,7 +9059,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         #endif
     }
     else if (((PyTypeObject *)result)->tp_basicsize != size) {
-        PyErr_Format(PyExc_ValueError, 
+        PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
         goto bad;
@@ -8794,22 +9094,23 @@ bad:
 }
 #endif
 
-static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) {
+static void* __Pyx_GetVtable(PyObject *dict) {
+    void* ptr;
     PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
     if (!ob)
         goto bad;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    *(void **)vtabptr = PyCapsule_GetPointer(ob, 0);
+    ptr = PyCapsule_GetPointer(ob, 0);
 #else
-    *(void **)vtabptr = PyCObject_AsVoidPtr(ob);
+    ptr = PyCObject_AsVoidPtr(ob);
 #endif
-    if (!*(void **)vtabptr)
-        goto bad;
+    if (!ptr && !PyErr_Occurred())
+        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
     Py_DECREF(ob);
-    return 0;
+    return ptr;
 bad:
     Py_XDECREF(ob);
-    return -1;
+    return NULL;
 }
 
 #include "compile.h"
index 950e28e6252b9d741b71d26fc13e03ee5e0a427a..7e15c43d068428d502b4c46d934d7a681747613d 100644 (file)
@@ -170,7 +170,7 @@ cdef extern from "tabix.h":
   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
 
 cdef class Tabixfile:
-    cdef char * filename
+    cdef char * _filename
 
     # pointer to tabixfile
     cdef tabix_t * tabixfile
index 25c1a1ee732df3e383a29e80c1ea2ae533b7925e..a31f3f244b37329286cc23760d5c2942b8628103 100644 (file)
@@ -33,7 +33,9 @@ cdef class Tabixfile:
         if self.tabixfile != NULL: self.close()
         self.tabixfile = NULL
 
-        self.filename = filename
+        if self._filename != NULL: free(self._filename )
+        self._filename = strdup( filename )
+
         filename_index = filename + ".tbi"
 
         if mode[0] == 'w':
@@ -42,14 +44,14 @@ cdef class Tabixfile:
 
         elif mode[0] == "r":
             # open file for reading
-            if not os.path.exists( self.filename ):
-                raise IOError( "file `%s` not found" % self.filename)
+            if not os.path.exists( self._filename ):
+                raise IOError( "file `%s` not found" % self._filename)
 
             if not os.path.exists( filename_index ):
                 raise IOError( "index `%s` not found" % filename_index)
 
             # open file and load index
-            self.tabixfile = ti_open( self.filename, filename_index )
+            self.tabixfile = ti_open( self._filename, filename_index )
 
         if self.tabixfile == NULL:
             raise IOError("could not open file `%s`" % filename )
@@ -136,12 +138,26 @@ cdef class Tabixfile:
             else:
                 return TabixIteratorParsed( self, -1, 0, 0, parser )
 
+    ###############################################################
+    ###############################################################
+    ###############################################################
+    ## properties
+    ###############################################################
+    property filename:
+        '''filename associated with this object.'''
+        def __get__(self):
+            if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
+            return self._filename
+
     property header:
+        '''the file header.
+          
+        .. note::
+            The header is returned as an iterator over lines without the
+            newline character.
+        '''
+        
         def __get__( self ):
-            '''return header lines as an iterator.
-
-            Note that the header lines do not contain the newline '\n' character.
-            '''
             return TabixHeaderIterator( self )
 
     property contigs:
@@ -158,6 +174,22 @@ cdef class Tabixfile:
                 result.append( sequences[x] )
             return result
             
+    def close( self ):
+        '''
+        closes the :class:`pysam.Tabixfile`.'''
+        if self.tabixfile != NULL:
+            ti_close( self.tabixfile )
+            self.tabixfile = NULL
+
+    def __dealloc__( self ):
+        # remember: dealloc cannot call other python methods
+        # note: no doc string
+        # note: __del__ is not called.
+        if self.tabixfile != NULL:
+            ti_close( self.tabixfile )
+            self.tabixfile = NULL
+        if self._filename != NULL: free( self._filename )
+
 cdef class TabixIterator:
     """iterates over rows in *tabixfile* in region
     given by *tid*, *start* and *end*.
@@ -265,7 +297,10 @@ cdef class Parser:
     pass
 
 cdef class asTuple(Parser):
-    '''converts a :term:`tabix row` into a python tuple.''' 
+    '''converts a :term:`tabix row` into a python tuple.
+
+    Access is by numeric index.
+    ''' 
     def __call__(self, char * buffer, int len):
         cdef TabProxies.TupleProxy r
         r = TabProxies.TupleProxy()
@@ -275,7 +310,36 @@ cdef class asTuple(Parser):
         return r
 
 cdef class asGTF(Parser):
-    '''converts a :term:`tabix row` into a GTF record.''' 
+    '''converts a :term:`tabix row` into a GTF record with the following 
+    fields:
+
+    contig
+       contig
+    feature
+       feature
+    source
+       source
+    start
+       genomic start coordinate (0-based)
+    end
+       genomic end coordinate plus one (0-based)
+    score
+       feature score
+    strand
+       strand
+    frame
+       frame
+    attributes
+       attribute string.
+
+    GTF formatted entries also defined the attributes:
+
+    gene_id
+       the gene identifier
+    transcript_ind
+       the transcript identifier
+    
+    ''' 
     def __call__(self, char * buffer, int len):
         cdef TabProxies.GTFProxy r
         r = TabProxies.GTFProxy()
@@ -283,7 +347,39 @@ cdef class asGTF(Parser):
         return r
 
 cdef class asBed( Parser ):
-    '''converts a :term:`tabix row` into a GTF record.''' 
+    '''converts a :term:`tabix row` into a bed record
+    with the following fields:
+
+    contig
+       contig
+    start
+       genomic start coordinate (zero-based)
+    end
+       genomic end coordinate plus one (zero-based)
+    name
+       name of feature.
+    score
+       score of feature
+    strand
+       strand of feature
+    thickStart
+       thickStart
+    thickEnd
+       thickEnd
+    itemRGB
+       itemRGB
+    blockCount
+       number of bocks
+    blockSizes
+       ',' separated string of block sizes
+    blockStarts
+       ',' separated string of block genomic start positions
+
+    Only the first three fields are required. Additional
+    fields are optional, but if one is defined, all the preceeding
+    need to be defined as well.
+
+    ''' 
     def __call__(self, char * buffer, int len):
         cdef TabProxies.BedProxy r
         r = TabProxies.BedProxy()
@@ -291,7 +387,35 @@ cdef class asBed( Parser ):
         return r
 
 cdef class asVCF( Parser ): 
-    '''converts a :term:`tabix row` into a VCF record.'''
+    '''converts a :term:`tabix row` into a VCF record with
+    the following fields:
+    
+    contig
+       contig
+    pos
+       chromosomal position, zero-based
+    id 
+       id
+    ref
+       reference
+    alt
+       alt
+    qual
+       qual
+    filter
+       filter
+    info
+       info
+    format
+       format specifier.
+
+    Access to genotypes is via index::
+
+        contig = vcf.contig
+        first_sample_genotype = vcf[0]
+        second_sample_genotype = vcf[1]
+
+    '''
     def __call__(self, char * buffer, int len ):
         cdef TabProxies.VCFProxy r
         r = TabProxies.VCFProxy()
index 82eae7d1868ff4b1072995053ff6b22929a2d1c7..d194519d5e20e227a6c1d69ba9d9128e3f26b897 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13 on Thu May  5 15:40:49 2011 */
+/* Generated by Cython 0.14.1 on Sat Oct 15 05:27:48 2011 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
   #define PyBytes_Repr                 PyString_Repr
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
 #endif
-
 #ifndef PySet_CheckExact
-#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
+  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
 
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
   #define PyInt_Check(op)              PyLong_Check(op)
   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
 #endif
 
 #if PY_MAJOR_VERSION >= 3
-  #define PyBoolObject PyLongObject
+  #define PyBoolObject                 PyLongObject
 #endif
 
 
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
 #endif
 
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
 #include "bgzf.h"
 #include "tabix.h"
 
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
 /* inline attribute */
 #ifndef CYTHON_INLINE
   #if defined(__GNUC__)
   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
     #define CYTHON_INLINE inline
   #else
-    #define CYTHON_INLINE 
+    #define CYTHON_INLINE
   #endif
 #endif
 
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
 #   else
 #     define CYTHON_UNUSED
 #   endif
 # elif defined(__ICC) || defined(__INTEL_COMPILER)
-#   define CYTHON_UNUSED __attribute__ ((__unused__)) 
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
-#   define CYTHON_UNUSED 
+#   define CYTHON_UNUSED
 # endif
 #endif
 
@@ -257,7 +286,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
 #ifdef __GNUC__
 /* Test for GCC > 2.95 */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
 #define likely(x)   __builtin_expect(!!(x), 1)
 #define unlikely(x) __builtin_expect(!!(x), 0)
 #else /* __GNUC__ > 2 ... */
@@ -287,7 +316,7 @@ static const char *__pyx_f[] = {
 
 /* Type declarations */
 
-/* "pysam/TabProxies.pxd":42
+/* "TabProxies.pxd":42
  *   ctypedef int uint64_t
  * 
  * cdef class TupleProxy:             # <<<<<<<<<<<<<<
@@ -307,7 +336,7 @@ struct __pyx_obj_10TabProxies_TupleProxy {
   int is_modified;
 };
 
-/* "pysam/TabProxies.pxd":77
+/* "TabProxies.pxd":77
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -319,7 +348,7 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
   struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
 };
 
-/* "pysam/TabProxies.pxd":80
+/* "TabProxies.pxd":80
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -335,7 +364,7 @@ struct __pyx_obj_10TabProxies_BedProxy {
   int bedfields;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":94
+/* "cvcf.pyx":94
  * ###########################################################################################################
  * 
  * cdef class VCFRecord( TabProxies.TupleProxy):             # <<<<<<<<<<<<<<
@@ -350,7 +379,7 @@ struct __pyx_obj_4cvcf_VCFRecord {
   uint32_t pos;
 };
 
-/* "pysam/TabProxies.pxd":91
+/* "TabProxies.pxd":91
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -364,7 +393,7 @@ struct __pyx_obj_10TabProxies_VCFProxy {
   uint32_t pos;
 };
 
-/* "pysam/ctabix.pxd":178
+/* "ctabix.pxd":178
  *     cdef tabix_t * tabixfile
  * 
  * cdef class Parser:             # <<<<<<<<<<<<<<
@@ -375,7 +404,7 @@ struct __pyx_obj_6ctabix_Parser {
   PyObject_HEAD
 };
 
-/* "pysam/TabProxies.pxd":60
+/* "TabProxies.pxd":60
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -397,7 +426,7 @@ struct __pyx_obj_10TabProxies_GTFProxy {
   int hasOwnAttributes;
 };
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":221
+/* "cvcf.pyx":221
  * 
  * 
  * cdef class asVCFRecord( ctabix.Parser ):             # <<<<<<<<<<<<<<
@@ -410,7 +439,7 @@ struct __pyx_obj_4cvcf_asVCFRecord {
   PyObject *vcffile;
 };
 
-/* "pysam/ctabix.pxd":172
+/* "ctabix.pxd":172
  *   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
  * 
  * cdef class Tabixfile:             # <<<<<<<<<<<<<<
@@ -425,7 +454,7 @@ struct __pyx_obj_6ctabix_Tabixfile {
 };
 
 
-/* "pysam/TabProxies.pxd":42
+/* "TabProxies.pxd":42
  *   ctypedef int uint64_t
  * 
  * cdef class TupleProxy:             # <<<<<<<<<<<<<<
@@ -443,7 +472,7 @@ struct __pyx_vtabstruct_10TabProxies_TupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
 
 
-/* "pysam/TabProxies.pxd":77
+/* "TabProxies.pxd":77
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -457,7 +486,7 @@ struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
 
 
-/* "pysam/TabProxies.pxd":91
+/* "TabProxies.pxd":91
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -471,7 +500,7 @@ struct __pyx_vtabstruct_10TabProxies_VCFProxy {
 static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
 
 
-/* "pysam/TabProxies.pxd":60
+/* "TabProxies.pxd":60
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
@@ -485,7 +514,7 @@ struct __pyx_vtabstruct_10TabProxies_GTFProxy {
 static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
 
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":94
+/* "cvcf.pyx":94
  * ###########################################################################################################
  * 
  * cdef class VCFRecord( TabProxies.TupleProxy):             # <<<<<<<<<<<<<<
@@ -499,7 +528,7 @@ struct __pyx_vtabstruct_4cvcf_VCFRecord {
 static struct __pyx_vtabstruct_4cvcf_VCFRecord *__pyx_vtabptr_4cvcf_VCFRecord;
 
 
-/* "pysam/TabProxies.pxd":80
+/* "TabProxies.pxd":80
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -560,12 +589,12 @@ static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies
 
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
-static void __Pyx_RaiseDoubleKeywordsError(
-    const char* func_name, PyObject* kw_name); /*proto*/
-
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name, PyObject* kw_name); /*proto*/
+
 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
 
 
@@ -644,6 +673,11 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
 static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
 
 #define __Pyx_PyObject_AsDouble(obj) \
@@ -652,7 +686,6 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
 
 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
 
-
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
@@ -823,12 +856,24 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *modname); /*proto*/
 
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+#define __pyx_binding_PyCFunctionType_USED 1
+
+typedef struct {
+    PyCFunctionObject func;
+} __pyx_binding_PyCFunctionType_object;
+
+static PyTypeObject __pyx_binding_PyCFunctionType_type;
+static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
+
+static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
+#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)
+
+static int __pyx_binding_PyCFunctionType_init(void); /* proto */
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
 
@@ -868,7 +913,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
 
 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
-static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
+static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
 
 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 
@@ -891,7 +936,7 @@ static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0;
 static PyTypeObject *__pyx_ptype_4cvcf_VCFRecord = 0;
 static PyTypeObject *__pyx_ptype_4cvcf_asVCFRecord = 0;
 #define __Pyx_MODULE_NAME "cvcf"
-int __pyx_module_is_main_cvcf = 0;
+static int __pyx_module_is_main_cvcf = 0;
 
 /* Implementation of cvcf */
 static PyObject *__pyx_builtin_object;
@@ -907,126 +952,108 @@ static PyObject *__pyx_builtin_KeyError;
 static PyObject *__pyx_builtin_NotImplementedError;
 static char __pyx_k_1[] = "";
 static char __pyx_k_2[] = ",";
-static char __pyx_k_3[] = ":";
-static char __pyx_k_4[] = "-";
-static char __pyx_k_5[] = "Don't understand region string '%s'";
-static char __pyx_k_6[] = ".";
-static char __pyx_k_7[] = ";";
-static char __pyx_k_8[] = "=";
-static char __pyx_k_9[] = "BAD_NUMBER_OF_VALUES";
-static char __pyx_k_10[] = "(found %s values in element %s; expected %s)";
-static char __pyx_k_11[] = "BAD_NUMBER_OF_PARAMETERS";
-static char __pyx_k_12[] = "id=%s, expected %s parameters, got %s";
-static char __pyx_k_14[] = "Line %s: '%s'\n%s %s: %s\n";
-static char __pyx_k_16[] = "<";
-static char __pyx_k_17[] = "V40_MISSING_ANGLE_BRACKETS";
-static char __pyx_k_18[] = ">";
-static char __pyx_k_19[] = "\"";
-static char __pyx_k_20[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS";
-static char __pyx_k_21[] = "BADLY_FORMATTED_FORMAT_STRING";
-static char __pyx_k_22[] = "ID=";
-static char __pyx_k_23[] = "Number=";
-static char __pyx_k_24[] = "Type=";
-static char __pyx_k_25[] = "Description=";
-static char __pyx_k_26[] = "FORMAT_MISSING_QUOTES";
-static char __pyx_k_27[] = "<none>";
-static char __pyx_k_28[] = "#alleles";
-static char __pyx_k_29[] = "#nonref_alleles";
-static char __pyx_k_30[] = "#genotypes";
-static char __pyx_k_31[] = "#phased_genotypes";
-static char __pyx_k_33[] = "Unknown number type encountered: %s";
-static char __pyx_k_34[] = "%s=%s";
-static char __pyx_k_35[] = "(Undefined tag)";
-static char __pyx_k_38[] = "(output)";
-static char __pyx_k_39[] = "Genotype Quality";
-static char __pyx_k_40[] = "Read depth at this position for this sample";
-static char __pyx_k_41[] = "Haplotype Quality";
-static char __pyx_k_42[] = "Sample Genotype Filter";
-static char __pyx_k_43[] = "##";
-static char __pyx_k_44[] = "VCFv3.3";
-static char __pyx_k_45[] = "VCFv4.0";
-static char __pyx_k_46[] = "VCFv4.1";
-static char __pyx_k_47[] = "UNKNOWN_FORMAT_STRING";
-static char __pyx_k_48[] = "##fileformat=VCFv%s.%s\n";
-static char __pyx_k_49[] = "##%s=%s\n";
-static char __pyx_k_50[] = "#";
-static char __pyx_k_51[] = "\t";
-static char __pyx_k_52[] = "HEADING_NOT_SEPARATED_BY_TABS";
-static char __pyx_k_53[] = "(%sth entry not found)";
-static char __pyx_k_54[] = "(found %s, expected %s)";
-static char __pyx_k_55[] = "BADLY_FORMATTED_HEADING";
-static char __pyx_k_56[] = "\n";
-static char __pyx_k_57[] = "|";
-static char __pyx_k_58[] = "ERROR_FLAG_HAS_VALUE";
-static char __pyx_k_59[] = "ERROR_FORMAT_NOT_NUMERICAL";
-static char __pyx_k_60[] = "ERROR_FORMAT_NOT_CHAR";
-static char __pyx_k_62[] = "BAD_NUMBER_OF_COLUMNS";
-static char __pyx_k_63[] = "expected %s for %s samples (%s), got %s";
-static char __pyx_k_64[] = "(reference is %s, VCF says %s)";
-static char __pyx_k_65[] = "V33_UNMATCHED_DELETION";
-static char __pyx_k_66[] = "(deletion is %s, reference is %s)";
-static char __pyx_k_67[] = "MISSING_INDEL_ALLELE_REF_BASE";
-static char __pyx_k_68[] = "Required key %s not found in data";
-static char __pyx_k_69[] = "enter_default_format";
-static char __pyx_k_70[] = "Can only handle v3.3 and v4.0 VCF files";
-static char __pyx_k_71[] = "Invalid error string: %s";
-static char __pyx_k_72[] = "needs to be checked";
-static char __pyx_k_73[] = "[|/\\\\]";
-static char __pyx_k_74[] = "^[ACGTN]+$";
-static char __pyx_k_75[] = "id numbertype number type description missingvalue";
-static char __pyx_k_76[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier";
-static char __pyx_k_77[] = "BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string";
-static char __pyx_k_78[] = "BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s";
-static char __pyx_k_79[] = "BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)";
-static char __pyx_k_80[] = "POS_NOT_NUMERICAL:Position column is not numerical";
-static char __pyx_k_81[] = "UNKNOWN_CHAR_IN_REF:Unknown character in reference field";
-static char __pyx_k_82[] = "V33_BAD_REF:Reference should be single-character in v3.3 VCF";
-static char __pyx_k_83[] = "V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF";
-static char __pyx_k_84[] = "POS_NOT_POSITIVE:Position field must be >0";
-static char __pyx_k_85[] = "QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'";
-static char __pyx_k_86[] = "ERROR_INFO_STRING:Error while parsing info field";
-static char __pyx_k_87[] = "ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)";
-static char __pyx_k_88[] = "ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s";
-static char __pyx_k_89[] = "ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string";
-static char __pyx_k_90[] = "FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header";
-static char __pyx_k_91[] = "FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header";
-static char __pyx_k_92[] = "BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)";
-static char __pyx_k_93[] = "BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)";
-static char __pyx_k_94[] = "BAD_GENOTYPE:Cannot parse genotype (%s)";
-static char __pyx_k_95[] = "V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)";
-static char __pyx_k_96[] = "MISSING_REF:Reference allele missing";
-static char __pyx_k_97[] = "V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)";
-static char __pyx_k_98[] = "V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets";
-static char __pyx_k_99[] = "FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes";
+static char __pyx_k_4[] = ":";
+static char __pyx_k_6[] = "-";
+static char __pyx_k_8[] = "Don't understand region string '%s'";
+static char __pyx_k_9[] = ".";
+static char __pyx_k_11[] = ";";
+static char __pyx_k_14[] = "=";
+static char __pyx_k_18[] = "BAD_NUMBER_OF_VALUES";
+static char __pyx_k_19[] = "(found %s values in element %s; expected %s)";
+static char __pyx_k_20[] = "BAD_NUMBER_OF_PARAMETERS";
+static char __pyx_k_21[] = "id=%s, expected %s parameters, got %s";
+static char __pyx_k_25[] = "Line %s: '%s'\n%s %s: %s\n";
+static char __pyx_k_27[] = "<";
+static char __pyx_k_29[] = "V40_MISSING_ANGLE_BRACKETS";
+static char __pyx_k_30[] = ">";
+static char __pyx_k_34[] = "\"";
+static char __pyx_k_38[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS";
+static char __pyx_k_39[] = "BADLY_FORMATTED_FORMAT_STRING";
+static char __pyx_k_40[] = "ID=";
+static char __pyx_k_41[] = "Number=";
+static char __pyx_k_42[] = "Type=";
+static char __pyx_k_43[] = "Description=";
+static char __pyx_k_52[] = "FORMAT_MISSING_QUOTES";
+static char __pyx_k_55[] = "<none>";
+static char __pyx_k_56[] = "#alleles";
+static char __pyx_k_57[] = "#nonref_alleles";
+static char __pyx_k_58[] = "#genotypes";
+static char __pyx_k_59[] = "#phased_genotypes";
+static char __pyx_k_61[] = "Unknown number type encountered: %s";
+static char __pyx_k_62[] = "%s=%s";
+static char __pyx_k_63[] = "(Undefined tag)";
+static char __pyx_k_66[] = "(output)";
+static char __pyx_k_69[] = "Genotype Quality";
+static char __pyx_k_70[] = "Read depth at this position for this sample";
+static char __pyx_k_71[] = "Haplotype Quality";
+static char __pyx_k_72[] = "Sample Genotype Filter";
+static char __pyx_k_73[] = "##";
+static char __pyx_k_76[] = "VCFv3.3";
+static char __pyx_k_77[] = "VCFv4.0";
+static char __pyx_k_78[] = "VCFv4.1";
+static char __pyx_k_79[] = "UNKNOWN_FORMAT_STRING";
+static char __pyx_k_80[] = "##fileformat=VCFv%s.%s\n";
+static char __pyx_k_81[] = "##%s=%s\n";
+static char __pyx_k_82[] = "#";
+static char __pyx_k_85[] = "\t";
+static char __pyx_k_87[] = "HEADING_NOT_SEPARATED_BY_TABS";
+static char __pyx_k_88[] = "(%sth entry not found)";
+static char __pyx_k_89[] = "(found %s, expected %s)";
+static char __pyx_k_90[] = "BADLY_FORMATTED_HEADING";
+static char __pyx_k_91[] = "\n";
+static char __pyx_k_92[] = "|";
+static char __pyx_k_93[] = "ERROR_FLAG_HAS_VALUE";
+static char __pyx_k_97[] = "ERROR_FORMAT_NOT_NUMERICAL";
+static char __pyx_k_98[] = "ERROR_FORMAT_NOT_CHAR";
 static char __pyx_k__0[] = "0";
 static char __pyx_k__D[] = "D";
 static char __pyx_k__I[] = "I";
 static char __pyx_k__N[] = "N";
-static char __pyx_k_100[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields";
-static char __pyx_k_101[] = "HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs";
-static char __pyx_k_102[] = "WRONG_REF:Wrong reference %s";
-static char __pyx_k_103[] = "ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data";
-static char __pyx_k_104[] = "BAD_CHR_TAG:Error calculating chr tag for %s";
-static char __pyx_k_105[] = "ZERO_LENGTH_ALLELE:Found zero-length allele";
-static char __pyx_k_106[] = "MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base";
-static char __pyx_k_107[] = "VCF.getsamples (line 880)";
-static char __pyx_k_108[] = "VCF.setsamples (line 884)";
-static char __pyx_k_109[] = "VCF.getheader (line 888)";
-static char __pyx_k_110[] = "VCF.setheader (line 892)";
-static char __pyx_k_111[] = "VCF.getinfo (line 896)";
-static char __pyx_k_112[] = "VCF.setinfo (line 900)";
-static char __pyx_k_113[] = "VCF.getformat (line 904)";
-static char __pyx_k_114[] = "VCF.setformat (line 908)";
-static char __pyx_k_115[] = "VCF.getfilter (line 912)";
-static char __pyx_k_116[] = "VCF.setfilter (line 916)";
-static char __pyx_k_117[] = "VCF.setreference (line 927)";
-static char __pyx_k_118[] = "VCF.parse (line 939)";
-static char __pyx_k_119[] = "VCF.write (line 946)";
-static char __pyx_k_120[] = "VCF.writeheader (line 952)";
-static char __pyx_k_121[] = "VCF.compare_calls (line 957)";
-static char __pyx_k_122[] = "VCF.connect (line 979)";
-static char __pyx_k_123[] = "VCF.fetch (line 984)";
-static char __pyx_k_124[] = "VCF.validate (line 993)";
+static char __pyx_k_101[] = "BAD_NUMBER_OF_COLUMNS";
+static char __pyx_k_102[] = "expected %s for %s samples (%s), got %s";
+static char __pyx_k_103[] = "(reference is %s, VCF says %s)";
+static char __pyx_k_111[] = "V33_UNMATCHED_DELETION";
+static char __pyx_k_112[] = "(deletion is %s, reference is %s)";
+static char __pyx_k_113[] = "MISSING_INDEL_ALLELE_REF_BASE";
+static char __pyx_k_115[] = "Required key %s not found in data";
+static char __pyx_k_118[] = "enter_default_format";
+static char __pyx_k_119[] = "Can only handle v3.3 and v4.0 VCF files";
+static char __pyx_k_121[] = "Invalid error string: %s";
+static char __pyx_k_122[] = "needs to be checked";
+static char __pyx_k_126[] = "[|/\\\\]";
+static char __pyx_k_128[] = "^[ACGTN]+$";
+static char __pyx_k_130[] = "id numbertype number type description missingvalue";
+static char __pyx_k_132[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier";
+static char __pyx_k_133[] = "BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string";
+static char __pyx_k_134[] = "BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s";
+static char __pyx_k_135[] = "BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)";
+static char __pyx_k_136[] = "POS_NOT_NUMERICAL:Position column is not numerical";
+static char __pyx_k_137[] = "UNKNOWN_CHAR_IN_REF:Unknown character in reference field";
+static char __pyx_k_138[] = "V33_BAD_REF:Reference should be single-character in v3.3 VCF";
+static char __pyx_k_139[] = "V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF";
+static char __pyx_k_140[] = "POS_NOT_POSITIVE:Position field must be >0";
+static char __pyx_k_141[] = "QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'";
+static char __pyx_k_142[] = "ERROR_INFO_STRING:Error while parsing info field";
+static char __pyx_k_143[] = "ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)";
+static char __pyx_k_144[] = "ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s";
+static char __pyx_k_145[] = "ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string";
+static char __pyx_k_146[] = "FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header";
+static char __pyx_k_147[] = "FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header";
+static char __pyx_k_148[] = "BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)";
+static char __pyx_k_149[] = "BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)";
+static char __pyx_k_150[] = "BAD_GENOTYPE:Cannot parse genotype (%s)";
+static char __pyx_k_151[] = "V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)";
+static char __pyx_k_152[] = "MISSING_REF:Reference allele missing";
+static char __pyx_k_153[] = "V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)";
+static char __pyx_k_154[] = "V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets";
+static char __pyx_k_155[] = "FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes";
+static char __pyx_k_156[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields";
+static char __pyx_k_157[] = "HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs";
+static char __pyx_k_158[] = "WRONG_REF:Wrong reference %s";
+static char __pyx_k_159[] = "ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data";
+static char __pyx_k_160[] = "BAD_CHR_TAG:Error calculating chr tag for %s";
+static char __pyx_k_161[] = "ZERO_LENGTH_ALLELE:Found zero-length allele";
+static char __pyx_k_162[] = "MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base";
 static char __pyx_k__DP[] = "DP";
 static char __pyx_k__FT[] = "FT";
 static char __pyx_k__GQ[] = "GQ";
@@ -1063,6 +1090,7 @@ static char __pyx_k__Type[] = "Type";
 static char __pyx_k__alt1[] = "alt1";
 static char __pyx_k__alt2[] = "alt2";
 static char __pyx_k__copy[] = "copy";
+static char __pyx_k__cvcf[] = "cvcf";
 static char __pyx_k__data[] = "data";
 static char __pyx_k__find[] = "find";
 static char __pyx_k__info[] = "info";
@@ -1105,6 +1133,7 @@ static char __pyx_k__Number[] = "Number";
 static char __pyx_k__String[] = "String";
 static char __pyx_k___lines[] = "_lines";
 static char __pyx_k___parse[] = "_parse";
+static char __pyx_k__append[] = "append";
 static char __pyx_k__bisect[] = "bisect";
 static char __pyx_k__buffer[] = "buffer";
 static char __pyx_k__contig[] = "contig";
@@ -1222,6 +1251,7 @@ static char __pyx_k__convertGTback[] = "convertGTback";
 static char __pyx_k__datagenerator[] = "datagenerator";
 static char __pyx_k__format_format[] = "format_format";
 static char __pyx_k__parse_heading[] = "parse_heading";
+static char __pyx_k__parse_regions[] = "parse_regions";
 static char __pyx_k__write_heading[] = "write_heading";
 static char __pyx_k__V33_BAD_ALLELE[] = "V33_BAD_ALLELE";
 static char __pyx_k__V40_BAD_ALLELE[] = "V40_BAD_ALLELE";
@@ -1243,124 +1273,107 @@ static char __pyx_k__NT_PHASED_GENOTYPES[] = "NT_PHASED_GENOTYPES";
 static char __pyx_k__NotImplementedError[] = "NotImplementedError";
 static char __pyx_k__UNKNOWN_CHAR_IN_REF[] = "UNKNOWN_CHAR_IN_REF";
 static PyObject *__pyx_kp_s_1;
-static PyObject *__pyx_kp_s_10;
-static PyObject *__pyx_kp_s_100;
-static PyObject *__pyx_kp_s_101;
+static PyObject *__pyx_n_s_101;
 static PyObject *__pyx_kp_s_102;
 static PyObject *__pyx_kp_s_103;
-static PyObject *__pyx_kp_s_104;
-static PyObject *__pyx_kp_s_105;
-static PyObject *__pyx_kp_s_106;
-static PyObject *__pyx_kp_u_107;
-static PyObject *__pyx_kp_u_108;
-static PyObject *__pyx_kp_u_109;
-static PyObject *__pyx_n_s_11;
-static PyObject *__pyx_kp_u_110;
-static PyObject *__pyx_kp_u_111;
-static PyObject *__pyx_kp_u_112;
-static PyObject *__pyx_kp_u_113;
-static PyObject *__pyx_kp_u_114;
-static PyObject *__pyx_kp_u_115;
-static PyObject *__pyx_kp_u_116;
-static PyObject *__pyx_kp_u_117;
-static PyObject *__pyx_kp_u_118;
-static PyObject *__pyx_kp_u_119;
-static PyObject *__pyx_kp_s_12;
-static PyObject *__pyx_kp_u_120;
-static PyObject *__pyx_kp_u_121;
-static PyObject *__pyx_kp_u_122;
-static PyObject *__pyx_kp_u_123;
-static PyObject *__pyx_kp_u_124;
+static PyObject *__pyx_kp_s_11;
+static PyObject *__pyx_n_s_111;
+static PyObject *__pyx_kp_s_112;
+static PyObject *__pyx_n_s_113;
+static PyObject *__pyx_kp_s_115;
+static PyObject *__pyx_n_s_118;
+static PyObject *__pyx_kp_s_119;
+static PyObject *__pyx_kp_s_121;
+static PyObject *__pyx_kp_s_122;
+static PyObject *__pyx_kp_s_126;
+static PyObject *__pyx_kp_s_128;
+static PyObject *__pyx_kp_s_130;
+static PyObject *__pyx_kp_s_132;
+static PyObject *__pyx_kp_s_133;
+static PyObject *__pyx_kp_s_134;
+static PyObject *__pyx_kp_s_135;
+static PyObject *__pyx_kp_s_136;
+static PyObject *__pyx_kp_s_137;
+static PyObject *__pyx_kp_s_138;
+static PyObject *__pyx_kp_s_139;
 static PyObject *__pyx_kp_s_14;
-static PyObject *__pyx_kp_s_16;
-static PyObject *__pyx_n_s_17;
-static PyObject *__pyx_kp_s_18;
+static PyObject *__pyx_kp_s_140;
+static PyObject *__pyx_kp_s_141;
+static PyObject *__pyx_kp_s_142;
+static PyObject *__pyx_kp_s_143;
+static PyObject *__pyx_kp_s_144;
+static PyObject *__pyx_kp_s_145;
+static PyObject *__pyx_kp_s_146;
+static PyObject *__pyx_kp_s_147;
+static PyObject *__pyx_kp_s_148;
+static PyObject *__pyx_kp_s_149;
+static PyObject *__pyx_kp_s_150;
+static PyObject *__pyx_kp_s_151;
+static PyObject *__pyx_kp_s_152;
+static PyObject *__pyx_kp_s_153;
+static PyObject *__pyx_kp_s_154;
+static PyObject *__pyx_kp_s_155;
+static PyObject *__pyx_kp_s_156;
+static PyObject *__pyx_kp_s_157;
+static PyObject *__pyx_kp_s_158;
+static PyObject *__pyx_kp_s_159;
+static PyObject *__pyx_kp_s_160;
+static PyObject *__pyx_kp_s_161;
+static PyObject *__pyx_kp_s_162;
+static PyObject *__pyx_n_s_18;
 static PyObject *__pyx_kp_s_19;
 static PyObject *__pyx_kp_s_2;
 static PyObject *__pyx_n_s_20;
-static PyObject *__pyx_n_s_21;
-static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_24;
+static PyObject *__pyx_kp_s_21;
 static PyObject *__pyx_kp_s_25;
-static PyObject *__pyx_n_s_26;
 static PyObject *__pyx_kp_s_27;
-static PyObject *__pyx_kp_s_28;
-static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_s_3;
+static PyObject *__pyx_n_s_29;
 static PyObject *__pyx_kp_s_30;
-static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_33;
 static PyObject *__pyx_kp_s_34;
-static PyObject *__pyx_kp_s_35;
-static PyObject *__pyx_kp_s_38;
-static PyObject *__pyx_kp_s_39;
+static PyObject *__pyx_n_s_38;
+static PyObject *__pyx_n_s_39;
 static PyObject *__pyx_kp_s_4;
 static PyObject *__pyx_kp_s_40;
 static PyObject *__pyx_kp_s_41;
 static PyObject *__pyx_kp_s_42;
 static PyObject *__pyx_kp_s_43;
-static PyObject *__pyx_kp_s_44;
-static PyObject *__pyx_kp_s_45;
-static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_n_s_47;
-static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_49;
-static PyObject *__pyx_kp_s_5;
-static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_51;
 static PyObject *__pyx_n_s_52;
-static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_kp_s_54;
-static PyObject *__pyx_n_s_55;
+static PyObject *__pyx_kp_s_55;
 static PyObject *__pyx_kp_s_56;
 static PyObject *__pyx_kp_s_57;
-static PyObject *__pyx_n_s_58;
-static PyObject *__pyx_n_s_59;
-static PyObject *__pyx_kp_b_6;
+static PyObject *__pyx_kp_s_58;
+static PyObject *__pyx_kp_s_59;
 static PyObject *__pyx_kp_s_6;
-static PyObject *__pyx_n_s_60;
-static PyObject *__pyx_n_s_62;
+static PyObject *__pyx_kp_s_61;
+static PyObject *__pyx_kp_s_62;
 static PyObject *__pyx_kp_s_63;
-static PyObject *__pyx_kp_s_64;
-static PyObject *__pyx_n_s_65;
 static PyObject *__pyx_kp_s_66;
-static PyObject *__pyx_n_s_67;
-static PyObject *__pyx_kp_s_68;
-static PyObject *__pyx_n_s_69;
-static PyObject *__pyx_kp_s_7;
+static PyObject *__pyx_kp_s_69;
 static PyObject *__pyx_kp_s_70;
 static PyObject *__pyx_kp_s_71;
 static PyObject *__pyx_kp_s_72;
 static PyObject *__pyx_kp_s_73;
-static PyObject *__pyx_kp_s_74;
-static PyObject *__pyx_kp_s_75;
 static PyObject *__pyx_kp_s_76;
 static PyObject *__pyx_kp_s_77;
 static PyObject *__pyx_kp_s_78;
-static PyObject *__pyx_kp_s_79;
+static PyObject *__pyx_n_s_79;
 static PyObject *__pyx_kp_s_8;
 static PyObject *__pyx_kp_s_80;
 static PyObject *__pyx_kp_s_81;
 static PyObject *__pyx_kp_s_82;
-static PyObject *__pyx_kp_s_83;
-static PyObject *__pyx_kp_s_84;
 static PyObject *__pyx_kp_s_85;
-static PyObject *__pyx_kp_s_86;
-static PyObject *__pyx_kp_s_87;
+static PyObject *__pyx_n_s_87;
 static PyObject *__pyx_kp_s_88;
 static PyObject *__pyx_kp_s_89;
-static PyObject *__pyx_n_s_9;
-static PyObject *__pyx_kp_s_90;
+static PyObject *__pyx_kp_b_9;
+static PyObject *__pyx_kp_s_9;
+static PyObject *__pyx_n_s_90;
 static PyObject *__pyx_kp_s_91;
 static PyObject *__pyx_kp_s_92;
-static PyObject *__pyx_kp_s_93;
-static PyObject *__pyx_kp_s_94;
-static PyObject *__pyx_kp_s_95;
-static PyObject *__pyx_kp_s_96;
-static PyObject *__pyx_kp_s_97;
-static PyObject *__pyx_kp_s_98;
-static PyObject *__pyx_kp_s_99;
+static PyObject *__pyx_n_s_93;
+static PyObject *__pyx_n_s_97;
+static PyObject *__pyx_n_s_98;
+static PyObject *__pyx_kp_b__0;
 static PyObject *__pyx_kp_s__0;
 static PyObject *__pyx_n_s__ACGTN;
 static PyObject *__pyx_n_s__ALT;
@@ -1402,6 +1415,7 @@ static PyObject *__pyx_n_s__NT_PHASED_GENOTYPES;
 static PyObject *__pyx_n_s__NT_UNKNOWN;
 static PyObject *__pyx_n_s__NotImplementedError;
 static PyObject *__pyx_n_s__Number;
+static PyObject *__pyx_n_b__PASS;
 static PyObject *__pyx_n_s__PASS;
 static PyObject *__pyx_n_s__POS;
 static PyObject *__pyx_n_s__POS_NOT_NUMERICAL;
@@ -1454,6 +1468,7 @@ static PyObject *__pyx_n_s__alleleRegEx;
 static PyObject *__pyx_n_s__alt;
 static PyObject *__pyx_n_s__alt1;
 static PyObject *__pyx_n_s__alt2;
+static PyObject *__pyx_n_s__append;
 static PyObject *__pyx_n_s__bisect;
 static PyObject *__pyx_n_s__buffer;
 static PyObject *__pyx_n_s__chrom;
@@ -1465,6 +1480,7 @@ static PyObject *__pyx_n_s__contig;
 static PyObject *__pyx_n_s__convertGT;
 static PyObject *__pyx_n_s__convertGTback;
 static PyObject *__pyx_n_s__copy;
+static PyObject *__pyx_n_s__cvcf;
 static PyObject *__pyx_n_s__data;
 static PyObject *__pyx_n_s__datagenerator;
 static PyObject *__pyx_n_s__deepcopy;
@@ -1531,6 +1547,7 @@ static PyObject *__pyx_n_s__parse_format;
 static PyObject *__pyx_n_s__parse_formatdata;
 static PyObject *__pyx_n_s__parse_header;
 static PyObject *__pyx_n_s__parse_heading;
+static PyObject *__pyx_n_s__parse_regions;
 static PyObject *__pyx_n_s__parser;
 static PyObject *__pyx_n_s__pos;
 static PyObject *__pyx_n_s__pos1;
@@ -1616,14 +1633,70 @@ static PyObject *__pyx_int_33;
 static PyObject *__pyx_int_40;
 static PyObject *__pyx_int_100;
 static PyObject *__pyx_int_3000000000;
-static PyObject *__pyx_k_13;
-static PyObject *__pyx_k_15;
-static PyObject *__pyx_k_32;
-static PyObject *__pyx_k_36;
-static PyObject *__pyx_k_37;
-static PyObject *__pyx_k_61;
-
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":58
+static PyObject *__pyx_k_22;
+static PyObject *__pyx_k_26;
+static PyObject *__pyx_k_60;
+static PyObject *__pyx_k_64;
+static PyObject *__pyx_k_65;
+static PyObject *__pyx_k_99;
+static PyObject *__pyx_k_tuple_3;
+static PyObject *__pyx_k_tuple_5;
+static PyObject *__pyx_k_tuple_7;
+static PyObject *__pyx_k_tuple_10;
+static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_16;
+static PyObject *__pyx_k_tuple_17;
+static PyObject *__pyx_k_tuple_23;
+static PyObject *__pyx_k_tuple_24;
+static PyObject *__pyx_k_tuple_28;
+static PyObject *__pyx_k_tuple_31;
+static PyObject *__pyx_k_tuple_32;
+static PyObject *__pyx_k_tuple_33;
+static PyObject *__pyx_k_tuple_35;
+static PyObject *__pyx_k_tuple_36;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_44;
+static PyObject *__pyx_k_tuple_45;
+static PyObject *__pyx_k_tuple_46;
+static PyObject *__pyx_k_tuple_47;
+static PyObject *__pyx_k_tuple_48;
+static PyObject *__pyx_k_tuple_49;
+static PyObject *__pyx_k_tuple_50;
+static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_53;
+static PyObject *__pyx_k_tuple_54;
+static PyObject *__pyx_k_tuple_67;
+static PyObject *__pyx_k_tuple_68;
+static PyObject *__pyx_k_tuple_74;
+static PyObject *__pyx_k_tuple_75;
+static PyObject *__pyx_k_tuple_83;
+static PyObject *__pyx_k_tuple_84;
+static PyObject *__pyx_k_tuple_86;
+static PyObject *__pyx_k_tuple_94;
+static PyObject *__pyx_k_tuple_95;
+static PyObject *__pyx_k_tuple_96;
+static PyObject *__pyx_k_tuple_100;
+static PyObject *__pyx_k_tuple_104;
+static PyObject *__pyx_k_tuple_105;
+static PyObject *__pyx_k_tuple_106;
+static PyObject *__pyx_k_tuple_107;
+static PyObject *__pyx_k_tuple_108;
+static PyObject *__pyx_k_tuple_109;
+static PyObject *__pyx_k_tuple_110;
+static PyObject *__pyx_k_tuple_114;
+static PyObject *__pyx_k_tuple_116;
+static PyObject *__pyx_k_tuple_117;
+static PyObject *__pyx_k_tuple_120;
+static PyObject *__pyx_k_tuple_123;
+static PyObject *__pyx_k_tuple_124;
+static PyObject *__pyx_k_tuple_125;
+static PyObject *__pyx_k_tuple_127;
+static PyObject *__pyx_k_tuple_129;
+static PyObject *__pyx_k_tuple_131;
+
+/* "cvcf.pyx":58
  * 
  * # Utility function.  Uses 0-based coordinates
  * def get_sequence(chrom, start, end, fa):             # <<<<<<<<<<<<<<
@@ -1632,6 +1705,7 @@ static PyObject *__pyx_k_61;
  */
 
 static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_get_sequence = {__Pyx_NAMESTR("get_sequence"), (PyCFunction)__pyx_pf_4cvcf_get_sequence, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
 static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_chrom = 0;
   PyObject *__pyx_v_start = 0;
@@ -1709,7 +1783,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_sequence = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":60
+  /* "cvcf.pyx":60
  * def get_sequence(chrom, start, end, fa):
  *     # obtain sequence from .fa file, without truncation
  *     if end<=start: return ""             # <<<<<<<<<<<<<<
@@ -1729,7 +1803,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":61
+  /* "cvcf.pyx":61
  *     # obtain sequence from .fa file, without truncation
  *     if end<=start: return ""
  *     if not fa: return "N"*(end-start)             # <<<<<<<<<<<<<<
@@ -1752,7 +1826,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":62
+  /* "cvcf.pyx":62
  *     if end<=start: return ""
  *     if not fa: return "N"*(end-start)
  *     if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper()             # <<<<<<<<<<<<<<
@@ -1773,7 +1847,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
     __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_INCREF(__pyx_v_chrom);
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chrom);
     __Pyx_GIVEREF(__pyx_v_chrom);
@@ -1786,10 +1860,10 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
     __Pyx_INCREF(__pyx_v_fa);
     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_fa);
     __Pyx_GIVEREF(__pyx_v_fa);
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__upper); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -1807,7 +1881,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":63
+  /* "cvcf.pyx":63
  *     if not fa: return "N"*(end-start)
  *     if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper()
  *     sequence = fa.fetch(chrom, start, end).upper()             # <<<<<<<<<<<<<<
@@ -1817,7 +1891,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   __pyx_t_5 = PyObject_GetAttr(__pyx_v_fa, __pyx_n_s__fetch); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   __Pyx_INCREF(__pyx_v_chrom);
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_chrom);
   __Pyx_GIVEREF(__pyx_v_chrom);
@@ -1827,10 +1901,10 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   __Pyx_INCREF(__pyx_v_end);
   PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_end);
   __Pyx_GIVEREF(__pyx_v_end);
-  __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__upper); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -1841,7 +1915,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   __pyx_v_sequence = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":64
+  /* "cvcf.pyx":64
  *     if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper()
  *     sequence = fa.fetch(chrom, start, end).upper()
  *     if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))             # <<<<<<<<<<<<<<
@@ -1882,7 +1956,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":65
+  /* "cvcf.pyx":65
  *     sequence = fa.fetch(chrom, start, end).upper()
  *     if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))
  *     return sequence             # <<<<<<<<<<<<<<
@@ -1910,7 +1984,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":68
+/* "cvcf.pyx":68
  * 
  * # Utility function.  Parses a region string
  * def parse_regions( string ):             # <<<<<<<<<<<<<<
@@ -1918,8 +1992,9 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__p
  *     for r in string.split(','):
  */
 
-static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string); /*proto*/
-static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string) {
+static PyObject *__pyx_pf_4cvcf_1parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_1parse_regions = {__Pyx_NAMESTR("parse_regions"), (PyCFunction)__pyx_pf_4cvcf_1parse_regions, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_1parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string) {
   PyObject *__pyx_v_result;
   PyObject *__pyx_v_r;
   PyObject *__pyx_v_elts;
@@ -1940,7 +2015,7 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
   int __pyx_t_10;
   __Pyx_RefNannySetupContext("parse_regions");
   __pyx_self = __pyx_self;
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_r = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_chrom = Py_None; __Pyx_INCREF(Py_None);
@@ -1948,7 +2023,7 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
   __pyx_v_end = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_ielts = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":69
+  /* "cvcf.pyx":69
  * # Utility function.  Parses a region string
  * def parse_regions( string ):
  *     result = []             # <<<<<<<<<<<<<<
@@ -1961,7 +2036,7 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
   __pyx_v_result = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":70
+  /* "cvcf.pyx":70
  * def parse_regions( string ):
  *     result = []
  *     for r in string.split(','):             # <<<<<<<<<<<<<<
@@ -1970,87 +2045,75 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_string, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
-    __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3);
+  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+    __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1);
   } else {
-    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
   }
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_3))) {
-      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+    if (likely(PyList_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
     } else {
-      __pyx_t_4 = PyIter_Next(__pyx_t_3);
-      if (!__pyx_t_4) {
+      __pyx_t_3 = PyIter_Next(__pyx_t_1);
+      if (!__pyx_t_3) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_GOTREF(__pyx_t_3);
     }
     __Pyx_DECREF(__pyx_v_r);
-    __pyx_v_r = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_r = __pyx_t_3;
+    __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":71
+    /* "cvcf.pyx":71
  *     result = []
  *     for r in string.split(','):
  *         elts = r.split(':')             # <<<<<<<<<<<<<<
  *         chrom, start, end = elts[0], 0, 3000000000
  *         if len(elts)==1: pass
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_elts);
-    __pyx_v_elts = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_v_elts = __pyx_t_4;
+    __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":72
+    /* "cvcf.pyx":72
  *     for r in string.split(','):
  *         elts = r.split(':')
  *         chrom, start, end = elts[0], 0, 3000000000             # <<<<<<<<<<<<<<
  *         if len(elts)==1: pass
  *         elif len(elts)==2:
  */
-    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = __pyx_int_0;
-    __Pyx_INCREF(__pyx_t_1);
-    __pyx_t_4 = __pyx_int_3000000000;
-    __Pyx_INCREF(__pyx_t_4);
+    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = __pyx_int_0;
+    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_5 = __pyx_int_3000000000;
+    __Pyx_INCREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_v_chrom);
-    __pyx_v_chrom = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_v_chrom = __pyx_t_4;
+    __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_v_start);
-    __pyx_v_start = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __pyx_v_start = __pyx_t_3;
+    __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_end);
-    __pyx_v_end = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_end = __pyx_t_5;
+    __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":73
+    /* "cvcf.pyx":73
  *         elts = r.split(':')
  *         chrom, start, end = elts[0], 0, 3000000000
  *         if len(elts)==1: pass             # <<<<<<<<<<<<<<
@@ -2063,7 +2126,7 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":74
+    /* "cvcf.pyx":74
  *         chrom, start, end = elts[0], 0, 3000000000
  *         if len(elts)==1: pass
  *         elif len(elts)==2:             # <<<<<<<<<<<<<<
@@ -2074,46 +2137,40 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
     __pyx_t_7 = (__pyx_t_6 == 2);
     if (__pyx_t_7) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":75
+      /* "cvcf.pyx":75
  *         if len(elts)==1: pass
  *         elif len(elts)==2:
  *             if len(elts[1])>0:             # <<<<<<<<<<<<<<
  *                 ielts = elts[1].split('-')
  *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
  */
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_7 = (__pyx_t_6 > 0);
       if (__pyx_t_7) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":76
+        /* "cvcf.pyx":76
  *         elif len(elts)==2:
  *             if len(elts[1])>0:
  *                 ielts = elts[1].split('-')             # <<<<<<<<<<<<<<
  *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
  *                 try:    start, end = int(ielts[0])-1, int(ielts[1])
  */
-        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
-        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_4));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
-        __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __Pyx_DECREF(__pyx_v_ielts);
         __pyx_v_ielts = __pyx_t_5;
         __pyx_t_5 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":77
+        /* "cvcf.pyx":77
  *             if len(elts[1])>0:
  *                 ielts = elts[1].split('-')
  *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)             # <<<<<<<<<<<<<<
@@ -2123,22 +2180,22 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
         __pyx_t_6 = PyObject_Length(__pyx_v_ielts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_7 = (__pyx_t_6 != 2);
         if (__pyx_t_7) {
-          __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_r); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_v_r); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_4);
-          PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
+          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
           __pyx_t_5 = 0;
-          __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
           goto __pyx_L9;
         }
         __pyx_L9:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":78
+        /* "cvcf.pyx":78
  *                 ielts = elts[1].split('-')
  *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
  *                 try:    start, end = int(ielts[0])-1, int(ielts[1])             # <<<<<<<<<<<<<<
@@ -2154,30 +2211,30 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
           /*try:*/ {
             __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ielts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_GOTREF(__pyx_t_5);
-            __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_4);
-            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+            __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+            PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
             __Pyx_GIVEREF(__pyx_t_5);
             __pyx_t_5 = 0;
-            __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_GOTREF(__pyx_t_5);
-            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-            __pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_4);
+            __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+            __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_GOTREF(__pyx_t_3);
             __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
             __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ielts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_GOTREF(__pyx_t_5);
-            __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_1);
-            PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
+            __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
             __Pyx_GIVEREF(__pyx_t_5);
             __pyx_t_5 = 0;
-            __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_GOTREF(__pyx_t_5);
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
             __Pyx_DECREF(__pyx_v_start);
-            __pyx_v_start = __pyx_t_4;
-            __pyx_t_4 = 0;
+            __pyx_v_start = __pyx_t_3;
+            __pyx_t_3 = 0;
             __Pyx_DECREF(__pyx_v_end);
             __pyx_v_end = __pyx_t_5;
             __pyx_t_5 = 0;
@@ -2187,11 +2244,11 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
           __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
           goto __pyx_L17_try_end;
           __pyx_L10_error:;
-          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":79
+          /* "cvcf.pyx":79
  *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
  *                 try:    start, end = int(ielts[0])-1, int(ielts[1])
  *                 except: raise ValueError("Don't understand region string '%s'" % r)             # <<<<<<<<<<<<<<
@@ -2200,26 +2257,26 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
  */
           /*except:*/ {
             __Pyx_AddTraceback("cvcf.parse_regions");
-            if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+            if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
             __Pyx_GOTREF(__pyx_t_5);
+            __Pyx_GOTREF(__pyx_t_3);
             __Pyx_GOTREF(__pyx_t_4);
-            __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_r); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+            __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_v_r); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_8));
             __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
-            __Pyx_GOTREF(__pyx_t_9);
+            __Pyx_GOTREF(((PyObject *)__pyx_t_9));
             PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
             __pyx_t_8 = 0;
-            __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+            __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
             __Pyx_GOTREF(__pyx_t_8);
-            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
             __Pyx_Raise(__pyx_t_8, 0, 0);
             __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
             __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             goto __pyx_L11_exception_handled;
           }
           __pyx_L12_except_error:;
@@ -2242,30 +2299,30 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":81
+      /* "cvcf.pyx":81
  *                 except: raise ValueError("Don't understand region string '%s'" % r)
  *         else:
  *             raise ValueError("Don't understand region string '%s'" % r)             # <<<<<<<<<<<<<<
  *         result.append( (chrom,start,end) )
  *     return result
  */
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_r); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_v_r); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":82
+    /* "cvcf.pyx":82
  *         else:
  *             raise ValueError("Don't understand region string '%s'" % r)
  *         result.append( (chrom,start,end) )             # <<<<<<<<<<<<<<
@@ -2275,23 +2332,23 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
     if (unlikely(__pyx_v_result == Py_None)) {
       PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_INCREF(__pyx_v_chrom);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom);
     __Pyx_GIVEREF(__pyx_v_chrom);
     __Pyx_INCREF(__pyx_v_start);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
+    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_start);
     __Pyx_GIVEREF(__pyx_v_start);
     __Pyx_INCREF(__pyx_v_end);
-    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
+    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_end);
     __Pyx_GIVEREF(__pyx_v_end);
-    __pyx_t_10 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_10 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   }
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":83
+  /* "cvcf.pyx":83
  *             raise ValueError("Don't understand region string '%s'" % r)
  *         result.append( (chrom,start,end) )
  *     return result             # <<<<<<<<<<<<<<
@@ -2327,7 +2384,7 @@ static PyObject *__pyx_pf_4cvcf_parse_regions(PyObject *__pyx_self, PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":104
+/* "cvcf.pyx":104
  *     cdef uint32_t pos
  * 
  *     def __init__(self, vcf):             # <<<<<<<<<<<<<<
@@ -2373,7 +2430,7 @@ static int __pyx_pf_4cvcf_9VCFRecord___init__(PyObject *__pyx_v_self, PyObject *
   return -1;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":105
+  /* "cvcf.pyx":105
  * 
  *     def __init__(self, vcf):
  *         self.vcf = vcf             # <<<<<<<<<<<<<<
@@ -2391,7 +2448,7 @@ static int __pyx_pf_4cvcf_9VCFRecord___init__(PyObject *__pyx_v_self, PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":115
+/* "cvcf.pyx":115
  *         #                     len(data)))
  * 
  *     def __cinit__(self, vcf ):             # <<<<<<<<<<<<<<
@@ -2399,8 +2456,8 @@ static int __pyx_pf_4cvcf_9VCFRecord___init__(PyObject *__pyx_v_self, PyObject *
  *         self.offset = 9
  */
 
-static int __pyx_pf_4cvcf_9VCFRecord___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_4cvcf_9VCFRecord___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pf_4cvcf_9VCFRecord_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_4cvcf_9VCFRecord_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcf = 0;
   int __pyx_r;
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
@@ -2437,7 +2494,7 @@ static int __pyx_pf_4cvcf_9VCFRecord___cinit__(PyObject *__pyx_v_self, PyObject
   return -1;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":117
+  /* "cvcf.pyx":117
  *     def __cinit__(self, vcf ):
  *         # start indexed access at genotypes
  *         self.offset = 9             # <<<<<<<<<<<<<<
@@ -2446,7 +2503,7 @@ static int __pyx_pf_4cvcf_9VCFRecord___cinit__(PyObject *__pyx_v_self, PyObject
  */
   ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.offset = 9;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":119
+  /* "cvcf.pyx":119
  *         self.offset = 9
  * 
  *         self.vcf = vcf             # <<<<<<<<<<<<<<
@@ -2464,7 +2521,7 @@ static int __pyx_pf_4cvcf_9VCFRecord___cinit__(PyObject *__pyx_v_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":121
+/* "cvcf.pyx":121
  *         self.vcf = vcf
  * 
  *     cdef update( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -2477,7 +2534,7 @@ static  PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFReco
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("update");
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":126
+  /* "cvcf.pyx":126
  *         nbytes does not include the terminal '\0'.
  *         '''
  *         TabProxies.TupleProxy.update( self, buffer, nbytes )             # <<<<<<<<<<<<<<
@@ -2488,7 +2545,7 @@ static  PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFReco
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":128
+  /* "cvcf.pyx":128
  *         TabProxies.TupleProxy.update( self, buffer, nbytes )
  * 
  *         self.contig = self.fields[0]             # <<<<<<<<<<<<<<
@@ -2497,7 +2554,7 @@ static  PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFReco
  */
   __pyx_v_self->contig = (__pyx_v_self->__pyx_base.fields[0]);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":130
+  /* "cvcf.pyx":130
  *         self.contig = self.fields[0]
  *         # vcf counts from 1 - correct here
  *         self.pos = atoi( self.fields[1] ) - 1             # <<<<<<<<<<<<<<
@@ -2518,7 +2575,7 @@ static  PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFReco
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":132
+/* "cvcf.pyx":132
  *         self.pos = atoi( self.fields[1] ) - 1
  * 
  *     def __len__(self):             # <<<<<<<<<<<<<<
@@ -2526,15 +2583,15 @@ static  PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFReco
  * 
  */
 
-static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord___len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord___len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_2__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_2__len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   long __pyx_t_1;
   long __pyx_t_2;
   long __pyx_t_3;
   __Pyx_RefNannySetupContext("__len__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":133
+  /* "cvcf.pyx":133
  * 
  *     def __len__(self):
  *         return max(0, self.nfields - 9)             # <<<<<<<<<<<<<<
@@ -2557,7 +2614,7 @@ static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord___len__(PyObject *__pyx_v_self) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":136
+/* "cvcf.pyx":136
  * 
  *     property contig:
  *         def __get__(self): return self.contig             # <<<<<<<<<<<<<<
@@ -2589,7 +2646,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":139
+/* "cvcf.pyx":139
  * 
  *     property pos:
  *         def __get__(self): return self.pos             # <<<<<<<<<<<<<<
@@ -2621,7 +2678,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":142
+/* "cvcf.pyx":142
  * 
  *     property id:
  *         def __get__(self): return self.fields[2]             # <<<<<<<<<<<<<<
@@ -2653,7 +2710,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(PyObject *__pyx_v_self) {
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":145
+/* "cvcf.pyx":145
  * 
  *     property ref:
  *         def __get__(self): return self.fields[3]             # <<<<<<<<<<<<<<
@@ -2685,7 +2742,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":148
+/* "cvcf.pyx":148
  * 
  *     property alt:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -2700,11 +2757,10 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self)
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
   __Pyx_RefNannySetupContext("__get__");
   __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":150
+  /* "cvcf.pyx":150
  *         def __get__(self):
  *             # convert v3.3 to v4.0 alleles below
  *             alt = self.fields[4]             # <<<<<<<<<<<<<<
@@ -2717,14 +2773,14 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self)
   __pyx_v_alt = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":151
+  /* "cvcf.pyx":151
  *             # convert v3.3 to v4.0 alleles below
  *             alt = self.fields[4]
  *             if alt == ".": alt = []             # <<<<<<<<<<<<<<
  *             else: alt = alt.upper().split(',')
  *             return alt
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -2738,7 +2794,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self)
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":152
+    /* "cvcf.pyx":152
  *             alt = self.fields[4]
  *             if alt == ".": alt = []
  *             else: alt = alt.upper().split(',')             # <<<<<<<<<<<<<<
@@ -2753,22 +2809,16 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self)
     __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_alt);
-    __pyx_v_alt = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_alt = __pyx_t_3;
+    __pyx_t_3 = 0;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":153
+  /* "cvcf.pyx":153
  *             if alt == ".": alt = []
  *             else: alt = alt.upper().split(',')
  *             return alt             # <<<<<<<<<<<<<<
@@ -2785,7 +2835,6 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self)
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("cvcf.VCFRecord.alt.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -2795,7 +2844,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":156
+/* "cvcf.pyx":156
  * 
  *     property qual:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -2819,7 +2868,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self)
   __Pyx_RefNannySetupContext("__get__");
   __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":157
+  /* "cvcf.pyx":157
  *     property qual:
  *         def __get__(self):
  *             qual = self.fields[5]             # <<<<<<<<<<<<<<
@@ -2832,14 +2881,14 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self)
   __pyx_v_qual = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":158
+  /* "cvcf.pyx":158
  *         def __get__(self):
  *             qual = self.fields[5]
  *             if qual == b".": qual = -1             # <<<<<<<<<<<<<<
  *             else:
  *                 try:    qual = float(qual)
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, ((PyObject *)__pyx_kp_b_6), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -2851,7 +2900,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self)
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":160
+    /* "cvcf.pyx":160
  *             if qual == b".": qual = -1
  *             else:
  *                 try:    qual = float(qual)             # <<<<<<<<<<<<<<
@@ -2879,7 +2928,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self)
       __pyx_L6_error:;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":161
+      /* "cvcf.pyx":161
  *             else:
  *                 try:    qual = float(qual)
  *                 except: self.vcf.error(str(self),self.QUAL_NOT_NUMERICAL)             # <<<<<<<<<<<<<<
@@ -2895,27 +2944,27 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self)
         __pyx_t_6 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__error); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_self);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
         __Pyx_GIVEREF(__pyx_v_self);
-        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__QUAL_NOT_NUMERICAL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
         PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
         __Pyx_GIVEREF(__pyx_t_8);
         PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_8 = 0;
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -2957,7 +3006,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":164
+/* "cvcf.pyx":164
  * 
  *     property filter:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -2969,16 +3018,15 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_sel
 static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_self) {
   char *__pyx_v_f;
   PyObject *__pyx_r = NULL;
-  int __pyx_t_1;
-  int __pyx_t_2;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
   int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
+  int __pyx_t_5;
+  int __pyx_t_6;
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":165
+  /* "cvcf.pyx":165
  *     property filter:
  *         def __get__(self):
  *             f = self.fields[6]             # <<<<<<<<<<<<<<
@@ -2987,38 +3035,56 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_sel
  */
   __pyx_v_f = (((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[6]);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":167
+  /* "cvcf.pyx":167
  *             f = self.fields[6]
  *             # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
  *             if f == b"." or f == b"PASS" or f == b"0": return []             # <<<<<<<<<<<<<<
  *             else: return f.split(';')
  * 
  */
-  __pyx_t_1 = (__pyx_v_f == __pyx_k_6);
-  if (!__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_f == __pyx_k__PASS);
-    if (!__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_f == __pyx_k__0);
-      __pyx_t_4 = __pyx_t_3;
+  __pyx_t_1 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (!__pyx_t_3) {
+    __pyx_t_2 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_b__PASS), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (!__pyx_t_4) {
+      __pyx_t_1 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b__0), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_6 = __pyx_t_5;
     } else {
-      __pyx_t_4 = __pyx_t_2;
+      __pyx_t_6 = __pyx_t_4;
     }
-    __pyx_t_2 = __pyx_t_4;
+    __pyx_t_4 = __pyx_t_6;
   } else {
-    __pyx_t_2 = __pyx_t_1;
+    __pyx_t_4 = __pyx_t_3;
   }
-  if (__pyx_t_2) {
+  if (__pyx_t_4) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_r = ((PyObject *)__pyx_t_5);
-    __pyx_t_5 = 0;
+    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_r = ((PyObject *)__pyx_t_2);
+    __pyx_t_2 = 0;
     goto __pyx_L0;
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":168
+    /* "cvcf.pyx":168
  *             # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
  *             if f == b"." or f == b"PASS" or f == b"0": return []
  *             else: return f.split(';')             # <<<<<<<<<<<<<<
@@ -3026,22 +3092,16 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_sel
  *     property info:
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_t_5), __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_7));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
-    __pyx_t_7 = PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_r = __pyx_t_7;
-    __pyx_t_7 = 0;
+    __pyx_t_2 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_r = __pyx_t_2;
+    __pyx_t_2 = 0;
     goto __pyx_L0;
   }
   __pyx_L5:;
@@ -3049,9 +3109,8 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_sel
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_AddTraceback("cvcf.VCFRecord.filter.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -3060,7 +3119,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":171
+/* "cvcf.pyx":171
  * 
  *     property info:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -3077,21 +3136,21 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self)
   PyObject *__pyx_v_v;
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
-  PyObject *__pyx_t_4 = 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;
-  Py_ssize_t __pyx_t_7;
+  Py_ssize_t __pyx_t_6;
+  PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
   __Pyx_RefNannySetupContext("__get__");
-  __pyx_v_info = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_info = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_blurp = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":172
+  /* "cvcf.pyx":172
  *     property info:
  *         def __get__(self):
  *             col = self.fields[7]             # <<<<<<<<<<<<<<
@@ -3100,7 +3159,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self)
  */
   __pyx_v_col = (((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[7]);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":174
+  /* "cvcf.pyx":174
  *             col = self.fields[7]
  *             # dictionary of keys, and list of values
  *             info = {}             # <<<<<<<<<<<<<<
@@ -3113,198 +3172,192 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self)
   __pyx_v_info = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":175
+  /* "cvcf.pyx":175
  *             # dictionary of keys, and list of values
  *             info = {}
  *             if col != b".":             # <<<<<<<<<<<<<<
  *                 for blurp in col.split(';'):
  *                     elts = blurp.split('=')
  */
-  __pyx_t_2 = (__pyx_v_col != __pyx_k_6);
-  if (__pyx_t_2) {
+  __pyx_t_1 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":176
+    /* "cvcf.pyx":176
  *             info = {}
  *             if col != b".":
  *                 for blurp in col.split(';'):             # <<<<<<<<<<<<<<
  *                     elts = blurp.split('=')
  *                     if len(elts) == 1: v = None
  */
-    __pyx_t_1 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_1), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_7));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
-      __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1);
+    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
+      __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1);
     } else {
-      __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     for (;;) {
       if (likely(PyList_CheckExact(__pyx_t_1))) {
-        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
-        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
-        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else {
-        __pyx_t_5 = PyIter_Next(__pyx_t_1);
-        if (!__pyx_t_5) {
+        __pyx_t_2 = PyIter_Next(__pyx_t_1);
+        if (!__pyx_t_2) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_GOTREF(__pyx_t_2);
       }
       __Pyx_DECREF(__pyx_v_blurp);
-      __pyx_v_blurp = __pyx_t_5;
-      __pyx_t_5 = 0;
+      __pyx_v_blurp = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":177
+      /* "cvcf.pyx":177
  *             if col != b".":
  *                 for blurp in col.split(';'):
  *                     elts = blurp.split('=')             # <<<<<<<<<<<<<<
  *                     if len(elts) == 1: v = None
  *                     elif len(elts) == 2: v = elts[1]
  */
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-      __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_v_elts);
-      __pyx_v_elts = __pyx_t_6;
-      __pyx_t_6 = 0;
+      __pyx_v_elts = __pyx_t_5;
+      __pyx_t_5 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":178
+      /* "cvcf.pyx":178
  *                 for blurp in col.split(';'):
  *                     elts = blurp.split('=')
  *                     if len(elts) == 1: v = None             # <<<<<<<<<<<<<<
  *                     elif len(elts) == 2: v = elts[1]
  *                     else: self.vcf.error(str(self),self.ERROR_INFO_STRING)
  */
-      __pyx_t_7 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_2 = (__pyx_t_7 == 1);
-      if (__pyx_t_2) {
+      __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = (__pyx_t_6 == 1);
+      if (__pyx_t_3) {
         __Pyx_INCREF(Py_None);
         __Pyx_DECREF(__pyx_v_v);
         __pyx_v_v = Py_None;
         goto __pyx_L8;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":179
+      /* "cvcf.pyx":179
  *                     elts = blurp.split('=')
  *                     if len(elts) == 1: v = None
  *                     elif len(elts) == 2: v = elts[1]             # <<<<<<<<<<<<<<
  *                     else: self.vcf.error(str(self),self.ERROR_INFO_STRING)
  *                     info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self))
  */
-      __pyx_t_7 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_2 = (__pyx_t_7 == 2);
-      if (__pyx_t_2) {
-        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = (__pyx_t_6 == 2);
+      if (__pyx_t_3) {
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_v_v);
-        __pyx_v_v = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_v_v = __pyx_t_5;
+        __pyx_t_5 = 0;
         goto __pyx_L8;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":180
+        /* "cvcf.pyx":180
  *                     if len(elts) == 1: v = None
  *                     elif len(elts) == 2: v = elts[1]
  *                     else: self.vcf.error(str(self),self.ERROR_INFO_STRING)             # <<<<<<<<<<<<<<
  *                     info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self))
  *             return info
  */
-        __pyx_t_6 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__error); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_self);
-        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
         __Pyx_GIVEREF(__pyx_v_self);
-        __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
-        __Pyx_GIVEREF(__pyx_t_5);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
-        __Pyx_GIVEREF(__pyx_t_4);
-        __pyx_t_5 = 0;
-        __pyx_t_4 = 0;
-        __pyx_t_4 = PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
+        __Pyx_GIVEREF(__pyx_t_7);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_t_7 = 0;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
       __pyx_L8:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":181
+      /* "cvcf.pyx":181
  *                     elif len(elts) == 2: v = elts[1]
  *                     else: self.vcf.error(str(self),self.ERROR_INFO_STRING)
  *                     info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self))             # <<<<<<<<<<<<<<
  *             return info
  * 
  */
-      __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_6 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_INCREF(__pyx_v_self);
-      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
+      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
       __Pyx_GIVEREF(__pyx_v_self);
-      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+      __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
       __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_v);
-      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_v);
+      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_v);
       __Pyx_GIVEREF(__pyx_v_v);
-      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
-      __Pyx_GIVEREF(__pyx_t_6);
-      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_5);
+      __Pyx_GIVEREF(__pyx_t_5);
+      PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_9);
       __Pyx_GIVEREF(__pyx_t_9);
       __pyx_t_8 = 0;
-      __pyx_t_6 = 0;
+      __pyx_t_5 = 0;
       __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      if (PyDict_SetItem(((PyObject *)__pyx_v_info), __pyx_t_5, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_info), __pyx_t_7, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -3312,7 +3365,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self)
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":182
+  /* "cvcf.pyx":182
  *                     else: self.vcf.error(str(self),self.ERROR_INFO_STRING)
  *                     info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self))
  *             return info             # <<<<<<<<<<<<<<
@@ -3328,9 +3381,9 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self)
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("cvcf.VCFRecord.info.__get__");
@@ -3345,7 +3398,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self)
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":185
+/* "cvcf.pyx":185
  * 
  *     property format:
  *          def __get__(self):             # <<<<<<<<<<<<<<
@@ -3358,10 +3411,9 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(PyObject *__pyx_v_sel
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":186
+  /* "cvcf.pyx":186
  *     property format:
  *          def __get__(self):
  *              return self.fields[8].split(':')             # <<<<<<<<<<<<<<
@@ -3374,17 +3426,11 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(PyObject *__pyx_v_sel
   __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_t_1), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -3392,7 +3438,6 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(PyObject *__pyx_v_sel
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("cvcf.VCFRecord.format.__get__");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -3401,7 +3446,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(PyObject *__pyx_v_sel
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":189
+/* "cvcf.pyx":189
  * 
  *     property samples:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -3415,7 +3460,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(PyObject *__pyx_v_se
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":190
+  /* "cvcf.pyx":190
  *     property samples:
  *         def __get__(self):
  *             return self.vcf._samples             # <<<<<<<<<<<<<<
@@ -3441,7 +3486,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(PyObject *__pyx_v_se
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":192
+/* "cvcf.pyx":192
  *             return self.vcf._samples
  * 
  *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
@@ -3449,8 +3494,8 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(PyObject *__pyx_v_se
  *         # parse sample columns
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
-static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+static PyObject *__pyx_pf_4cvcf_9VCFRecord_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static PyObject *__pyx_pf_4cvcf_9VCFRecord_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
   PyObject *__pyx_v_values;
   PyObject *__pyx_v_alt;
   PyObject *__pyx_v_format;
@@ -3462,9 +3507,9 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   Py_ssize_t __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
-  Py_ssize_t __pyx_t_5;
-  int __pyx_t_6;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
@@ -3475,11 +3520,11 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
   __pyx_v_values = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_format = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_expected = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":195
+  /* "cvcf.pyx":195
  * 
  *         # parse sample columns
  *         values = self.fields[self.vcf._sample2column[key]].split(':')             # <<<<<<<<<<<<<<
@@ -3498,46 +3543,40 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
   __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_values);
-  __pyx_v_values = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_v_values = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":196
+  /* "cvcf.pyx":196
  *         # parse sample columns
  *         values = self.fields[self.vcf._sample2column[key]].split(':')
  *         alt = self.alt             # <<<<<<<<<<<<<<
  *         format = self.format
  * 
  */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_alt);
-  __pyx_v_alt = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_v_alt = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":197
+  /* "cvcf.pyx":197
  *         values = self.fields[self.vcf._sample2column[key]].split(':')
  *         alt = self.alt
  *         format = self.format             # <<<<<<<<<<<<<<
  * 
  *         if len(values) > len(format):
  */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_format);
-  __pyx_v_format = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_v_format = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":199
+  /* "cvcf.pyx":199
  *         format = self.format
  * 
  *         if len(values) > len(format):             # <<<<<<<<<<<<<<
@@ -3545,47 +3584,47 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  *                            (len(values),key,len(format)))
  */
   __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_6 = (__pyx_t_3 > __pyx_t_5);
-  if (__pyx_t_6) {
+  __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = (__pyx_t_3 > __pyx_t_4);
+  if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":200
+    /* "cvcf.pyx":200
  * 
  *         if len(values) > len(format):
  *             self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\             # <<<<<<<<<<<<<<
  *                            (len(values),key,len(format)))
  * 
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__line); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":201
+    /* "cvcf.pyx":201
  *         if len(values) > len(format):
  *             self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\
  *                            (len(values),key,len(format)))             # <<<<<<<<<<<<<<
  * 
  *         result = {}
  */
-    __pyx_t_5 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_5 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
     __Pyx_INCREF(__pyx_v_key);
@@ -3595,30 +3634,30 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
     __Pyx_GIVEREF(__pyx_t_8);
     __pyx_t_7 = 0;
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-    __pyx_t_2 = 0;
     __pyx_t_1 = 0;
+    __pyx_t_6 = 0;
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":203
+  /* "cvcf.pyx":203
  *                            (len(values),key,len(format)))
  * 
  *         result = {}             # <<<<<<<<<<<<<<
@@ -3631,18 +3670,18 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
   __pyx_v_result = __pyx_t_8;
   __pyx_t_8 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":204
+  /* "cvcf.pyx":204
  * 
  *         result = {}
  *         for idx in range(len(format)):             # <<<<<<<<<<<<<<
  *             expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)
  *             if idx < len(values): value = values[idx]
  */
-  __pyx_t_5 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+  __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3+=1) {
     __pyx_v_idx = __pyx_t_3;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":205
+    /* "cvcf.pyx":205
  *         result = {}
  *         for idx in range(len(format)):
  *             expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)             # <<<<<<<<<<<<<<
@@ -3653,28 +3692,28 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
     __Pyx_GOTREF(__pyx_t_8);
     __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+    __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
     __Pyx_GIVEREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_v_alt);
-    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_alt);
+    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_alt);
     __Pyx_GIVEREF(__pyx_v_alt);
     __pyx_t_9 = 0;
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_v_expected);
-    __pyx_v_expected = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_expected = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":206
+    /* "cvcf.pyx":206
  *         for idx in range(len(format)):
  *             expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)
  *             if idx < len(values): value = values[idx]             # <<<<<<<<<<<<<<
@@ -3682,62 +3721,62 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  *                 if expected == -1: value = "."
  */
     __pyx_t_10 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = (__pyx_v_idx < __pyx_t_10);
-    if (__pyx_t_6) {
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = (__pyx_v_idx < __pyx_t_10);
+    if (__pyx_t_5) {
+      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_4;
-      __pyx_t_4 = 0;
+      __pyx_v_value = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L8;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":208
+      /* "cvcf.pyx":208
  *             if idx < len(values): value = values[idx]
  *             else:
  *                 if expected == -1: value = "."             # <<<<<<<<<<<<<<
  *                 else: value = ",".join(["."]*expected)
  * 
  */
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (__pyx_t_5) {
+        __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
         __Pyx_DECREF(__pyx_v_value);
-        __pyx_v_value = ((PyObject *)__pyx_kp_s_6);
+        __pyx_v_value = ((PyObject *)__pyx_kp_s_9);
         goto __pyx_L9;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":209
+        /* "cvcf.pyx":209
  *             else:
  *                 if expected == -1: value = "."
  *                 else: value = ",".join(["."]*expected)             # <<<<<<<<<<<<<<
  * 
  *             result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data))
  */
-        __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-        PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_6));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-        __pyx_t_8 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_v_expected); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+        __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+        PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_9));
+        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+        __pyx_t_8 = PyNumber_Multiply(((PyObject *)__pyx_t_6), __pyx_v_expected); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
         __Pyx_GIVEREF(__pyx_t_8);
         __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_v_value);
         __pyx_v_value = __pyx_t_8;
         __pyx_t_8 = 0;
@@ -3746,7 +3785,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":211
+    /* "cvcf.pyx":211
  *                 else: value = ",".join(["."]*expected)
  * 
  *             result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data))             # <<<<<<<<<<<<<<
@@ -3755,45 +3794,45 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  */
     __pyx_t_8 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_9 = PyBytes_FromString(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.data); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_9));
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
     __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_v_value);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_9);
     __Pyx_GIVEREF(__pyx_t_9);
-    __pyx_t_1 = 0;
-    __pyx_t_4 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_2 = 0;
     __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_2, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_1, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":212
+    /* "cvcf.pyx":212
  * 
  *             result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data))
  *             if expected != -1 and len(result[format[idx]]) != expected:             # <<<<<<<<<<<<<<
@@ -3802,30 +3841,30 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  */
     __pyx_t_9 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
       __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_12 = __pyx_t_11;
     } else {
-      __pyx_t_12 = __pyx_t_6;
+      __pyx_t_12 = __pyx_t_5;
     }
     if (__pyx_t_12) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":213
+      /* "cvcf.pyx":213
  *             result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data))
  *             if expected != -1 and len(result[format[idx]]) != expected:
  *                 self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS,             # <<<<<<<<<<<<<<
@@ -3834,65 +3873,65 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  */
       __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_1));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+      __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":214
+      /* "cvcf.pyx":214
  *             if expected != -1 and len(result[format[idx]]) != expected:
  *                 self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS,
  *                            "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))             # <<<<<<<<<<<<<<
  *                 if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]]))
  *                 result[format[idx]] = result[format[idx]][:expected]
  */
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_1); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_6); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_expected);
-      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_expected);
+      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_expected);
       __Pyx_GIVEREF(__pyx_v_expected);
-      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_7);
+      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      __pyx_t_4 = 0;
+      __pyx_t_2 = 0;
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
+      __Pyx_GIVEREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
       __Pyx_GIVEREF(__pyx_t_8);
-      PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_7));
+      PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_t_7));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
-      __pyx_t_2 = 0;
+      __pyx_t_1 = 0;
       __pyx_t_8 = 0;
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(__pyx_t_9, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":215
+      /* "cvcf.pyx":215
  *                 self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS,
  *                            "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))
  *                 if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]]))             # <<<<<<<<<<<<<<
@@ -3901,64 +3940,64 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  */
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_12) {
         __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
-        __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_7 = 0;
-        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_10 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_8, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_7 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+        PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
+        __pyx_t_9 = 0;
+        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_t_7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_9 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_t_8), __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_7, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_7, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         goto __pyx_L11;
       }
       __pyx_L11:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":216
+      /* "cvcf.pyx":216
  *                            "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))
  *                 if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]]))
  *                 result[format[idx]] = result[format[idx]][:expected]             # <<<<<<<<<<<<<<
@@ -3967,24 +4006,24 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
  */
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_expected); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_7 = PySequence_GetSlice(__pyx_t_8, 0, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_t_9, 0, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_8, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_9, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L10;
     }
     __pyx_L10:;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":218
+  /* "cvcf.pyx":218
  *                 result[format[idx]] = result[format[idx]][:expected]
  * 
  *         return result             # <<<<<<<<<<<<<<
@@ -4001,7 +4040,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
@@ -4019,7 +4058,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord___getitem__(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":224
+/* "cvcf.pyx":224
  *     '''converts a :term:`tabix row` into a VCF record.'''
  *     cdef vcffile
  *     def __init__(self, vcffile ):             # <<<<<<<<<<<<<<
@@ -4065,7 +4104,7 @@ static int __pyx_pf_4cvcf_11asVCFRecord___init__(PyObject *__pyx_v_self, PyObjec
   return -1;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":225
+  /* "cvcf.pyx":225
  *     cdef vcffile
  *     def __init__(self, vcffile ):
  *         self.vcffile = vcffile             # <<<<<<<<<<<<<<
@@ -4083,7 +4122,7 @@ static int __pyx_pf_4cvcf_11asVCFRecord___init__(PyObject *__pyx_v_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":226
+/* "cvcf.pyx":226
  *     def __init__(self, vcffile ):
  *         self.vcffile = vcffile
  *     def __call__(self, char * buffer, int len ):             # <<<<<<<<<<<<<<
@@ -4091,8 +4130,8 @@ static int __pyx_pf_4cvcf_11asVCFRecord___init__(PyObject *__pyx_v_self, PyObjec
  *         r = VCFRecord( self.vcffile )
  */
 
-static PyObject *__pyx_pf_4cvcf_11asVCFRecord___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pf_4cvcf_11asVCFRecord___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_11asVCFRecord_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pf_4cvcf_11asVCFRecord_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
   struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_r;
@@ -4143,7 +4182,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord___call__(PyObject *__pyx_v_self, P
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = ((struct __pyx_obj_4cvcf_VCFRecord *)Py_None); __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":228
+  /* "cvcf.pyx":228
  *     def __call__(self, char * buffer, int len ):
  *         cdef VCFRecord r
  *         r = VCFRecord( self.vcffile )             # <<<<<<<<<<<<<<
@@ -4151,18 +4190,18 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord___call__(PyObject *__pyx_v_self, P
  *         return r
  */
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile);
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile);
   __Pyx_GIVEREF(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile);
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cvcf_VCFRecord)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cvcf_VCFRecord)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_v_r));
   __pyx_v_r = ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":229
+  /* "cvcf.pyx":229
  *         cdef VCFRecord r
  *         r = VCFRecord( self.vcffile )
  *         r.copy( buffer, len )             # <<<<<<<<<<<<<<
@@ -4173,7 +4212,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord___call__(PyObject *__pyx_v_self, P
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":230
+  /* "cvcf.pyx":230
  *         r = VCFRecord( self.vcffile )
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -4199,7 +4238,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord___call__(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":306
+/* "cvcf.pyx":306
  *     _lines = None
  * 
  *     def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):             # <<<<<<<<<<<<<<
@@ -4223,8 +4262,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
+  int __pyx_t_6;
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s___copy,&__pyx_n_s__reference,&__pyx_n_s__regions,&__pyx_n_s__lines,&__pyx_n_s__leftalign,0};
   __Pyx_RefNannySetupContext("__init__");
   __pyx_self = __pyx_self;
@@ -4235,7 +4273,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
     values[2] = ((PyObject *)Py_None);
     values[3] = ((PyObject *)Py_None);
     values[4] = ((PyObject *)Py_None);
-    values[5] = __pyx_k_13;
+    values[5] = __pyx_k_22;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
       case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
@@ -4291,7 +4329,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
     __pyx_v_reference = ((PyObject *)Py_None);
     __pyx_v_regions = ((PyObject *)Py_None);
     __pyx_v_lines = ((PyObject *)Py_None);
-    __pyx_v_leftalign = __pyx_k_13;
+    __pyx_v_leftalign = __pyx_k_22;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  6: __pyx_v_leftalign = PyTuple_GET_ITEM(__pyx_args, 5);
       case  5: __pyx_v_lines = PyTuple_GET_ITEM(__pyx_args, 4);
@@ -4313,7 +4351,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_id = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":308
+  /* "cvcf.pyx":308
  *     def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):
  *         # make error identifiers accessible by name
  *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id             # <<<<<<<<<<<<<<
@@ -4363,25 +4401,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
     __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (PyObject_SetItem(__pyx_t_2, __pyx_t_5, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetItem(__pyx_t_2, __pyx_t_4, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":309
+  /* "cvcf.pyx":309
  *         # make error identifiers accessible by name
  *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
  *         if _copy != None:             # <<<<<<<<<<<<<<
@@ -4390,11 +4422,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v__copy, Py_None, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_7) {
+  if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":310
+    /* "cvcf.pyx":310
  *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
  *         if _copy != None:
  *             self._leftalign = _copy._leftalign             # <<<<<<<<<<<<<<
@@ -4406,7 +4438,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___leftalign, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":311
+    /* "cvcf.pyx":311
  *         if _copy != None:
  *             self._leftalign = _copy._leftalign
  *             self._header = _copy._header[:]             # <<<<<<<<<<<<<<
@@ -4415,118 +4447,118 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
  */
     __pyx_t_3 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PySequence_GetSlice(__pyx_t_3, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_3, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___header, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___header, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":312
+    /* "cvcf.pyx":312
  *             self._leftalign = _copy._leftalign
  *             self._header = _copy._header[:]
  *             self._version = _copy._version             # <<<<<<<<<<<<<<
  *             self._info = copy.deepcopy(_copy._info)
  *             self._filter = copy.deepcopy(_copy._filter)
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___version); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":313
+    /* "cvcf.pyx":313
  *             self._header = _copy._header[:]
  *             self._version = _copy._version
  *             self._info = copy.deepcopy(_copy._info)             # <<<<<<<<<<<<<<
  *             self._filter = copy.deepcopy(_copy._filter)
  *             self._format = copy.deepcopy(_copy._format)
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
+    __Pyx_GIVEREF(__pyx_t_4);
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___info, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___info, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":314
+    /* "cvcf.pyx":314
  *             self._version = _copy._version
  *             self._info = copy.deepcopy(_copy._info)
  *             self._filter = copy.deepcopy(_copy._filter)             # <<<<<<<<<<<<<<
  *             self._format = copy.deepcopy(_copy._format)
  *             self._samples = _copy._samples[:]
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___filter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___filter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+    __Pyx_GIVEREF(__pyx_t_4);
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___filter, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___filter, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":315
+    /* "cvcf.pyx":315
  *             self._info = copy.deepcopy(_copy._info)
  *             self._filter = copy.deepcopy(_copy._filter)
  *             self._format = copy.deepcopy(_copy._format)             # <<<<<<<<<<<<<<
  *             self._samples = _copy._samples[:]
  *             self._sample2column = copy.deepcopy(_copy._sample2column)
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
+    __Pyx_GIVEREF(__pyx_t_4);
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___format, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___format, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":316
+    /* "cvcf.pyx":316
  *             self._filter = copy.deepcopy(_copy._filter)
  *             self._format = copy.deepcopy(_copy._format)
  *             self._samples = _copy._samples[:]             # <<<<<<<<<<<<<<
  *             self._sample2column = copy.deepcopy(_copy._sample2column)
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___samples); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PySequence_GetSlice(__pyx_t_5, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___samples); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":317
+    /* "cvcf.pyx":317
  *             self._format = copy.deepcopy(_copy._format)
  *             self._samples = _copy._samples[:]
  *             self._sample2column = copy.deepcopy(_copy._sample2column)             # <<<<<<<<<<<<<<
@@ -4535,24 +4567,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
  */
     __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___sample2column); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sample2column, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":318
+    /* "cvcf.pyx":318
  *             self._samples = _copy._samples[:]
  *             self._sample2column = copy.deepcopy(_copy._sample2column)
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)             # <<<<<<<<<<<<<<
@@ -4566,19 +4598,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___ignored_errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___ignored_errors, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":319
+    /* "cvcf.pyx":319
  *             self._sample2column = copy.deepcopy(_copy._sample2column)
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
  *             self._warn_errors = copy.deepcopy(_copy._warn_errors)             # <<<<<<<<<<<<<<
@@ -4587,24 +4619,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
  */
     __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___warn_errors, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":320
+    /* "cvcf.pyx":320
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
  *             self._warn_errors = copy.deepcopy(_copy._warn_errors)
  *             self._reference = _copy._reference             # <<<<<<<<<<<<<<
@@ -4616,7 +4648,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___reference, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":321
+    /* "cvcf.pyx":321
  *             self._warn_errors = copy.deepcopy(_copy._warn_errors)
  *             self._reference = _copy._reference
  *             self._regions = _copy._regions             # <<<<<<<<<<<<<<
@@ -4631,49 +4663,49 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":322
+  /* "cvcf.pyx":322
  *             self._reference = _copy._reference
  *             self._regions = _copy._regions
  *         if reference: self._reference = reference             # <<<<<<<<<<<<<<
  *         if regions: self._regions = regions
  *         if leftalign: self._leftalign = leftalign
  */
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_7) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___reference, __pyx_v_reference) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L9;
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":323
+  /* "cvcf.pyx":323
  *             self._regions = _copy._regions
  *         if reference: self._reference = reference
  *         if regions: self._regions = regions             # <<<<<<<<<<<<<<
  *         if leftalign: self._leftalign = leftalign
  *         self._lines = lines
  */
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_regions); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_7) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_regions); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___regions, __pyx_v_regions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
   __pyx_L10:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":324
+  /* "cvcf.pyx":324
  *         if reference: self._reference = reference
  *         if regions: self._regions = regions
  *         if leftalign: self._leftalign = leftalign             # <<<<<<<<<<<<<<
  *         self._lines = lines
  * 
  */
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_leftalign); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_7) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_leftalign); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___leftalign, __pyx_v_leftalign) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L11;
   }
   __pyx_L11:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":325
+  /* "cvcf.pyx":325
  *         if regions: self._regions = regions
  *         if leftalign: self._leftalign = leftalign
  *         self._lines = lines             # <<<<<<<<<<<<<<
@@ -4689,7 +4721,6 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("cvcf.VCF.__init__");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -4699,7 +4730,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":327
+/* "cvcf.pyx":327
  *         self._lines = lines
  * 
  *     def error(self,line,error,opt=None):             # <<<<<<<<<<<<<<
@@ -4707,9 +4738,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__
  *         errorlabel, errorstring = self._errors[error].split(':')
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_error = {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pf_4cvcf_3VCF_error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_1error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_1error = {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pf_4cvcf_3VCF_1error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_1error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_error = 0;
@@ -4793,7 +4824,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
   __pyx_v_errorstring = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_errwarn = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":328
+  /* "cvcf.pyx":328
  * 
  *     def error(self,line,error,opt=None):
  *         if error in self._ignored_errors: return             # <<<<<<<<<<<<<<
@@ -4812,7 +4843,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":329
+  /* "cvcf.pyx":329
  *     def error(self,line,error,opt=None):
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')             # <<<<<<<<<<<<<<
@@ -4827,45 +4858,39 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
   __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
-    PyObject* tuple = __pyx_t_4;
-    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
-    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
+    PyObject* tuple = __pyx_t_3;
+    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_errorlabel);
-    __pyx_v_errorlabel = __pyx_t_3;
-    __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_v_errorstring);
-    __pyx_v_errorstring = __pyx_t_1;
+    __pyx_v_errorlabel = __pyx_t_1;
     __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_errorstring);
+    __pyx_v_errorstring = __pyx_t_4;
+    __pyx_t_4 = 0;
   } else {
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_v_errorlabel);
-    __pyx_v_errorlabel = __pyx_t_3;
-    __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_v_errorstring);
-    __pyx_v_errorstring = __pyx_t_1;
+    __pyx_v_errorlabel = __pyx_t_1;
     __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_errorstring);
+    __pyx_v_errorstring = __pyx_t_4;
+    __pyx_t_4 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":330
+  /* "cvcf.pyx":330
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')
  *         if opt: errorstring = errorstring % opt             # <<<<<<<<<<<<<<
@@ -4874,100 +4899,100 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
  */
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_opt); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_2) {
-    __pyx_t_4 = PyNumber_Remainder(__pyx_v_errorstring, __pyx_v_opt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(__pyx_v_errorstring, __pyx_v_opt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_v_errorstring);
-    __pyx_v_errorstring = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_errorstring = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":331
+  /* "cvcf.pyx":331
  *         errorlabel, errorstring = self._errors[error].split(':')
  *         if opt: errorstring = errorstring % opt
  *         errwarn = ["Error","Warning"][error in self._warn_errors]             # <<<<<<<<<<<<<<
  *         sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring))
  *         if error in self._warn_errors: return
  */
-  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Error));
-  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__Error));
+  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__Error));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Error));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Warning));
-  PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__Warning));
+  PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Warning));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Warning));
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = ((PySequence_Contains(__pyx_t_1, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_4), __pyx_t_2, sizeof(int), __Pyx_PyBool_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_2 = ((PySequence_Contains(__pyx_t_4, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_3), __pyx_t_2, sizeof(int), __Pyx_PyBool_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_v_errwarn);
-  __pyx_v_errwarn = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_errwarn = __pyx_t_4;
+  __pyx_t_4 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":332
+  /* "cvcf.pyx":332
  *         if opt: errorstring = errorstring % opt
  *         errwarn = ["Error","Warning"][error in self._warn_errors]
  *         sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring))             # <<<<<<<<<<<<<<
  *         if error in self._warn_errors: return
  *         raise ValueError(errorstring)
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lineno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lineno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_v_line);
-  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_line);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line);
   __Pyx_GIVEREF(__pyx_v_line);
   __Pyx_INCREF(__pyx_v_errwarn);
-  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_errwarn);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_errwarn);
   __Pyx_GIVEREF(__pyx_v_errwarn);
   __Pyx_INCREF(__pyx_v_errorlabel);
-  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_errorlabel);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_errorlabel);
   __Pyx_GIVEREF(__pyx_v_errorlabel);
   __Pyx_INCREF(__pyx_v_errorstring);
-  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_errorstring);
+  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_errorstring);
   __Pyx_GIVEREF(__pyx_v_errorstring);
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":333
+  /* "cvcf.pyx":333
  *         errwarn = ["Error","Warning"][error in self._warn_errors]
  *         sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring))
  *         if error in self._warn_errors: return             # <<<<<<<<<<<<<<
  *         raise ValueError(errorstring)
  * 
  */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = ((PySequence_Contains(__pyx_t_4, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = ((PySequence_Contains(__pyx_t_3, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -4976,23 +5001,23 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":334
+  /* "cvcf.pyx":334
  *         sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring))
  *         if error in self._warn_errors: return
  *         raise ValueError(errorstring)             # <<<<<<<<<<<<<<
  * 
  *     def parse_format(self,line,format,filter=False):
  */
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(__pyx_v_errorstring);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_errorstring);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_errorstring);
   __Pyx_GIVEREF(__pyx_v_errorstring);
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_Raise(__pyx_t_3, 0, 0);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_Raise(__pyx_t_1, 0, 0);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -5013,7 +5038,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":336
+/* "cvcf.pyx":336
  *         raise ValueError(errorstring)
  * 
  *     def parse_format(self,line,format,filter=False):             # <<<<<<<<<<<<<<
@@ -5021,9 +5046,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_error(PyObject *__pyx_self, PyObject *__pyx
  *             if not format.startswith('<'):
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_parse_format = {__Pyx_NAMESTR("parse_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_parse_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_2parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_2parse_format = {__Pyx_NAMESTR("parse_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_2parse_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_2parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_format = 0;
@@ -5039,8 +5064,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
   Py_ssize_t __pyx_t_6;
   PyObject *__pyx_t_7 = NULL;
   int __pyx_t_8;
@@ -5054,7 +5079,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[4] = {0,0,0,0};
-    values[3] = __pyx_k_15;
+    values[3] = __pyx_k_26;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -5094,7 +5119,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_v_format = values[2];
     __pyx_v_filter = values[3];
   } else {
-    __pyx_v_filter = __pyx_k_15;
+    __pyx_v_filter = __pyx_k_26;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  4:
       __pyx_v_filter = PyTuple_GET_ITEM(__pyx_args, 3);
@@ -5115,7 +5140,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   return NULL;
   __pyx_L4_argument_unpacking_done:;
   __Pyx_INCREF(__pyx_v_format);
-  __pyx_v_data = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_data = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_first = Py_None; __Pyx_INCREF(Py_None);
@@ -5123,7 +5148,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __pyx_v_n = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":337
+  /* "cvcf.pyx":337
  * 
  *     def parse_format(self,line,format,filter=False):
  *         if self._version == 40:             # <<<<<<<<<<<<<<
@@ -5139,7 +5164,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":338
+    /* "cvcf.pyx":338
  *     def parse_format(self,line,format,filter=False):
  *         if self._version == 40:
  *             if not format.startswith('<'):             # <<<<<<<<<<<<<<
@@ -5148,117 +5173,105 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_16));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_5 = (!__pyx_t_3);
-    if (__pyx_t_5) {
+    __pyx_t_4 = (!__pyx_t_3);
+    if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":339
+      /* "cvcf.pyx":339
  *         if self._version == 40:
  *             if not format.startswith('<'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)             # <<<<<<<<<<<<<<
  *                 format = "<"+format
  *             if not format.endswith('>'):
  */
-      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
-      __Pyx_GIVEREF(__pyx_t_1);
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":340
+      /* "cvcf.pyx":340
  *             if not format.startswith('<'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format = "<"+format             # <<<<<<<<<<<<<<
  *             if not format.endswith('>'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  */
-      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_16), __pyx_v_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_27), __pyx_v_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_format);
-      __pyx_v_format = __pyx_t_1;
-      __pyx_t_1 = 0;
+      __pyx_v_format = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":341
+    /* "cvcf.pyx":341
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format = "<"+format
  *             if not format.endswith('>'):             # <<<<<<<<<<<<<<
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format += ">"
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__endswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__endswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_18));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_3 = (!__pyx_t_5);
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":342
+      /* "cvcf.pyx":342
  *                 format = "<"+format
  *             if not format.endswith('>'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)             # <<<<<<<<<<<<<<
  *                 format += ">"
  *             format = format[1:-1]
  */
-      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_17); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":343
+      /* "cvcf.pyx":343
  *             if not format.endswith('>'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format += ">"             # <<<<<<<<<<<<<<
  *             format = format[1:-1]
  *         data = {'id':None,'number':None,'type':None,'descr':None}
  */
-      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_format, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_format, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_format);
       __pyx_v_format = __pyx_t_2;
@@ -5267,14 +5280,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":344
+    /* "cvcf.pyx":344
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format += ">"
  *             format = format[1:-1]             # <<<<<<<<<<<<<<
  *         data = {'id':None,'number':None,'type':None,'descr':None}
  *         idx = 0
  */
-    __pyx_t_2 = PySequence_GetSlice(__pyx_v_format, 1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_format, 1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_format);
     __pyx_v_format = __pyx_t_2;
@@ -5283,7 +5296,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":345
+  /* "cvcf.pyx":345
  *                 format += ">"
  *             format = format[1:-1]
  *         data = {'id':None,'number':None,'type':None,'descr':None}             # <<<<<<<<<<<<<<
@@ -5300,7 +5313,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __pyx_v_data = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":346
+  /* "cvcf.pyx":346
  *             format = format[1:-1]
  *         data = {'id':None,'number':None,'type':None,'descr':None}
  *         idx = 0             # <<<<<<<<<<<<<<
@@ -5311,7 +5324,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __Pyx_DECREF(__pyx_v_idx);
   __pyx_v_idx = __pyx_int_0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":347
+  /* "cvcf.pyx":347
  *         data = {'id':None,'number':None,'type':None,'descr':None}
  *         idx = 0
  *         while len(format.strip())>0:             # <<<<<<<<<<<<<<
@@ -5329,7 +5342,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_t_3 = (__pyx_t_6 > 0);
     if (!__pyx_t_3) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":348
+    /* "cvcf.pyx":348
  *         idx = 0
  *         while len(format.strip())>0:
  *             elts = format.strip().split(',')             # <<<<<<<<<<<<<<
@@ -5344,395 +5357,317 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_elts);
-    __pyx_v_elts = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_elts = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":349
+    /* "cvcf.pyx":349
  *         while len(format.strip())>0:
  *             elts = format.strip().split(',')
  *             first, rest = elts[0], ','.join(elts[1:])             # <<<<<<<<<<<<<<
  *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):
  *                 if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
  */
-    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PySequence_GetSlice(__pyx_v_elts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_elts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
+    __Pyx_GIVEREF(__pyx_t_5);
+    __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_v_first);
-    __pyx_v_first = __pyx_t_4;
-    __pyx_t_4 = 0;
+    __pyx_v_first = __pyx_t_2;
+    __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_rest);
-    __pyx_v_rest = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __pyx_v_rest = __pyx_t_5;
+    __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":350
+    /* "cvcf.pyx":350
  *             elts = format.strip().split(',')
  *             first, rest = elts[0], ','.join(elts[1:])
  *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):             # <<<<<<<<<<<<<<
  *                 if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
  *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_8));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-    __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (!__pyx_t_3) {
-      __pyx_t_4 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
-      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_19));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
-      __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (__pyx_t_5) {
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_4) {
+        __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_8));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-        __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
-        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_19));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
-        __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __pyx_t_9 = __pyx_t_8;
       } else {
-        __pyx_t_9 = __pyx_t_5;
+        __pyx_t_9 = __pyx_t_4;
       }
-      __pyx_t_5 = __pyx_t_9;
+      __pyx_t_4 = __pyx_t_9;
     } else {
-      __pyx_t_5 = __pyx_t_3;
+      __pyx_t_4 = __pyx_t_3;
     }
-    if (__pyx_t_5) {
+    if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":351
+      /* "cvcf.pyx":351
  *             first, rest = elts[0], ','.join(elts[1:])
  *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):
  *                 if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)             # <<<<<<<<<<<<<<
  *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *                 first = ["ID=","Number=","Type=","Description="][idx] + first
  */
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (__pyx_t_5) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__pyx_t_4) {
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_38); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
-        __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
+        __Pyx_GIVEREF(__pyx_t_5);
+        __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         goto __pyx_L12;
       }
       __pyx_L12:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":352
+      /* "cvcf.pyx":352
  *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):
  *                 if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
  *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
  *                 first = ["ID=","Number=","Type=","Description="][idx] + first
  *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
  */
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (__pyx_t_5) {
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_4) {
+        __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
-        __Pyx_GIVEREF(__pyx_t_4);
-        __pyx_t_4 = 0;
-        __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         goto __pyx_L13;
       }
       __pyx_L13:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":353
+      /* "cvcf.pyx":353
  *                 if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
  *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *                 first = ["ID=","Number=","Type=","Description="][idx] + first             # <<<<<<<<<<<<<<
  *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
  */
-      __pyx_t_4 = PyList_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
-      PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_22));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
-      PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_s_23));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
-      PyList_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_kp_s_24));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
-      PyList_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_kp_s_25));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
-      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_t_4), __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
+      PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_40));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
+      PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_s_41));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
+      PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_kp_s_42));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
+      PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_kp_s_43));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
+      __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_t_2), __pyx_v_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_v_first); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_first); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_v_first);
-      __pyx_v_first = __pyx_t_4;
-      __pyx_t_4 = 0;
+      __pyx_v_first = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L11;
     }
     __pyx_L11:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":354
+    /* "cvcf.pyx":354
  *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *                 first = ["ID=","Number=","Type=","Description="][idx] + first
  *             if first.startswith('ID='):            data['id'] = first.split('=')[1]             # <<<<<<<<<<<<<<
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_22));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
-    __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_5) {
+    if (__pyx_t_4) {
       __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-      __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L14;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":355
+    /* "cvcf.pyx":355
  *                 first = ["ID=","Number=","Type=","Description="][idx] + first
  *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]             # <<<<<<<<<<<<<<
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_23));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
-    __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_5) {
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (__pyx_t_4) {
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-      __pyx_t_2 = PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       goto __pyx_L14;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":356
+    /* "cvcf.pyx":356
  *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]             # <<<<<<<<<<<<<<
  *             elif first.startswith('Description='):
  *                 elts = format.split('"')
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_24));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
-    __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_5) {
+    if (__pyx_t_4) {
       __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-      __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L14;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":357
+    /* "cvcf.pyx":357
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):             # <<<<<<<<<<<<<<
  *                 elts = format.split('"')
  *                 if len(elts)<3:
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_25));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
-    __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_5) {
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (__pyx_t_4) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":358
+      /* "cvcf.pyx":358
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):
  *                 elts = format.split('"')             # <<<<<<<<<<<<<<
  *                 if len(elts)<3:
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)
  */
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_19));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
-      __pyx_t_2 = PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_v_elts);
-      __pyx_v_elts = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_elts = __pyx_t_7;
+      __pyx_t_7 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":359
+      /* "cvcf.pyx":359
  *             elif first.startswith('Description='):
  *                 elts = format.split('"')
  *                 if len(elts)<3:             # <<<<<<<<<<<<<<
@@ -5740,130 +5675,118 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  *                     elts = first.split('=') + [rest]
  */
       __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_5 = (__pyx_t_6 < 3);
-      if (__pyx_t_5) {
+      __pyx_t_4 = (__pyx_t_6 < 3);
+      if (__pyx_t_4) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":360
+        /* "cvcf.pyx":360
  *                 elts = format.split('"')
  *                 if len(elts)<3:
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)             # <<<<<<<<<<<<<<
  *                     elts = first.split('=') + [rest]
  *                 data['descr'] = elts[1]
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_26); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_52); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
-        __Pyx_GIVEREF(__pyx_t_4);
-        __pyx_t_4 = 0;
-        __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":361
+        /* "cvcf.pyx":361
  *                 if len(elts)<3:
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)
  *                     elts = first.split('=') + [rest]             # <<<<<<<<<<<<<<
  *                 data['descr'] = elts[1]
  *                 rest = '"'.join(elts[2:])
  */
-        __pyx_t_4 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_8));
-        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-        __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+        __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_rest);
-        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_rest);
+        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_rest);
         __Pyx_GIVEREF(__pyx_v_rest);
-        __pyx_t_4 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+        __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_v_elts);
-        __pyx_v_elts = __pyx_t_4;
-        __pyx_t_4 = 0;
+        __pyx_v_elts = __pyx_t_7;
+        __pyx_t_7 = 0;
         goto __pyx_L15;
       }
       __pyx_L15:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":362
+      /* "cvcf.pyx":362
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)
  *                     elts = first.split('=') + [rest]
  *                 data['descr'] = elts[1]             # <<<<<<<<<<<<<<
  *                 rest = '"'.join(elts[2:])
  *                 if rest.startswith(','): rest = rest[1:]
  */
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":363
+      /* "cvcf.pyx":363
  *                     elts = first.split('=') + [rest]
  *                 data['descr'] = elts[1]
  *                 rest = '"'.join(elts[2:])             # <<<<<<<<<<<<<<
  *                 if rest.startswith(','): rest = rest[1:]
  *             else:
  */
-      __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_19), __pyx_n_s__join); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_7 = PySequence_GetSlice(__pyx_v_elts, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_34), __pyx_n_s__join); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_elts, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
-      __Pyx_GIVEREF(__pyx_t_7);
-      __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_v_rest);
-      __pyx_v_rest = __pyx_t_7;
-      __pyx_t_7 = 0;
+      __pyx_v_rest = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":364
+      /* "cvcf.pyx":364
  *                 data['descr'] = elts[1]
  *                 rest = '"'.join(elts[2:])
  *                 if rest.startswith(','): rest = rest[1:]             # <<<<<<<<<<<<<<
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_rest, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_rest, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-      __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_5) {
-        __pyx_t_4 = PySequence_GetSlice(__pyx_v_rest, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_4) {
+        __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_rest, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_v_rest);
-        __pyx_v_rest = __pyx_t_4;
-        __pyx_t_4 = 0;
+        __pyx_v_rest = __pyx_t_5;
+        __pyx_t_5 = 0;
         goto __pyx_L16;
       }
       __pyx_L16:;
@@ -5871,34 +5794,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":366
+      /* "cvcf.pyx":366
  *                 if rest.startswith(','): rest = rest[1:]
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
  *             format = rest
  *             idx += 1
  */
-      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     }
     __pyx_L14:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":367
+    /* "cvcf.pyx":367
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             format = rest             # <<<<<<<<<<<<<<
@@ -5909,7 +5832,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __Pyx_DECREF(__pyx_v_format);
     __pyx_v_format = __pyx_v_rest;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":368
+    /* "cvcf.pyx":368
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             format = rest
  *             idx += 1             # <<<<<<<<<<<<<<
@@ -5922,22 +5845,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_v_idx = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":369
+    /* "cvcf.pyx":369
  *             format = rest
  *             idx += 1
  *             if filter and idx==1: idx=3  # skip number and type fields for FILTER format strings             # <<<<<<<<<<<<<<
  *         if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         if not data['descr']:
  */
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_filter); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_5) {
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_filter); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_4) {
       __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_9 = __pyx_t_3;
     } else {
-      __pyx_t_9 = __pyx_t_5;
+      __pyx_t_9 = __pyx_t_4;
     }
     if (__pyx_t_9) {
       __Pyx_INCREF(__pyx_int_3);
@@ -5948,7 +5871,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_L17:;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":370
+  /* "cvcf.pyx":370
  *             idx += 1
  *             if filter and idx==1: idx=3  # skip number and type fields for FILTER format strings
  *         if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -5959,30 +5882,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_5 = (!__pyx_t_9);
-  if (__pyx_t_5) {
+  __pyx_t_4 = (!__pyx_t_9);
+  if (__pyx_t_4) {
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
     __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     goto __pyx_L18;
   }
   __pyx_L18:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":371
+  /* "cvcf.pyx":371
  *             if filter and idx==1: idx=3  # skip number and type fields for FILTER format strings
  *         if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         if not data['descr']:             # <<<<<<<<<<<<<<
@@ -5991,12 +5914,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
   __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_9 = (!__pyx_t_5);
+  __pyx_t_9 = (!__pyx_t_4);
   if (__pyx_t_9) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":372
+    /* "cvcf.pyx":372
  *         if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         if not data['descr']:
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -6005,59 +5928,59 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
     __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
+    __Pyx_GIVEREF(__pyx_t_5);
+    __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":373
+    /* "cvcf.pyx":373
  *         if not data['descr']:
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             data['descr'] = '<none>'             # <<<<<<<<<<<<<<
  *         if not data['type'] and not data['number']:
  *             # fine, ##filter format
  */
-    if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), ((PyObject *)__pyx_kp_s_27)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), ((PyObject *)__pyx_kp_s_55)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L19;
   }
   __pyx_L19:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":374
+  /* "cvcf.pyx":374
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             data['descr'] = '<none>'
  *         if not data['type'] and not data['number']:             # <<<<<<<<<<<<<<
  *             # fine, ##filter format
  *             return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')
  */
-  __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_5 = (!__pyx_t_9);
-  if (__pyx_t_5) {
-    __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_4 = (!__pyx_t_9);
+  if (__pyx_t_4) {
+    __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_3 = (!__pyx_t_9);
     __pyx_t_9 = __pyx_t_3;
   } else {
-    __pyx_t_9 = __pyx_t_5;
+    __pyx_t_9 = __pyx_t_4;
   }
   if (__pyx_t_9) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":376
+    /* "cvcf.pyx":376
  *         if not data['type'] and not data['number']:
  *             # fine, ##filter format
  *             return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')             # <<<<<<<<<<<<<<
@@ -6065,8 +5988,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6074,7 +5997,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7);
@@ -6087,16 +6010,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Flag));
     PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_10, 5, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+    PyTuple_SET_ITEM(__pyx_t_10, 5, ((PyObject *)__pyx_kp_s_9));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
     __pyx_t_2 = 0;
     __pyx_t_7 = 0;
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
@@ -6104,7 +6027,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   }
   __pyx_L20:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":377
+  /* "cvcf.pyx":377
  *             # fine, ##filter format
  *             return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')
  *         if not data['type'] in ["Integer","Float","Character","String","Flag"]:             # <<<<<<<<<<<<<<
@@ -6117,8 +6040,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_5 = __pyx_t_9;
-  if (!__pyx_t_5) {
+  __pyx_t_4 = __pyx_t_9;
+  if (!__pyx_t_4) {
     __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6126,19 +6049,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_t_3 = __pyx_t_9;
     __pyx_t_9 = __pyx_t_3;
   } else {
-    __pyx_t_9 = __pyx_t_5;
+    __pyx_t_9 = __pyx_t_4;
   }
   if (!__pyx_t_9) {
     __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_3 = __pyx_t_5;
-    __pyx_t_5 = __pyx_t_3;
+    __pyx_t_3 = __pyx_t_4;
+    __pyx_t_4 = __pyx_t_3;
   } else {
-    __pyx_t_5 = __pyx_t_9;
+    __pyx_t_4 = __pyx_t_9;
   }
-  if (!__pyx_t_5) {
+  if (!__pyx_t_4) {
     __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6146,23 +6069,23 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_t_3 = __pyx_t_9;
     __pyx_t_9 = __pyx_t_3;
   } else {
-    __pyx_t_9 = __pyx_t_5;
+    __pyx_t_9 = __pyx_t_4;
   }
   if (!__pyx_t_9) {
     __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_3 = __pyx_t_5;
-    __pyx_t_5 = __pyx_t_3;
+    __pyx_t_3 = __pyx_t_4;
+    __pyx_t_4 = __pyx_t_3;
   } else {
-    __pyx_t_5 = __pyx_t_9;
+    __pyx_t_4 = __pyx_t_9;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_9 = (!__pyx_t_5);
+  __pyx_t_9 = (!__pyx_t_4);
   if (__pyx_t_9) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":378
+    /* "cvcf.pyx":378
  *             return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')
  *         if not data['type'] in ["Integer","Float","Character","String","Flag"]:
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -6171,26 +6094,26 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10);
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     goto __pyx_L21;
   }
   __pyx_L21:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":380
+  /* "cvcf.pyx":380
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         # I would like a missing-value field, but it isn't there
  *         if data['type'] in ['Integer','Float']: data['missing'] = None    # Do NOT use arbitrary int/float as missing value             # <<<<<<<<<<<<<<
@@ -6199,41 +6122,41 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
   __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_5 = __pyx_t_9;
-  if (!__pyx_t_5) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_4 = __pyx_t_9;
+  if (!__pyx_t_4) {
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_3 = __pyx_t_9;
     __pyx_t_9 = __pyx_t_3;
   } else {
-    __pyx_t_9 = __pyx_t_5;
+    __pyx_t_9 = __pyx_t_4;
   }
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_5 = __pyx_t_9;
-  if (__pyx_t_5) {
+  __pyx_t_4 = __pyx_t_9;
+  if (__pyx_t_4) {
     if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing), Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L22;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":381
+    /* "cvcf.pyx":381
  *         # I would like a missing-value field, but it isn't there
  *         if data['type'] in ['Integer','Float']: data['missing'] = None    # Do NOT use arbitrary int/float as missing value
  *         else:                                   data['missing'] = '.'             # <<<<<<<<<<<<<<
  *         if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         try:
  */
-    if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing), ((PyObject *)__pyx_kp_s_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing), ((PyObject *)__pyx_kp_s_9)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L22:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":382
+  /* "cvcf.pyx":382
  *         if data['type'] in ['Integer','Float']: data['missing'] = None    # Do NOT use arbitrary int/float as missing value
  *         else:                                   data['missing'] = '.'
  *         if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -6242,32 +6165,32 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
   __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_9 = (!__pyx_t_5);
+  __pyx_t_9 = (!__pyx_t_4);
   if (__pyx_t_9) {
     __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
+    __Pyx_GIVEREF(__pyx_t_5);
+    __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     goto __pyx_L23;
   }
   __pyx_L23:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":383
+  /* "cvcf.pyx":383
  *         else:                                   data['missing'] = '.'
  *         if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         try:             # <<<<<<<<<<<<<<
@@ -6282,39 +6205,39 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __Pyx_XGOTREF(__pyx_save_exc_tb);
     /*try:*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":384
+      /* "cvcf.pyx":384
  *         if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         try:
  *             n = int(data['number'])             # <<<<<<<<<<<<<<
  *             t = self.NT_NUMBER
  *         except ValueError:
  */
-      __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
+      __Pyx_GIVEREF(__pyx_t_5);
+      __pyx_t_5 = 0;
+      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_v_n);
-      __pyx_v_n = __pyx_t_4;
-      __pyx_t_4 = 0;
+      __pyx_v_n = __pyx_t_5;
+      __pyx_t_5 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":385
+      /* "cvcf.pyx":385
  *         try:
  *             n = int(data['number'])
  *             t = self.NT_NUMBER             # <<<<<<<<<<<<<<
  *         except ValueError:
  *             n = -1
  */
-      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L24_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_4;
-      __pyx_t_4 = 0;
+      __pyx_v_t = __pyx_t_5;
+      __pyx_t_5 = 0;
     }
     __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
     __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
@@ -6325,9 +6248,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":386
+    /* "cvcf.pyx":386
  *             n = int(data['number'])
  *             t = self.NT_NUMBER
  *         except ValueError:             # <<<<<<<<<<<<<<
@@ -6337,12 +6260,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
     if (__pyx_t_11) {
       __Pyx_AddTraceback("cvcf.VCF.parse_format");
-      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_GOTREF(__pyx_t_10);
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":387
+      /* "cvcf.pyx":387
  *             t = self.NT_NUMBER
  *         except ValueError:
  *             n = -1             # <<<<<<<<<<<<<<
@@ -6353,7 +6276,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
       __Pyx_DECREF(__pyx_v_n);
       __pyx_v_n = __pyx_int_neg_1;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":388
+      /* "cvcf.pyx":388
  *         except ValueError:
  *             n = -1
  *             if data['number'] == '.':                   t = self.NT_UNKNOWN             # <<<<<<<<<<<<<<
@@ -6362,7 +6285,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
@@ -6376,7 +6299,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
         goto __pyx_L34;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":389
+      /* "cvcf.pyx":389
  *             n = -1
  *             if data['number'] == '.':                   t = self.NT_UNKNOWN
  *             elif data['number'] == '#alleles':          t = self.NT_ALLELES             # <<<<<<<<<<<<<<
@@ -6385,7 +6308,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
       __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_28), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_56), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
@@ -6399,7 +6322,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
         goto __pyx_L34;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":390
+      /* "cvcf.pyx":390
  *             if data['number'] == '.':                   t = self.NT_UNKNOWN
  *             elif data['number'] == '#alleles':          t = self.NT_ALLELES
  *             elif data['number'] == '#nonref_alleles':   t = self.NT_NR_ALLELES             # <<<<<<<<<<<<<<
@@ -6408,7 +6331,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_29), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_57), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
@@ -6422,7 +6345,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
         goto __pyx_L34;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":391
+      /* "cvcf.pyx":391
  *             elif data['number'] == '#alleles':          t = self.NT_ALLELES
  *             elif data['number'] == '#nonref_alleles':   t = self.NT_NR_ALLELES
  *             elif data['number'] == '#genotypes':        t = self.NT_GENOTYPES             # <<<<<<<<<<<<<<
@@ -6431,7 +6354,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
       __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_30), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_58), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
@@ -6445,7 +6368,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
         goto __pyx_L34;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":392
+      /* "cvcf.pyx":392
  *             elif data['number'] == '#nonref_alleles':   t = self.NT_NR_ALLELES
  *             elif data['number'] == '#genotypes':        t = self.NT_GENOTYPES
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES             # <<<<<<<<<<<<<<
@@ -6454,7 +6377,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_31), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_59), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
@@ -6469,7 +6392,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":394
+        /* "cvcf.pyx":394
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -6478,24 +6401,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  */
         __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
-        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_12));
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       }
       __pyx_L34:;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L25_exception_handled;
@@ -6514,7 +6437,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
     __pyx_L31_try_end:;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":395
+  /* "cvcf.pyx":395
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing'])             # <<<<<<<<<<<<<<
@@ -6526,14 +6449,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_12 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
   __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_v_t);
@@ -6542,20 +6465,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __Pyx_INCREF(__pyx_v_n);
   PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_n);
   __Pyx_GIVEREF(__pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
   PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_7);
   __Pyx_GIVEREF(__pyx_t_7);
   PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_12);
   __Pyx_GIVEREF(__pyx_t_12);
   __pyx_t_1 = 0;
-  __pyx_t_4 = 0;
+  __pyx_t_5 = 0;
   __pyx_t_7 = 0;
   __pyx_t_12 = 0;
-  __pyx_t_12 = PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_12;
   __pyx_t_12 = 0;
   goto __pyx_L0;
@@ -6565,7 +6488,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_12);
@@ -6585,7 +6508,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":398
+/* "cvcf.pyx":398
  * 
  * 
  *     def format_format( self, fmt, filter=False ):             # <<<<<<<<<<<<<<
@@ -6593,9 +6516,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_format(PyObject *__pyx_self, PyObject
  *         if fmt.number != None and not filter:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_format_format = {__Pyx_NAMESTR("format_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_format_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_3format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_3format_format = {__Pyx_NAMESTR("format_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_3format_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_3format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_fmt = 0;
   PyObject *__pyx_v_filter = 0;
@@ -6623,7 +6546,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
-    values[2] = __pyx_k_32;
+    values[2] = __pyx_k_60;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -6655,7 +6578,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_v_fmt = values[1];
     __pyx_v_filter = values[2];
   } else {
-    __pyx_v_filter = __pyx_k_32;
+    __pyx_v_filter = __pyx_k_60;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3:
       __pyx_v_filter = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -6674,13 +6597,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_v_values = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_values = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_nmb = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_format = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":399
+  /* "cvcf.pyx":399
  * 
  *     def format_format( self, fmt, filter=False ):
  *         values = [('ID',fmt.id)]             # <<<<<<<<<<<<<<
@@ -6690,7 +6613,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__ID));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
@@ -6699,14 +6622,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   __pyx_t_1 = 0;
   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
+  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
   __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_v_values));
   __pyx_v_values = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":400
+  /* "cvcf.pyx":400
  *     def format_format( self, fmt, filter=False ):
  *         values = [('ID',fmt.id)]
  *         if fmt.number != None and not filter:             # <<<<<<<<<<<<<<
@@ -6729,7 +6652,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   }
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":401
+    /* "cvcf.pyx":401
  *         values = [('ID',fmt.id)]
  *         if fmt.number != None and not filter:
  *             if fmt.numbertype == self.NT_UNKNOWN: nmb = "."             # <<<<<<<<<<<<<<
@@ -6747,13 +6670,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (__pyx_t_4) {
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
       __Pyx_DECREF(__pyx_v_nmb);
-      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_6);
+      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_9);
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":402
+    /* "cvcf.pyx":402
  *         if fmt.number != None and not filter:
  *             if fmt.numbertype == self.NT_UNKNOWN: nmb = "."
  *             elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number)             # <<<<<<<<<<<<<<
@@ -6774,20 +6697,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
       __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_v_nmb);
       __pyx_v_nmb = __pyx_t_2;
       __pyx_t_2 = 0;
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":403
+    /* "cvcf.pyx":403
  *             if fmt.numbertype == self.NT_UNKNOWN: nmb = "."
  *             elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number)
  *             elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles"             # <<<<<<<<<<<<<<
@@ -6805,13 +6728,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (__pyx_t_4) {
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
       __Pyx_DECREF(__pyx_v_nmb);
-      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_28);
+      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_56);
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":404
+    /* "cvcf.pyx":404
  *             elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number)
  *             elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles"
  *             elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles"             # <<<<<<<<<<<<<<
@@ -6829,13 +6752,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_4) {
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
       __Pyx_DECREF(__pyx_v_nmb);
-      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_29);
+      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_57);
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":405
+    /* "cvcf.pyx":405
  *             elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles"
  *             elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles"
  *             elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes"             # <<<<<<<<<<<<<<
@@ -6853,13 +6776,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (__pyx_t_4) {
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
       __Pyx_DECREF(__pyx_v_nmb);
-      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_30);
+      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_58);
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":406
+    /* "cvcf.pyx":406
  *             elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles"
  *             elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes"
  *             elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes"             # <<<<<<<<<<<<<<
@@ -6877,14 +6800,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_4) {
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
       __Pyx_DECREF(__pyx_v_nmb);
-      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_31);
+      __pyx_v_nmb = ((PyObject *)__pyx_kp_s_59);
       goto __pyx_L7;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":408
+      /* "cvcf.pyx":408
  *             elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes"
  *             else:
  *                 raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)             # <<<<<<<<<<<<<<
@@ -6893,24 +6816,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
  */
       __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_1, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L7:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":409
+    /* "cvcf.pyx":409
  *             else:
  *                 raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)
  *             values.append( ('Number',nmb) )             # <<<<<<<<<<<<<<
@@ -6921,17 +6844,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
       PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(((PyObject *)__pyx_n_s__Number));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Number));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Number));
     __Pyx_INCREF(__pyx_v_nmb);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nmb);
     __Pyx_GIVEREF(__pyx_v_nmb);
-    __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_values), __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_7 = PyList_Append(__pyx_v_values, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":410
+    /* "cvcf.pyx":410
  *                 raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)
  *             values.append( ('Number',nmb) )
  *             values.append( ('Type', fmt.type) )             # <<<<<<<<<<<<<<
@@ -6944,20 +6867,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(((PyObject *)__pyx_n_s__Type));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__Type));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Type));
     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
-    __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_values), __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_7 = PyList_Append(__pyx_v_values, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":411
+  /* "cvcf.pyx":411
  *             values.append( ('Number',nmb) )
  *             values.append( ('Type', fmt.type) )
  *         values.append( ('Description', '"' + fmt.description + '"') )             # <<<<<<<<<<<<<<
@@ -6969,24 +6892,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   }
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__description); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_19), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_34), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_34)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Description));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Description));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Description));
   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_values), __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_7 = PyList_Append(__pyx_v_values, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":412
+  /* "cvcf.pyx":412
  *             values.append( ('Type', fmt.type) )
  *         values.append( ('Description', '"' + fmt.description + '"') )
  *         if self._version == 33:             # <<<<<<<<<<<<<<
@@ -7002,7 +6925,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":413
+    /* "cvcf.pyx":413
  *         values.append( ('Description', '"' + fmt.description + '"') )
  *         if self._version == 33:
  *             format = ",".join([v for k,v in values])             # <<<<<<<<<<<<<<
@@ -7013,11 +6936,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    if (likely(((PyObject *)__pyx_v_values) != Py_None)) {
-      __pyx_t_8 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_6);
-    } else {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_v_values == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
+    __pyx_t_8 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_6);
     for (;;) {
       if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
       __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++;
@@ -7053,15 +6975,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     }
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_v_format);
     __pyx_v_format = __pyx_t_1;
     __pyx_t_1 = 0;
@@ -7069,7 +6991,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":415
+    /* "cvcf.pyx":415
  *             format = ",".join([v for k,v in values])
  *         else:
  *             format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">"             # <<<<<<<<<<<<<<
@@ -7080,11 +7002,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    if (likely(((PyObject *)__pyx_v_values) != Py_None)) {
-      __pyx_t_8 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_2);
-    } else {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_v_values == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
+    __pyx_t_8 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_2);
     for (;;) {
       if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++;
@@ -7117,34 +7038,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
         __pyx_t_10 = 0;
       }
       __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
       __Pyx_INCREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_k);
       __Pyx_GIVEREF(__pyx_v_k);
       __Pyx_INCREF(__pyx_v_v);
       PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_v);
       __Pyx_GIVEREF(__pyx_v_v);
-      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       if (unlikely(PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(((PyObject *)__pyx_t_6));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_16), __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_27), __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_format);
@@ -7153,7 +7074,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":416
+  /* "cvcf.pyx":416
  *         else:
  *             format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">"
  *         return format             # <<<<<<<<<<<<<<
@@ -7188,7 +7109,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":418
+/* "cvcf.pyx":418
  *         return format
  * 
  *     def get_expected(self, format, formatdict, alt):             # <<<<<<<<<<<<<<
@@ -7196,9 +7117,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_format(PyObject *__pyx_self, PyObjec
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_get_expected = {__Pyx_NAMESTR("get_expected"), (PyCFunction)__pyx_pf_4cvcf_3VCF_get_expected, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_4get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_4get_expected = {__Pyx_NAMESTR("get_expected"), (PyCFunction)__pyx_pf_4cvcf_3VCF_4get_expected, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_4get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_formatdict = 0;
@@ -7274,7 +7195,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_fmt = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":419
+  /* "cvcf.pyx":419
  * 
  *     def get_expected(self, format, formatdict, alt):
  *         fmt = formatdict[format]             # <<<<<<<<<<<<<<
@@ -7287,7 +7208,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   __pyx_v_fmt = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":420
+  /* "cvcf.pyx":420
  *     def get_expected(self, format, formatdict, alt):
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1             # <<<<<<<<<<<<<<
@@ -7313,7 +7234,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":421
+  /* "cvcf.pyx":421
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  *         if fmt.numbertype == self.NT_NUMBER: return fmt.number             # <<<<<<<<<<<<<<
@@ -7341,7 +7262,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":422
+  /* "cvcf.pyx":422
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  *         if fmt.numbertype == self.NT_NUMBER: return fmt.number
  *         if fmt.numbertype == self.NT_ALLELES: return len(alt)+1             # <<<<<<<<<<<<<<
@@ -7370,7 +7291,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":423
+  /* "cvcf.pyx":423
  *         if fmt.numbertype == self.NT_NUMBER: return fmt.number
  *         if fmt.numbertype == self.NT_ALLELES: return len(alt)+1
  *         if fmt.numbertype == self.NT_NR_ALLELES: return len(alt)             # <<<<<<<<<<<<<<
@@ -7399,7 +7320,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":424
+  /* "cvcf.pyx":424
  *         if fmt.numbertype == self.NT_ALLELES: return len(alt)+1
  *         if fmt.numbertype == self.NT_NR_ALLELES: return len(alt)
  *         if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2             # <<<<<<<<<<<<<<
@@ -7429,7 +7350,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   }
   __pyx_L10:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":425
+  /* "cvcf.pyx":425
  *         if fmt.numbertype == self.NT_NR_ALLELES: return len(alt)
  *         if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2
  *         if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1)             # <<<<<<<<<<<<<<
@@ -7459,7 +7380,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   }
   __pyx_L11:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":426
+  /* "cvcf.pyx":426
  *         if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2
  *         if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1)
  *         return 0             # <<<<<<<<<<<<<<
@@ -7486,7 +7407,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":429
+/* "cvcf.pyx":429
  * 
  * 
  *     def _add_definition(self, formatdict, key, data, line ):             # <<<<<<<<<<<<<<
@@ -7494,9 +7415,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_get_expected(PyObject *__pyx_self, PyObject
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF__add_definition = {__Pyx_NAMESTR("_add_definition"), (PyCFunction)__pyx_pf_4cvcf_3VCF__add_definition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_5_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_5_add_definition = {__Pyx_NAMESTR("_add_definition"), (PyCFunction)__pyx_pf_4cvcf_3VCF_5_add_definition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_5_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_formatdict = 0;
   PyObject *__pyx_v_key = 0;
@@ -7579,7 +7500,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __pyx_L4_argument_unpacking_done:;
   __Pyx_INCREF(__pyx_v_data);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":430
+  /* "cvcf.pyx":430
  * 
  *     def _add_definition(self, formatdict, key, data, line ):
  *         if key in formatdict: return             # <<<<<<<<<<<<<<
@@ -7595,7 +7516,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":431
+  /* "cvcf.pyx":431
  *     def _add_definition(self, formatdict, key, data, line ):
  *         if key in formatdict: return
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)             # <<<<<<<<<<<<<<
@@ -7607,7 +7528,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_UNKNOWN_KEY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(__pyx_v_line);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line);
   __Pyx_GIVEREF(__pyx_v_line);
@@ -7617,13 +7538,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_key);
   __Pyx_GIVEREF(__pyx_v_key);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":432
+  /* "cvcf.pyx":432
  *         if key in formatdict: return
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  *         if data == None:             # <<<<<<<<<<<<<<
@@ -7636,7 +7557,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":433
+    /* "cvcf.pyx":433
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  *         if data == None:
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")             # <<<<<<<<<<<<<<
@@ -7648,7 +7569,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
     __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_key);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
     __Pyx_GIVEREF(__pyx_v_key);
@@ -7660,21 +7581,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
     __Pyx_INCREF(((PyObject *)__pyx_n_s__Flag));
     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__Flag));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Flag));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
-    PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_35));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
+    PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_63));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+    PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_s_9));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
     __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":434
+    /* "cvcf.pyx":434
  *         if data == None:
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
  *             return             # <<<<<<<<<<<<<<
@@ -7688,7 +7609,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":435
+  /* "cvcf.pyx":435
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
  *             return
  *         if data == []: data = [""]             # unsure what type -- say string             # <<<<<<<<<<<<<<
@@ -7715,7 +7636,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   }
   __pyx_L8:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":436
+  /* "cvcf.pyx":436
  *             return
  *         if data == []: data = [""]             # unsure what type -- say string
  *         if type(data[0]) == type(0.0):             # <<<<<<<<<<<<<<
@@ -7734,7 +7655,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":437
+    /* "cvcf.pyx":437
  *         if data == []: data = [""]             # unsure what type -- say string
  *         if type(data[0]) == type(0.0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)             # <<<<<<<<<<<<<<
@@ -7746,7 +7667,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
     __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_key);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
     __Pyx_GIVEREF(__pyx_v_key);
@@ -7758,21 +7679,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
     __Pyx_INCREF(((PyObject *)__pyx_n_s__Float));
     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__Float));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Float));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
-    PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_35));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
+    PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_63));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
     __Pyx_INCREF(Py_None);
     PyTuple_SET_ITEM(__pyx_t_2, 5, Py_None);
     __Pyx_GIVEREF(Py_None);
     __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":438
+    /* "cvcf.pyx":438
  *         if type(data[0]) == type(0.0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)
  *             return             # <<<<<<<<<<<<<<
@@ -7786,7 +7707,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":439
+  /* "cvcf.pyx":439
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)
  *             return
  *         if type(data[0]) == type(0):             # <<<<<<<<<<<<<<
@@ -7802,7 +7723,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_1) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":440
+    /* "cvcf.pyx":440
  *             return
  *         if type(data[0]) == type(0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)             # <<<<<<<<<<<<<<
@@ -7814,7 +7735,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
     __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(__pyx_v_key);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
     __Pyx_GIVEREF(__pyx_v_key);
@@ -7826,21 +7747,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
     __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer));
     PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__Integer));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
-    PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_kp_s_35));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
+    PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_kp_s_63));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
     __Pyx_INCREF(Py_None);
     PyTuple_SET_ITEM(__pyx_t_3, 5, Py_None);
     __Pyx_GIVEREF(Py_None);
     __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":441
+    /* "cvcf.pyx":441
  *         if type(data[0]) == type(0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)
  *             return             # <<<<<<<<<<<<<<
@@ -7854,7 +7775,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   }
   __pyx_L10:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":442
+  /* "cvcf.pyx":442
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)
  *             return
  *         formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".")             # <<<<<<<<<<<<<<
@@ -7866,7 +7787,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_key);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
   __Pyx_GIVEREF(__pyx_v_key);
@@ -7878,17 +7799,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   __Pyx_INCREF(((PyObject *)__pyx_n_s__String));
   PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__String));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__String));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
-  PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_35));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-  PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_s_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_63));
+  PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_63));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+  PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_s_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
@@ -7907,7 +7828,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":446
+/* "cvcf.pyx":446
  * 
  *     # todo: trim trailing missing values
  *     def format_formatdata( self, data, format, key=True, value=True, separator=":" ):             # <<<<<<<<<<<<<<
@@ -7915,9 +7836,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF__add_definition(PyObject *__pyx_self, PyObj
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_format_formatdata = {__Pyx_NAMESTR("format_formatdata"), (PyCFunction)__pyx_pf_4cvcf_3VCF_format_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_6format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_6format_formatdata = {__Pyx_NAMESTR("format_formatdata"), (PyCFunction)__pyx_pf_4cvcf_3VCF_6format_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_6format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_data = 0;
   PyObject *__pyx_v_format = 0;
@@ -7949,9 +7870,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[6] = {0,0,0,0,0,0};
-    values[3] = __pyx_k_36;
-    values[4] = __pyx_k_37;
-    values[5] = ((PyObject *)__pyx_kp_s_3);
+    values[3] = __pyx_k_64;
+    values[4] = __pyx_k_65;
+    values[5] = ((PyObject *)__pyx_kp_s_4);
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
       case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
@@ -8005,9 +7926,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_v_value = values[4];
     __pyx_v_separator = values[5];
   } else {
-    __pyx_v_key = __pyx_k_36;
-    __pyx_v_value = __pyx_k_37;
-    __pyx_v_separator = ((PyObject *)__pyx_kp_s_3);
+    __pyx_v_key = __pyx_k_64;
+    __pyx_v_value = __pyx_k_65;
+    __pyx_v_separator = ((PyObject *)__pyx_kp_s_4);
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  6:
       __pyx_v_separator = PyTuple_GET_ITEM(__pyx_args, 5);
@@ -8032,15 +7953,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   return NULL;
   __pyx_L4_argument_unpacking_done:;
   __Pyx_INCREF(__pyx_v_data);
-  __pyx_v_output = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
-  __pyx_v_sdata = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
-  __pyx_v_d = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_output = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_sdata = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_last = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":447
+  /* "cvcf.pyx":447
  *     # todo: trim trailing missing values
  *     def format_formatdata( self, data, format, key=True, value=True, separator=":" ):
  *         output, sdata = [], []             # <<<<<<<<<<<<<<
@@ -8058,7 +7979,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   __pyx_v_sdata = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":448
+  /* "cvcf.pyx":448
  *     def format_formatdata( self, data, format, key=True, value=True, separator=":" ):
  *         output, sdata = [], []
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values             # <<<<<<<<<<<<<<
@@ -8074,7 +7995,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":449
+    /* "cvcf.pyx":449
  *         output, sdata = [], []
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  *             d = {}             # <<<<<<<<<<<<<<
@@ -8087,7 +8008,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_v_d = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":450
+    /* "cvcf.pyx":450
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  *             d = {}
  *             for k in data: d[k] = []             # <<<<<<<<<<<<<<
@@ -8125,7 +8046,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":451
+    /* "cvcf.pyx":451
  *             d = {}
  *             for k in data: d[k] = []
  *             data = d             # <<<<<<<<<<<<<<
@@ -8139,7 +8060,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":453
+  /* "cvcf.pyx":453
  *             data = d
  *         # convert missing values; and silently add definitions if required
  *         for k in data:             # <<<<<<<<<<<<<<
@@ -8171,7 +8092,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_v_k = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":454
+    /* "cvcf.pyx":454
  *         # convert missing values; and silently add definitions if required
  *         for k in data:
  *             self._add_definition( format, k, data[k], "(output)" )             # <<<<<<<<<<<<<<
@@ -8183,7 +8104,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_t_5 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_format);
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_format);
     __Pyx_GIVEREF(__pyx_v_format);
@@ -8192,17 +8113,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __Pyx_GIVEREF(__pyx_v_k);
     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
-    PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_38));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
+    PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_66));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":455
+    /* "cvcf.pyx":455
  *         for k in data:
  *             self._add_definition( format, k, data[k], "(output)" )
  *             for idx,v in enumerate(data[k]):             # <<<<<<<<<<<<<<
@@ -8247,7 +8168,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
       __pyx_t_5 = __pyx_t_6;
       __pyx_t_6 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":456
+      /* "cvcf.pyx":456
  *             self._add_definition( format, k, data[k], "(output)" )
  *             for idx,v in enumerate(data[k]):
  *                 if v == format[k].missingvalue: data[k][idx] = "."             # <<<<<<<<<<<<<<
@@ -8267,7 +8188,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
       if (__pyx_t_3) {
         __pyx_t_6 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (PyObject_SetItem(__pyx_t_6, __pyx_v_idx, ((PyObject *)__pyx_kp_s_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (PyObject_SetItem(__pyx_t_6, __pyx_v_idx, ((PyObject *)__pyx_kp_s_9)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L13;
       }
@@ -8278,7 +8199,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":458
+  /* "cvcf.pyx":458
  *                 if v == format[k].missingvalue: data[k][idx] = "."
  *         # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string
  *         for k in data:             # <<<<<<<<<<<<<<
@@ -8310,7 +8231,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_v_k = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":459
+    /* "cvcf.pyx":459
  *         # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string
  *         for k in data:
  *             if k != 'GT': sdata.append( (k,data[k]) )             # <<<<<<<<<<<<<<
@@ -8328,22 +8249,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
       __pyx_t_5 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k);
       __Pyx_GIVEREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
       __Pyx_GIVEREF(__pyx_t_5);
       __pyx_t_5 = 0;
-      __pyx_t_9 = PyList_Append(((PyObject *)__pyx_v_sdata), __pyx_t_2); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_9 = PyList_Append(__pyx_v_sdata, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       goto __pyx_L16;
     }
     __pyx_L16:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":460
+  /* "cvcf.pyx":460
  *         for k in data:
  *             if k != 'GT': sdata.append( (k,data[k]) )
  *         sdata.sort()             # <<<<<<<<<<<<<<
@@ -8355,7 +8276,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   }
   __pyx_t_9 = PyList_Sort(((PyObject *)__pyx_v_sdata)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":461
+  /* "cvcf.pyx":461
  *             if k != 'GT': sdata.append( (k,data[k]) )
  *         sdata.sort()
  *         if 'GT' in data:             # <<<<<<<<<<<<<<
@@ -8365,7 +8286,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   __pyx_t_3 = ((PySequence_Contains(__pyx_v_data, ((PyObject *)__pyx_n_s__GT)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":462
+    /* "cvcf.pyx":462
  *         sdata.sort()
  *         if 'GT' in data:
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata             # <<<<<<<<<<<<<<
@@ -8377,18 +8298,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__GT)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_1 = 0;
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_map, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_INCREF(((PyObject *)__pyx_n_s__GT));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__GT));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GT));
@@ -8397,8 +8318,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_t_2 = 0;
     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
+    PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
     __pyx_t_5 = 0;
     __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_sdata)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
@@ -8410,18 +8331,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   }
   __pyx_L17:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":463
+  /* "cvcf.pyx":463
  *         if 'GT' in data:
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
  *         for k,v in sdata:             # <<<<<<<<<<<<<<
  *             if v == []: v = None
  *             if key and value:
  */
-  if (likely(((PyObject *)__pyx_v_sdata) != Py_None)) {
-    __pyx_t_4 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_sdata); __Pyx_INCREF(__pyx_t_5);
-  } else {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__pyx_v_sdata == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
+  __pyx_t_4 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_sdata); __Pyx_INCREF(__pyx_t_5);
   for (;;) {
     if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
     __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
@@ -8454,7 +8374,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
       __pyx_t_6 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":464
+    /* "cvcf.pyx":464
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
  *         for k,v in sdata:
  *             if v == []: v = None             # <<<<<<<<<<<<<<
@@ -8476,7 +8396,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     }
     __pyx_L20:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":465
+    /* "cvcf.pyx":465
  *         for k,v in sdata:
  *             if v == []: v = None
  *             if key and value:             # <<<<<<<<<<<<<<
@@ -8492,7 +8412,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     }
     if (__pyx_t_11) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":466
+      /* "cvcf.pyx":466
  *             if v == []: v = None
  *             if key and value:
  *                 if v != None: output.append( k+"="+','.join(map(str,v)) )             # <<<<<<<<<<<<<<
@@ -8507,41 +8427,41 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
         if (unlikely(__pyx_v_output == Py_None)) {
           PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_6 = PyNumber_Add(__pyx_v_k, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyNumber_Add(__pyx_v_k, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-        __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+        __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+        __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
         __Pyx_INCREF(__pyx_v_v);
         PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v);
         __Pyx_GIVEREF(__pyx_v_v);
-        __pyx_t_8 = PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
         __Pyx_GIVEREF(__pyx_t_8);
         __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_9 = PyList_Append(((PyObject *)__pyx_v_output), __pyx_t_1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_t_1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L22;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":467
+        /* "cvcf.pyx":467
  *             if key and value:
  *                 if v != None: output.append( k+"="+','.join(map(str,v)) )
  *                 else: output.append( k )             # <<<<<<<<<<<<<<
@@ -8551,13 +8471,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
         if (unlikely(__pyx_v_output == Py_None)) {
           PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_9 = PyList_Append(((PyObject *)__pyx_v_output), __pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L22:;
       goto __pyx_L21;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":468
+    /* "cvcf.pyx":468
  *                 if v != None: output.append( k+"="+','.join(map(str,v)) )
  *                 else: output.append( k )
  *             elif key: output.append(k)             # <<<<<<<<<<<<<<
@@ -8569,11 +8489,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
       if (unlikely(__pyx_v_output == Py_None)) {
         PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
-      __pyx_t_9 = PyList_Append(((PyObject *)__pyx_v_output), __pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L21;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":469
+    /* "cvcf.pyx":469
  *                 else: output.append( k )
  *             elif key: output.append(k)
  *             elif value:             # <<<<<<<<<<<<<<
@@ -8583,7 +8503,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_11) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":470
+      /* "cvcf.pyx":470
  *             elif key: output.append(k)
  *             elif value:
  *                 if v != None: output.append( ','.join(map(str,v)) )             # <<<<<<<<<<<<<<
@@ -8601,32 +8521,32 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
         __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-        __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+        __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+        __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
         __Pyx_INCREF(__pyx_v_v);
         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_v);
         __Pyx_GIVEREF(__pyx_v_v);
-        __pyx_t_6 = PyObject_Call(__pyx_builtin_map, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
         __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
         __pyx_t_6 = 0;
-        __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_9 = PyList_Append(((PyObject *)__pyx_v_output), __pyx_t_6); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+        __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_t_6); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L23;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":471
+        /* "cvcf.pyx":471
  *             elif value:
  *                 if v != None: output.append( ','.join(map(str,v)) )
  *                 else: output.append( "." )                    # should not happen             # <<<<<<<<<<<<<<
@@ -8636,7 +8556,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
         if (unlikely(__pyx_v_output == Py_None)) {
           PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
-        __pyx_t_9 = PyList_Append(((PyObject *)__pyx_v_output), ((PyObject *)__pyx_kp_s_6)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyList_Append(__pyx_v_output, ((PyObject *)__pyx_kp_s_9)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L23:;
       goto __pyx_L21;
@@ -8645,7 +8565,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   }
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":473
+  /* "cvcf.pyx":473
  *                 else: output.append( "." )                    # should not happen
  *         # snip off trailing missing data
  *         while len(output) > 1:             # <<<<<<<<<<<<<<
@@ -8660,7 +8580,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_t_11 = (__pyx_t_4 > 1);
     if (!__pyx_t_11) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":474
+    /* "cvcf.pyx":474
  *         # snip off trailing missing data
  *         while len(output) > 1:
  *             last = output[-1].replace(',','').replace('.','')             # <<<<<<<<<<<<<<
@@ -8672,38 +8592,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__replace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
-    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_kp_s_1));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
-    __pyx_t_8 = PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__replace); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
-    PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_1));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
-    __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__replace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_v_last);
-    __pyx_v_last = __pyx_t_6;
-    __pyx_t_6 = 0;
+    __pyx_v_last = __pyx_t_5;
+    __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":475
+    /* "cvcf.pyx":475
  *         while len(output) > 1:
  *             last = output[-1].replace(',','').replace('.','')
  *             if len(last)>0: break             # <<<<<<<<<<<<<<
@@ -8718,22 +8620,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
     }
     __pyx_L26:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":476
+    /* "cvcf.pyx":476
  *             last = output[-1].replace(',','').replace('.','')
  *             if len(last)>0: break
  *             output = output[:-1]             # <<<<<<<<<<<<<<
  *         return separator.join(output)
  * 
  */
-    __pyx_t_6 = PySequence_GetSlice(((PyObject *)__pyx_v_output), 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_output), 0, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_DECREF(((PyObject *)__pyx_v_output));
-    __pyx_v_output = __pyx_t_6;
-    __pyx_t_6 = 0;
+    __pyx_v_output = __pyx_t_5;
+    __pyx_t_5 = 0;
   }
   __pyx_L25_break:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":477
+  /* "cvcf.pyx":477
  *             if len(last)>0: break
  *             output = output[:-1]
  *         return separator.join(output)             # <<<<<<<<<<<<<<
@@ -8741,19 +8643,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_separator, __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_separator, __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   __Pyx_INCREF(((PyObject *)__pyx_v_output));
-  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_output));
+  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_output));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_output));
-  __pyx_t_5 = PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_r = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  __pyx_r = __pyx_t_8;
+  __pyx_t_8 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8780,7 +8682,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":480
+/* "cvcf.pyx":480
  * 
  * 
  *     def enter_default_format(self):             # <<<<<<<<<<<<<<
@@ -8788,9 +8690,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_format_formatdata(PyObject *__pyx_self, PyO
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_enter_default_format = {__Pyx_NAMESTR("enter_default_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_enter_default_format, METH_O, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_4cvcf_3VCF_7enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_7enter_default_format = {__Pyx_NAMESTR("enter_default_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_7enter_default_format, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_7enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_v_f;
   PyObject *__pyx_r = NULL;
   Py_ssize_t __pyx_t_1;
@@ -8806,7 +8708,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_self = __pyx_self;
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":481
+  /* "cvcf.pyx":481
  * 
  *     def enter_default_format(self):
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),             # <<<<<<<<<<<<<<
@@ -8818,7 +8720,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__GT));
   PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__GT));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GT));
@@ -8833,16 +8735,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Genotype));
   PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_n_s__Genotype));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Genotype));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-  PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_kp_s_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+  PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_kp_s_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":482
+  /* "cvcf.pyx":482
  *     def enter_default_format(self):
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),             # <<<<<<<<<<<<<<
@@ -8854,7 +8756,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__GQ));
   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__GQ));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GQ));
@@ -8866,19 +8768,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer));
   PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_n_s__Integer));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_39));
-  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_kp_s_39));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_39));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_69));
+  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_kp_s_69));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_69));
   __Pyx_INCREF(__pyx_int_neg_1);
   PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_int_neg_1);
   __Pyx_GIVEREF(__pyx_int_neg_1);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":483
+  /* "cvcf.pyx":483
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),             # <<<<<<<<<<<<<<
@@ -8890,7 +8792,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__DP));
   PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s__DP));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DP));
@@ -8902,19 +8804,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer));
   PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_n_s__Integer));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
-  PyTuple_SET_ITEM(__pyx_t_6, 4, ((PyObject *)__pyx_kp_s_40));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_70));
+  PyTuple_SET_ITEM(__pyx_t_6, 4, ((PyObject *)__pyx_kp_s_70));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_70));
   __Pyx_INCREF(__pyx_int_neg_1);
   PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_neg_1);
   __Pyx_GIVEREF(__pyx_int_neg_1);
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":484
+  /* "cvcf.pyx":484
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  *                   FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid             # <<<<<<<<<<<<<<
@@ -8926,7 +8828,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__HQ));
   PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__HQ));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HQ));
@@ -8938,19 +8840,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer));
   PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s__Integer));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
-  PyTuple_SET_ITEM(__pyx_t_7, 4, ((PyObject *)__pyx_kp_s_41));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_71));
+  PyTuple_SET_ITEM(__pyx_t_7, 4, ((PyObject *)__pyx_kp_s_71));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71));
   __Pyx_INCREF(__pyx_int_neg_1);
   PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_int_neg_1);
   __Pyx_GIVEREF(__pyx_int_neg_1);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":485
+  /* "cvcf.pyx":485
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  *                   FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]:             # <<<<<<<<<<<<<<
@@ -8962,7 +8864,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FT));
   PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_n_s__FT));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FT));
@@ -8974,17 +8876,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __Pyx_INCREF(((PyObject *)__pyx_n_s__String));
   PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_n_s__String));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__String));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
-  PyTuple_SET_ITEM(__pyx_t_8, 4, ((PyObject *)__pyx_kp_s_42));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-  PyTuple_SET_ITEM(__pyx_t_8, 5, ((PyObject *)__pyx_kp_s_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_72));
+  PyTuple_SET_ITEM(__pyx_t_8, 4, ((PyObject *)__pyx_kp_s_72));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_72));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+  PyTuple_SET_ITEM(__pyx_t_8, 5, ((PyObject *)__pyx_kp_s_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
   __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
   __pyx_t_8 = PyList_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_8));
   PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
@@ -9002,15 +8904,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   __pyx_t_4 = 0;
   __pyx_t_5 = 0;
   __pyx_t_6 = 0;
-  if (likely(((PyObject *)__pyx_t_8) != Py_None)) {
-    __pyx_t_1 = 0; __pyx_t_6 = ((PyObject *)__pyx_t_8); __Pyx_INCREF(__pyx_t_6);
-  } else {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
+  __pyx_t_1 = 0; __pyx_t_6 = ((PyObject *)__pyx_t_8); __Pyx_INCREF(__pyx_t_6);
   __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
   for (;;) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":481
+    /* "cvcf.pyx":481
  * 
  *     def enter_default_format(self):
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),             # <<<<<<<<<<<<<<
@@ -9023,7 +8921,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
     __pyx_v_f = __pyx_t_8;
     __pyx_t_8 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":486
+    /* "cvcf.pyx":486
  *                   FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]:
  *             if f.id not in self._format:             # <<<<<<<<<<<<<<
@@ -9039,7 +8937,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_9) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":487
+      /* "cvcf.pyx":487
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]:
  *             if f.id not in self._format:
  *                 self._format[f.id] = f             # <<<<<<<<<<<<<<
@@ -9078,7 +8976,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":489
+/* "cvcf.pyx":489
  *                 self._format[f.id] = f
  * 
  *     def parse_header( self, line ):             # <<<<<<<<<<<<<<
@@ -9086,9 +8984,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_enter_default_format(PyObject *__pyx_self,
  *         elts = line[2:].split('=')
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_parse_header = {__Pyx_NAMESTR("parse_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_8parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_8parse_header = {__Pyx_NAMESTR("parse_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_8parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_8parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_elts;
@@ -9098,8 +8996,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
   __Pyx_RefNannySetupContext("parse_header");
@@ -9149,134 +9047,122 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":490
+  /* "cvcf.pyx":490
  * 
  *     def parse_header( self, line ):
  *         assert line.startswith('##')             # <<<<<<<<<<<<<<
  *         elts = line[2:].split('=')
  *         key = elts[0].strip()
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_43));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (unlikely(!__pyx_t_4)) {
+  if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":491
+  /* "cvcf.pyx":491
  *     def parse_header( self, line ):
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')             # <<<<<<<<<<<<<<
  *         key = elts[0].strip()
  *         value = '='.join(elts[1:]).strip()
  */
-  __pyx_t_3 = PySequence_GetSlice(__pyx_v_line, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_line, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_v_elts);
-  __pyx_v_elts = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_elts = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":492
+  /* "cvcf.pyx":492
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')
  *         key = elts[0].strip()             # <<<<<<<<<<<<<<
  *         value = '='.join(elts[1:]).strip()
  *         if key == "fileformat":
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_v_key);
-  __pyx_v_key = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_key = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":493
+  /* "cvcf.pyx":493
  *         elts = line[2:].split('=')
  *         key = elts[0].strip()
  *         value = '='.join(elts[1:]).strip()             # <<<<<<<<<<<<<<
  *         if key == "fileformat":
  *             if value == "VCFv3.3":
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_8), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PySequence_GetSlice(__pyx_v_elts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_elts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_v_value);
-  __pyx_v_value = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_value = __pyx_t_1;
+  __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":494
+  /* "cvcf.pyx":494
  *         key = elts[0].strip()
  *         value = '='.join(elts[1:]).strip()
  *         if key == "fileformat":             # <<<<<<<<<<<<<<
  *             if value == "VCFv3.3":
  *                 self._version = 33
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_4) {
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":495
+    /* "cvcf.pyx":495
  *         value = '='.join(elts[1:]).strip()
  *         if key == "fileformat":
  *             if value == "VCFv3.3":             # <<<<<<<<<<<<<<
  *                 self._version = 33
  *             elif value == "VCFv4.0":
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_44), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (__pyx_t_4) {
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_76), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":496
+      /* "cvcf.pyx":496
  *         if key == "fileformat":
  *             if value == "VCFv3.3":
  *                 self._version = 33             # <<<<<<<<<<<<<<
@@ -9287,20 +9173,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":497
+    /* "cvcf.pyx":497
  *             if value == "VCFv3.3":
  *                 self._version = 33
  *             elif value == "VCFv4.0":             # <<<<<<<<<<<<<<
  *                 self._version = 40
  *             elif value == "VCFv4.1":
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_45), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (__pyx_t_4) {
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_77), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":498
+      /* "cvcf.pyx":498
  *                 self._version = 33
  *             elif value == "VCFv4.0":
  *                 self._version = 40             # <<<<<<<<<<<<<<
@@ -9311,20 +9197,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
       goto __pyx_L7;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":499
+    /* "cvcf.pyx":499
  *             elif value == "VCFv4.0":
  *                 self._version = 40
  *             elif value == "VCFv4.1":             # <<<<<<<<<<<<<<
  *                 # AH - for testing
  *                 self._version = 40
  */
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_46), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (__pyx_t_4) {
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_78), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (__pyx_t_3) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":501
+      /* "cvcf.pyx":501
  *             elif value == "VCFv4.1":
  *                 # AH - for testing
  *                 self._version = 40             # <<<<<<<<<<<<<<
@@ -9336,136 +9222,136 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":503
+      /* "cvcf.pyx":503
  *                 self._version = 40
  *             else:
  *                 self.error(line,self.UNKNOWN_FORMAT_STRING)             # <<<<<<<<<<<<<<
  *         elif key == "INFO":
  *             f = self.parse_format(line, value)
  */
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_47); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_79); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
+      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     }
     __pyx_L7:;
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":504
+  /* "cvcf.pyx":504
  *             else:
  *                 self.error(line,self.UNKNOWN_FORMAT_STRING)
  *         elif key == "INFO":             # <<<<<<<<<<<<<<
  *             f = self.parse_format(line, value)
  *             self._info[ f.id ] = f
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__pyx_t_4) {
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":505
+    /* "cvcf.pyx":505
  *                 self.error(line,self.UNKNOWN_FORMAT_STRING)
  *         elif key == "INFO":
  *             f = self.parse_format(line, value)             # <<<<<<<<<<<<<<
  *             self._info[ f.id ] = f
  *         elif key == "FILTER":
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
     __Pyx_INCREF(__pyx_v_value);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
+    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_f = __pyx_t_1;
+    __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":506
+    /* "cvcf.pyx":506
  *         elif key == "INFO":
  *             f = self.parse_format(line, value)
  *             self._info[ f.id ] = f             # <<<<<<<<<<<<<<
  *         elif key == "FILTER":
  *             f = self.parse_format(line, value, filter=True)
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    if (PyObject_SetItem(__pyx_t_3, __pyx_t_1, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":507
+  /* "cvcf.pyx":507
  *             f = self.parse_format(line, value)
  *             self._info[ f.id ] = f
  *         elif key == "FILTER":             # <<<<<<<<<<<<<<
  *             f = self.parse_format(line, value, filter=True)
  *             self._filter[ f.id ] = f
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_4) {
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":508
+    /* "cvcf.pyx":508
  *             self._info[ f.id ] = f
  *         elif key == "FILTER":
  *             f = self.parse_format(line, value, filter=True)             # <<<<<<<<<<<<<<
  *             self._filter[ f.id ] = f
  *         elif key == "FORMAT":
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
     __Pyx_INCREF(__pyx_v_value);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__filter), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__filter), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_v_f);
     __pyx_v_f = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":509
+    /* "cvcf.pyx":509
  *         elif key == "FILTER":
  *             f = self.parse_format(line, value, filter=True)
  *             self._filter[ f.id ] = f             # <<<<<<<<<<<<<<
@@ -9474,71 +9360,71 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
  */
     __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyObject_SetItem(__pyx_t_5, __pyx_t_2, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    if (PyObject_SetItem(__pyx_t_5, __pyx_t_4, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     goto __pyx_L6;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":510
+  /* "cvcf.pyx":510
  *             f = self.parse_format(line, value, filter=True)
  *             self._filter[ f.id ] = f
  *         elif key == "FORMAT":             # <<<<<<<<<<<<<<
  *             f = self.parse_format(line, value)
  *             self._format[ f.id ] = f
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__pyx_t_4) {
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":511
+    /* "cvcf.pyx":511
  *             self._filter[ f.id ] = f
  *         elif key == "FORMAT":
  *             f = self.parse_format(line, value)             # <<<<<<<<<<<<<<
  *             self._format[ f.id ] = f
  *         else:
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_f = __pyx_t_1;
+    __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":512
+    /* "cvcf.pyx":512
  *         elif key == "FORMAT":
  *             f = self.parse_format(line, value)
  *             self._format[ f.id ] = f             # <<<<<<<<<<<<<<
  *         else:
  *             # keep other keys in the header field
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (PyObject_SetItem(__pyx_t_3, __pyx_t_5, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (PyObject_SetItem(__pyx_t_1, __pyx_t_5, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     goto __pyx_L6;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":515
+    /* "cvcf.pyx":515
  *         else:
  *             # keep other keys in the header field
  *             self._header.append( (key,value) )             # <<<<<<<<<<<<<<
@@ -9547,19 +9433,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
  */
     __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_key);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
     __Pyx_GIVEREF(__pyx_v_key);
     __Pyx_INCREF(__pyx_v_value);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = __Pyx_PyObject_Append(__pyx_t_5, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
   __pyx_L6:;
 
@@ -9568,7 +9454,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_AddTraceback("cvcf.VCF.parse_header");
   __pyx_r = NULL;
@@ -9582,7 +9468,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":518
+/* "cvcf.pyx":518
  * 
  * 
  *     def write_header( self, stream ):             # <<<<<<<<<<<<<<
@@ -9590,9 +9476,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_header(PyObject *__pyx_self, PyObject
  *         for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_write_header = {__Pyx_NAMESTR("write_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_write_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_9write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_9write_header = {__Pyx_NAMESTR("write_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_9write_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_9write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_key;
@@ -9659,7 +9545,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   __pyx_v_label = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":519
+  /* "cvcf.pyx":519
  * 
  *     def write_header( self, stream ):
  *         stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))             # <<<<<<<<<<<<<<
@@ -9679,28 +9565,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_80), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":520
+  /* "cvcf.pyx":520
  *     def write_header( self, stream ):
  *         stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))
  *         for key,value in self._header: stream.write("##%s=%s\n" % (key,value))             # <<<<<<<<<<<<<<
@@ -9762,30 +9648,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
     __pyx_t_4 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(__pyx_v_key);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
     __Pyx_GIVEREF(__pyx_v_key);
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":521
+  /* "cvcf.pyx":521
  *         stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))
  *         for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
  *         for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]:             # <<<<<<<<<<<<<<
@@ -9795,7 +9681,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__INFO));
@@ -9805,7 +9691,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FILTER));
@@ -9815,7 +9701,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT));
@@ -9824,20 +9710,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   __pyx_t_2 = 0;
   __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
+  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+  PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_1 = 0;
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
-  if (likely(((PyObject *)__pyx_t_2) != Py_None)) {
-    __pyx_t_5 = 0; __pyx_t_4 = ((PyObject *)__pyx_t_2); __Pyx_INCREF(__pyx_t_4);
-  } else {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
+  __pyx_t_5 = 0; __pyx_t_4 = ((PyObject *)__pyx_t_2); __Pyx_INCREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   for (;;) {
     if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
@@ -9871,7 +9753,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
       __pyx_t_1 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":522
+    /* "cvcf.pyx":522
  *         for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
  *         for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]:
  *             for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER"))))             # <<<<<<<<<<<<<<
@@ -9913,7 +9795,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
       __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
@@ -9923,31 +9805,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
       __Pyx_GOTREF(__pyx_t_9);
       if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__filter), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_INCREF(__pyx_v_label);
       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_label);
       __Pyx_GIVEREF(__pyx_v_label);
       PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
       __Pyx_GIVEREF(__pyx_t_9);
       __pyx_t_9 = 0;
-      __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
       __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -9977,7 +9859,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":525
+/* "cvcf.pyx":525
  * 
  * 
  *     def parse_heading( self, line ):             # <<<<<<<<<<<<<<
@@ -9985,9 +9867,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_header(PyObject *__pyx_self, PyObject
  *         assert not line.startswith('##')
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_parse_heading = {__Pyx_NAMESTR("parse_heading"), (PyCFunction)__pyx_pf_4cvcf_3VCF_parse_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_10parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_10parse_heading = {__Pyx_NAMESTR("parse_heading"), (PyCFunction)__pyx_pf_4cvcf_3VCF_10parse_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_10parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_headings;
@@ -9999,11 +9881,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
+  int __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
   int __pyx_t_6;
-  int __pyx_t_7;
+  PyObject *__pyx_t_7 = NULL;
   Py_ssize_t __pyx_t_8;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
@@ -10057,160 +9939,142 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
   __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_y = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":526
+  /* "cvcf.pyx":526
  * 
  *     def parse_heading( self, line ):
  *         assert line.startswith('#')             # <<<<<<<<<<<<<<
  *         assert not line.startswith('##')
  *         headings = line[1:].split('\t')
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_50));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (unlikely(!__pyx_t_4)) {
+  if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":527
+  /* "cvcf.pyx":527
  *     def parse_heading( self, line ):
  *         assert line.startswith('#')
  *         assert not line.startswith('##')             # <<<<<<<<<<<<<<
  *         headings = line[1:].split('\t')
  *         if len(headings)==1 and len(line[1:].split()) >= 9:
  */
-  #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_43));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!(!__pyx_t_4))) {
+  if (unlikely(!(!__pyx_t_3))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":528
+  /* "cvcf.pyx":528
  *         assert line.startswith('#')
  *         assert not line.startswith('##')
  *         headings = line[1:].split('\t')             # <<<<<<<<<<<<<<
  *         if len(headings)==1 and len(line[1:].split()) >= 9:
  *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
  */
-  __pyx_t_1 = PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_v_headings);
-  __pyx_v_headings = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_headings = __pyx_t_1;
+  __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":529
+  /* "cvcf.pyx":529
  *         assert not line.startswith('##')
  *         headings = line[1:].split('\t')
  *         if len(headings)==1 and len(line[1:].split()) >= 9:             # <<<<<<<<<<<<<<
  *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
  *             headings = line[1:].split()
  */
-  __pyx_t_5 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = (__pyx_t_5 == 1);
-  if (__pyx_t_4) {
-    __pyx_t_3 = PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = (__pyx_t_4 == 1);
+  if (__pyx_t_3) {
+    __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = (__pyx_t_5 >= 9);
-    __pyx_t_7 = __pyx_t_6;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_5 = (__pyx_t_4 >= 9);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_7 = __pyx_t_4;
+    __pyx_t_6 = __pyx_t_3;
   }
-  if (__pyx_t_7) {
+  if (__pyx_t_6) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":530
+    /* "cvcf.pyx":530
  *         headings = line[1:].split('\t')
  *         if len(headings)==1 and len(line[1:].split()) >= 9:
  *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)             # <<<<<<<<<<<<<<
  *             headings = line[1:].split()
  * 
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_52); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_87); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":531
+    /* "cvcf.pyx":531
  *         if len(headings)==1 and len(line[1:].split()) >= 9:
  *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
  *             headings = line[1:].split()             # <<<<<<<<<<<<<<
  * 
  *         for i,s in enumerate(self._required):
  */
-    __pyx_t_1 = PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_v_headings);
-    __pyx_v_headings = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __pyx_v_headings = __pyx_t_2;
+    __pyx_t_2 = 0;
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":533
+  /* "cvcf.pyx":533
  *             headings = line[1:].split()
  * 
  *         for i,s in enumerate(self._required):             # <<<<<<<<<<<<<<
@@ -10218,44 +10082,44 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
  *             if len(headings)<=i or headings[i] != s:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___required); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-    __pyx_t_5 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
+  __pyx_t_2 = __pyx_int_0;
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___required); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
+    __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_7; __Pyx_INCREF(__pyx_t_1);
   } else {
-    __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_3))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+    if (likely(PyList_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++;
     } else {
-      __pyx_t_2 = PyIter_Next(__pyx_t_3);
-      if (!__pyx_t_2) {
+      __pyx_t_7 = PyIter_Next(__pyx_t_1);
+      if (!__pyx_t_7) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_7);
     }
     __Pyx_DECREF(__pyx_v_s);
-    __pyx_v_s = __pyx_t_2;
-    __pyx_t_2 = 0;
-    __Pyx_INCREF(__pyx_t_1);
+    __pyx_v_s = __pyx_t_7;
+    __pyx_t_7 = 0;
+    __Pyx_INCREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_1;
-    __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_i = __pyx_t_2;
+    __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_2);
+    __pyx_t_2 = __pyx_t_7;
+    __pyx_t_7 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":535
+    /* "cvcf.pyx":535
  *         for i,s in enumerate(self._required):
  * 
  *             if len(headings)<=i or headings[i] != s:             # <<<<<<<<<<<<<<
@@ -10263,28 +10127,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
  *                 if len(headings) <= i:
  */
     __pyx_t_8 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (!__pyx_t_7) {
+    if (!__pyx_t_6) {
       __pyx_t_9 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, __pyx_v_s, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_9, __pyx_v_s, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_6 = __pyx_t_4;
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_5 = __pyx_t_3;
     } else {
-      __pyx_t_6 = __pyx_t_7;
+      __pyx_t_5 = __pyx_t_6;
     }
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":537
+      /* "cvcf.pyx":537
  *             if len(headings)<=i or headings[i] != s:
  * 
  *                 if len(headings) <= i:             # <<<<<<<<<<<<<<
@@ -10292,16 +10156,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
  *                 else:
  */
       __pyx_t_8 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      if (__pyx_t_6) {
+      if (__pyx_t_5) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":538
+        /* "cvcf.pyx":538
  * 
  *                 if len(headings) <= i:
  *                     err = "(%sth entry not found)" % (i+1)             # <<<<<<<<<<<<<<
@@ -10310,43 +10174,43 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
  */
         __pyx_t_9 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_88), __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_v_err);
-        __pyx_v_err = ((PyObject *)__pyx_t_2);
-        __pyx_t_2 = 0;
+        __pyx_v_err = ((PyObject *)__pyx_t_7);
+        __pyx_t_7 = 0;
         goto __pyx_L10;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":540
+        /* "cvcf.pyx":540
  *                     err = "(%sth entry not found)" % (i+1)
  *                 else:
  *                     err = "(found %s, expected %s)" % (headings[i],s)             # <<<<<<<<<<<<<<
  * 
  *                 #self.error(line,self.BADLY_FORMATTED_HEADING,err)
  */
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_7 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
+        __Pyx_GIVEREF(__pyx_t_7);
         __Pyx_INCREF(__pyx_v_s);
         PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_s);
         __Pyx_GIVEREF(__pyx_v_s);
-        __pyx_t_2 = 0;
-        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), __pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_7 = 0;
+        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_89), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_v_err);
-        __pyx_v_err = ((PyObject *)__pyx_t_2);
-        __pyx_t_2 = 0;
+        __pyx_v_err = ((PyObject *)__pyx_t_7);
+        __pyx_t_7 = 0;
       }
       __pyx_L10:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":545
+      /* "cvcf.pyx":545
  * 
  *                 # allow FORMAT column to be absent
  *                 if len(headings) == 8:             # <<<<<<<<<<<<<<
@@ -10354,36 +10218,36 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
  *                 else:
  */
       __pyx_t_8 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_6 = (__pyx_t_8 == 8);
-      if (__pyx_t_6) {
+      __pyx_t_5 = (__pyx_t_8 == 8);
+      if (__pyx_t_5) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":546
+        /* "cvcf.pyx":546
  *                 # allow FORMAT column to be absent
  *                 if len(headings) == 8:
  *                     headings.append("FORMAT")             # <<<<<<<<<<<<<<
  *                 else:
  *                     self.error(line,self.BADLY_FORMATTED_HEADING,err)
  */
-        __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_headings, ((PyObject *)__pyx_n_s__FORMAT)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_headings, ((PyObject *)__pyx_n_s__FORMAT)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         goto __pyx_L11;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":548
+        /* "cvcf.pyx":548
  *                     headings.append("FORMAT")
  *                 else:
  *                     self.error(line,self.BADLY_FORMATTED_HEADING,err)             # <<<<<<<<<<<<<<
  * 
  *         self._samples = headings[9:]
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_55); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_90); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
@@ -10393,10 +10257,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
         PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_err);
         __Pyx_GIVEREF(__pyx_v_err);
         __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       }
       __pyx_L11:;
@@ -10404,48 +10268,48 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
     }
     __pyx_L9:;
   }
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":550
+  /* "cvcf.pyx":550
  *                     self.error(line,self.BADLY_FORMATTED_HEADING,err)
  * 
  *         self._samples = headings[9:]             # <<<<<<<<<<<<<<
  *         self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] )
  * 
  */
-  __pyx_t_1 = PySequence_GetSlice(__pyx_v_headings, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_headings, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":551
+  /* "cvcf.pyx":551
  * 
  *         self._samples = headings[9:]
  *         self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] )             # <<<<<<<<<<<<<<
  * 
  *     def write_heading( self, stream ):
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_3 = __pyx_int_0;
+  __pyx_t_1 = __pyx_int_0;
   __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
-    __pyx_t_5 = 0; __pyx_t_10 = __pyx_t_9; __Pyx_INCREF(__pyx_t_10);
+    __pyx_t_4 = 0; __pyx_t_10 = __pyx_t_9; __Pyx_INCREF(__pyx_t_10);
   } else {
-    __pyx_t_5 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
   }
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   for (;;) {
     if (likely(PyList_CheckExact(__pyx_t_10))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_10)) break;
-      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
     } else if (likely(PyTuple_CheckExact(__pyx_t_10))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
-      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
     } else {
       __pyx_t_9 = PyIter_Next(__pyx_t_10);
       if (!__pyx_t_9) {
@@ -10457,47 +10321,47 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
     __Pyx_DECREF(__pyx_v_y);
     __pyx_v_y = __pyx_t_9;
     __pyx_t_9 = 0;
-    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_INCREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_x);
-    __pyx_v_x = __pyx_t_3;
-    __pyx_t_9 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_x = __pyx_t_1;
+    __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_3);
-    __pyx_t_3 = __pyx_t_9;
+    __Pyx_DECREF(__pyx_t_1);
+    __pyx_t_1 = __pyx_t_9;
     __pyx_t_9 = 0;
     __pyx_t_9 = PyNumber_Add(__pyx_v_x, __pyx_int_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     __Pyx_INCREF(__pyx_v_y);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y);
+    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_y);
     __Pyx_GIVEREF(__pyx_v_y);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
     __Pyx_GIVEREF(__pyx_t_9);
     __pyx_t_9 = 0;
-    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
   }
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_t_1));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyDict_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sample2column, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(((PyObject *)__pyx_t_2));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sample2column, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_AddTraceback("cvcf.VCF.parse_heading");
@@ -10514,7 +10378,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":553
+/* "cvcf.pyx":553
  *         self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] )
  * 
  *     def write_heading( self, stream ):             # <<<<<<<<<<<<<<
@@ -10522,9 +10386,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_heading(PyObject *__pyx_self, PyObjec
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_write_heading = {__Pyx_NAMESTR("write_heading"), (PyCFunction)__pyx_pf_4cvcf_3VCF_write_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_11write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_11write_heading = {__Pyx_NAMESTR("write_heading"), (PyCFunction)__pyx_pf_4cvcf_3VCF_11write_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_11write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_r = NULL;
@@ -10577,7 +10441,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObjec
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":554
+  /* "cvcf.pyx":554
  * 
  *     def write_heading( self, stream ):
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")             # <<<<<<<<<<<<<<
@@ -10586,7 +10450,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObjec
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_51), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_85), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___required); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -10597,29 +10461,29 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObjec
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_50), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_82), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_s_91)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -10638,7 +10502,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":556
+/* "cvcf.pyx":556
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")
  * 
  *     def convertGT(self, GTstring):             # <<<<<<<<<<<<<<
@@ -10646,9 +10510,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_heading(PyObject *__pyx_self, PyObjec
  *         try:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_convertGT = {__Pyx_NAMESTR("convertGT"), (PyCFunction)__pyx_pf_4cvcf_3VCF_convertGT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_12convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_12convertGT = {__Pyx_NAMESTR("convertGT"), (PyCFunction)__pyx_pf_4cvcf_3VCF_12convertGT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_12convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_GTstring = 0;
   PyObject *__pyx_v_gts;
@@ -10711,14 +10575,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_gts = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":557
+  /* "cvcf.pyx":557
  * 
  *     def convertGT(self, GTstring):
  *         if GTstring == ".": return ["."]             # <<<<<<<<<<<<<<
  *         try:
  *             gts = gtsRegEx.split(GTstring)
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -10726,9 +10590,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
     __Pyx_XDECREF(__pyx_r);
     __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-    PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_6));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+    PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_9));
+    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
     __pyx_r = ((PyObject *)__pyx_t_1);
     __pyx_t_1 = 0;
     goto __pyx_L0;
@@ -10736,7 +10600,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":558
+  /* "cvcf.pyx":558
  *     def convertGT(self, GTstring):
  *         if GTstring == ".": return ["."]
  *         try:             # <<<<<<<<<<<<<<
@@ -10751,7 +10615,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
     __Pyx_XGOTREF(__pyx_save_exc_tb);
     /*try:*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":559
+      /* "cvcf.pyx":559
  *         if GTstring == ".": return ["."]
  *         try:
  *             gts = gtsRegEx.split(GTstring)             # <<<<<<<<<<<<<<
@@ -10764,19 +10628,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_INCREF(__pyx_v_GTstring);
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_GTstring);
       __Pyx_GIVEREF(__pyx_v_GTstring);
-      __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_v_gts);
       __pyx_v_gts = __pyx_t_4;
       __pyx_t_4 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":560
+      /* "cvcf.pyx":560
  *         try:
  *             gts = gtsRegEx.split(GTstring)
  *             if len(gts) == 1: return [int(gts[0])]             # <<<<<<<<<<<<<<
@@ -10790,13 +10654,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
         __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
         __Pyx_GIVEREF(__pyx_t_4);
         __pyx_t_4 = 0;
-        __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
@@ -10809,7 +10673,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       }
       __pyx_L15:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":561
+      /* "cvcf.pyx":561
  *             gts = gtsRegEx.split(GTstring)
  *             if len(gts) == 1: return [int(gts[0])]
  *             if len(gts) != 2: raise ValueError()             # <<<<<<<<<<<<<<
@@ -10828,7 +10692,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       }
       __pyx_L16:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":562
+      /* "cvcf.pyx":562
  *             if len(gts) == 1: return [int(gts[0])]
  *             if len(gts) != 2: raise ValueError()
  *             if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]             # <<<<<<<<<<<<<<
@@ -10837,7 +10701,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
  */
       __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+      __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
@@ -10845,7 +10709,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       if (__pyx_t_2) {
         __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
@@ -10866,7 +10730,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_4 = PySequence_GetSlice(__pyx_v_GTstring, __pyx_t_5, (-__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_GTstring, __pyx_t_5, (-__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_3);
@@ -10888,7 +10752,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       }
       __pyx_L17:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":563
+      /* "cvcf.pyx":563
  *             if len(gts) != 2: raise ValueError()
  *             if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]             # <<<<<<<<<<<<<<
@@ -10899,13 +10763,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
       __Pyx_GIVEREF(__pyx_t_9);
       __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
       __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
@@ -10914,18 +10778,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PySequence_GetSlice(__pyx_v_GTstring, __pyx_t_8, (-__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+      __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_GTstring, __pyx_t_8, (-__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
       __Pyx_GIVEREF(__pyx_t_4);
       __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
@@ -10957,7 +10821,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":564
+    /* "cvcf.pyx":564
  *             if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
  *         except ValueError:             # <<<<<<<<<<<<<<
@@ -10972,7 +10836,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_GOTREF(__pyx_t_3);
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":565
+      /* "cvcf.pyx":565
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
  *         except ValueError:
  *             self.error(self._line,self.BAD_GENOTYPE,GTstring)             # <<<<<<<<<<<<<<
@@ -10986,7 +10850,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__BAD_GENOTYPE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
       __Pyx_GOTREF(__pyx_t_12);
       __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-      __Pyx_GOTREF(__pyx_t_13);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
       PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
       __Pyx_GIVEREF(__pyx_t_11);
       PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
@@ -10996,13 +10860,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __Pyx_GIVEREF(__pyx_v_GTstring);
       __pyx_t_11 = 0;
       __pyx_t_12 = 0;
-      __pyx_t_12 = PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+      __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
       __Pyx_GOTREF(__pyx_t_12);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":566
+      /* "cvcf.pyx":566
  *         except ValueError:
  *             self.error(self._line,self.BAD_GENOTYPE,GTstring)
  *             return [".","|","."]             # <<<<<<<<<<<<<<
@@ -11012,15 +10876,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
       __Pyx_XDECREF(__pyx_r);
       __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-      PyList_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_kp_s_6));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-      PyList_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_kp_s_57));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-      PyList_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_kp_s_6));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+      PyList_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_kp_s_9));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
+      PyList_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_kp_s_92));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
+      __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+      PyList_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_kp_s_9));
+      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
       __pyx_r = ((PyObject *)__pyx_t_12);
       __pyx_t_12 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -11071,7 +10935,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":569
+/* "cvcf.pyx":569
  * 
  * 
  *     def convertGTback(self, GTdata):             # <<<<<<<<<<<<<<
@@ -11079,9 +10943,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGT(PyObject *__pyx_self, PyObject *_
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_convertGTback = {__Pyx_NAMESTR("convertGTback"), (PyCFunction)__pyx_pf_4cvcf_3VCF_convertGTback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_13convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_13convertGTback = {__Pyx_NAMESTR("convertGTback"), (PyCFunction)__pyx_pf_4cvcf_3VCF_13convertGTback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_13convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_GTdata = 0;
   PyObject *__pyx_r = NULL;
@@ -11132,7 +10996,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGTback(PyObject *__pyx_self, PyObjec
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":570
+  /* "cvcf.pyx":570
  * 
  *     def convertGTback(self, GTdata):
  *         return ''.join(map(str,GTdata))             # <<<<<<<<<<<<<<
@@ -11143,25 +11007,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGTback(PyObject *__pyx_self, PyObjec
   __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)((PyObject*)&PyString_Type)));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)&PyString_Type)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyString_Type)));
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_INCREF(__pyx_v_GTdata);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_GTdata);
   __Pyx_GIVEREF(__pyx_v_GTdata);
-  __pyx_t_3 = PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
   goto __pyx_L0;
@@ -11180,7 +11044,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGTback(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":572
+/* "cvcf.pyx":572
  *         return ''.join(map(str,GTdata))
  * 
  *     def parse_formatdata( self, key, value, formatdict, line ):             # <<<<<<<<<<<<<<
@@ -11188,9 +11052,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_convertGTback(PyObject *__pyx_self, PyObjec
  *         f = formatdict.get(key,None)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_parse_formatdata = {__Pyx_NAMESTR("parse_formatdata"), (PyCFunction)__pyx_pf_4cvcf_3VCF_parse_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_14parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_14parse_formatdata = {__Pyx_NAMESTR("parse_formatdata"), (PyCFunction)__pyx_pf_4cvcf_3VCF_14parse_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_14parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_key = 0;
   PyObject *__pyx_v_value = 0;
@@ -11290,7 +11154,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":574
+  /* "cvcf.pyx":574
  *     def parse_formatdata( self, key, value, formatdict, line ):
  *         # To do: check that the right number of values is present
  *         f = formatdict.get(key,None)             # <<<<<<<<<<<<<<
@@ -11300,22 +11164,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_formatdict, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_key);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
   __Pyx_GIVEREF(__pyx_v_key);
   __Pyx_INCREF(Py_None);
   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
   __Pyx_GIVEREF(Py_None);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_f);
   __pyx_v_f = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":575
+  /* "cvcf.pyx":575
  *         # To do: check that the right number of values is present
  *         f = formatdict.get(key,None)
  *         if f == None:             # <<<<<<<<<<<<<<
@@ -11328,7 +11192,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":576
+    /* "cvcf.pyx":576
  *         f = formatdict.get(key,None)
  *         if f == None:
  *             self._add_definition(formatdict, key, value, line )             # <<<<<<<<<<<<<<
@@ -11338,7 +11202,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___add_definition); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_formatdict);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_formatdict);
     __Pyx_GIVEREF(__pyx_v_formatdict);
@@ -11351,13 +11215,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":577
+    /* "cvcf.pyx":577
  *         if f == None:
  *             self._add_definition(formatdict, key, value, line )
  *             f = formatdict[key]             # <<<<<<<<<<<<<<
@@ -11373,7 +11237,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":578
+  /* "cvcf.pyx":578
  *             self._add_definition(formatdict, key, value, line )
  *             f = formatdict[key]
  *         if f.type == "Flag":             # <<<<<<<<<<<<<<
@@ -11389,7 +11253,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":579
+    /* "cvcf.pyx":579
  *             f = formatdict[key]
  *         if f.type == "Flag":
  *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)             # <<<<<<<<<<<<<<
@@ -11400,26 +11264,26 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     if (__pyx_t_4) {
       __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_58); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_93); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":580
+    /* "cvcf.pyx":580
  *         if f.type == "Flag":
  *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
  *             return []             # <<<<<<<<<<<<<<
@@ -11436,7 +11300,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   }
   __pyx_L7:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":581
+  /* "cvcf.pyx":581
  *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
  *             return []
  *         values = value.split(',')             # <<<<<<<<<<<<<<
@@ -11445,68 +11309,56 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_v_values);
-  __pyx_v_values = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_v_values = __pyx_t_3;
+  __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":583
+  /* "cvcf.pyx":583
  *         values = value.split(',')
  *         # deal with trailing data in some early VCF files
  *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:             # <<<<<<<<<<<<<<
  *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])
  *             values[-1] = values[-1].split(';')[0]
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_5 = __pyx_t_4;
   if (!__pyx_t_5) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_6 = __pyx_t_4;
     __pyx_t_4 = __pyx_t_6;
   } else {
     __pyx_t_4 = __pyx_t_5;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_5 = __pyx_t_4;
   if (__pyx_t_5) {
     __pyx_t_7 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (__pyx_t_7 > 0);
     if (__pyx_t_4) {
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__find); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_7));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
-      __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_neg_1, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_8 = __pyx_t_6;
     } else {
       __pyx_t_8 = __pyx_t_4;
@@ -11517,83 +11369,77 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   }
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":584
+    /* "cvcf.pyx":584
  *         # deal with trailing data in some early VCF files
  *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
  *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])             # <<<<<<<<<<<<<<
  *             values[-1] = values[-1].split(';')[0]
  *         if f.type == "Integer":
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_TRAILING_DATA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_TRAILING_DATA); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
-    __pyx_t_1 = 0;
+    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":585
+    /* "cvcf.pyx":585
  *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
  *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])
  *             values[-1] = values[-1].split(';')[0]             # <<<<<<<<<<<<<<
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):
  */
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_7));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
-    __pyx_t_2 = PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (__Pyx_SetItemInt(__pyx_v_values, -1, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (__Pyx_SetItemInt(__pyx_v_values, -1, __pyx_t_9, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     goto __pyx_L9;
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":586
+  /* "cvcf.pyx":586
  *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])
  *             values[-1] = values[-1].split(';')[0]
  *         if f.type == "Integer":             # <<<<<<<<<<<<<<
  *             for idx,v in enumerate(values):
  *                 try:
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":587
+    /* "cvcf.pyx":587
  *             values[-1] = values[-1].split(';')[0]
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):             # <<<<<<<<<<<<<<
@@ -11603,39 +11449,39 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     __Pyx_INCREF(__pyx_int_0);
     __pyx_t_2 = __pyx_int_0;
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_7 = 0; __pyx_t_3 = __pyx_v_values; __Pyx_INCREF(__pyx_t_3);
+      __pyx_t_7 = 0; __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9);
     } else {
-      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
+      if (likely(PyList_CheckExact(__pyx_t_9))) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
       } else {
-        __pyx_t_9 = PyIter_Next(__pyx_t_3);
-        if (!__pyx_t_9) {
+        __pyx_t_1 = PyIter_Next(__pyx_t_9);
+        if (!__pyx_t_1) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_1);
       }
       __Pyx_DECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_v = __pyx_t_1;
+      __pyx_t_1 = 0;
       __Pyx_INCREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_idx);
       __pyx_v_idx = __pyx_t_2;
-      __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2);
-      __pyx_t_2 = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_t_2 = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":588
+      /* "cvcf.pyx":588
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):
  *                 try:             # <<<<<<<<<<<<<<
@@ -11650,43 +11496,43 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
         __Pyx_XGOTREF(__pyx_save_exc_tb);
         /*try:*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":589
+          /* "cvcf.pyx":589
  *             for idx,v in enumerate(values):
  *                 try:
  *                     if v == ".": values[idx] = f.missingvalue             # <<<<<<<<<<<<<<
  *                     else:        values[idx] = int(v)
  *                 except:
  */
-          __pyx_t_9 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           if (__pyx_t_4) {
-            __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-            __Pyx_GOTREF(__pyx_t_9);
-            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+            __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+            __Pyx_GOTREF(__pyx_t_1);
+            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             goto __pyx_L21;
           }
           /*else*/ {
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":590
+            /* "cvcf.pyx":590
  *                 try:
  *                     if v == ".": values[idx] = f.missingvalue
  *                     else:        values[idx] = int(v)             # <<<<<<<<<<<<<<
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
  */
-            __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-            __Pyx_GOTREF(__pyx_t_9);
+            __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_1));
             __Pyx_INCREF(__pyx_v_v);
-            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_v);
+            PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
             __Pyx_GIVEREF(__pyx_v_v);
-            __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-            __Pyx_GOTREF(__pyx_t_1);
-            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+            __Pyx_GOTREF(__pyx_t_3);
+            __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
           }
           __pyx_L21:;
         }
@@ -11695,10 +11541,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
         __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
         goto __pyx_L20_try_end;
         __pyx_L13_error:;
-        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":591
+        /* "cvcf.pyx":591
  *                     if v == ".": values[idx] = f.missingvalue
  *                     else:        values[idx] = int(v)
  *                 except:             # <<<<<<<<<<<<<<
@@ -11707,12 +11553,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
         /*except:*/ {
           __Pyx_AddTraceback("cvcf.VCF.parse_formatdata");
-          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_9, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
+          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
+          __Pyx_GOTREF(__pyx_t_3);
           __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_GOTREF(__pyx_t_9);
           __Pyx_GOTREF(__pyx_t_10);
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":592
+          /* "cvcf.pyx":592
  *                     else:        values[idx] = int(v)
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)             # <<<<<<<<<<<<<<
@@ -11721,10 +11567,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
           __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
           __Pyx_GOTREF(__pyx_t_11);
-          __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_59); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
+          __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_97); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
           __Pyx_GOTREF(__pyx_t_12);
           __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
-          __Pyx_GOTREF(__pyx_t_13);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_13));
           __Pyx_INCREF(__pyx_v_line);
           PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_line);
           __Pyx_GIVEREF(__pyx_v_line);
@@ -11734,13 +11580,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
           PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_values);
           __Pyx_GIVEREF(__pyx_v_values);
           __pyx_t_12 = 0;
-          __pyx_t_12 = PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
+          __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":593
+          /* "cvcf.pyx":593
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
  *                     return [0] * len(values)             # <<<<<<<<<<<<<<
@@ -11768,8 +11614,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           goto __pyx_L16_except_return;
+          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           goto __pyx_L14_exception_handled;
         }
@@ -11793,10 +11639,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
         __pyx_L20_try_end:;
       }
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":594
+    /* "cvcf.pyx":594
  *                     self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
  *                     return [0] * len(values)
  *             return values             # <<<<<<<<<<<<<<
@@ -11810,7 +11656,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     goto __pyx_L10;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":595
+  /* "cvcf.pyx":595
  *                     return [0] * len(values)
  *             return values
  *         elif f.type == "String":             # <<<<<<<<<<<<<<
@@ -11819,14 +11665,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":596
+    /* "cvcf.pyx":596
  *             return values
  *         elif f.type == "String":
  *             self._line = line             # <<<<<<<<<<<<<<
@@ -11835,34 +11681,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___line, __pyx_v_line) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":597
+    /* "cvcf.pyx":597
  *         elif f.type == "String":
  *             self._line = line
  *             if f.id == "GT": values = map( self.convertGT, values )             # <<<<<<<<<<<<<<
  *             return values
  *         elif f.type == "Character":
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__GT), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__GT), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_4) {
       __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__convertGT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_values);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_values);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_values);
       __Pyx_GIVEREF(__pyx_v_values);
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_map, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_v_values);
       __pyx_v_values = __pyx_t_2;
       __pyx_t_2 = 0;
@@ -11870,7 +11716,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     }
     __pyx_L24:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":598
+    /* "cvcf.pyx":598
  *             self._line = line
  *             if f.id == "GT": values = map( self.convertGT, values )
  *             return values             # <<<<<<<<<<<<<<
@@ -11884,7 +11730,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     goto __pyx_L10;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":599
+  /* "cvcf.pyx":599
  *             if f.id == "GT": values = map( self.convertGT, values )
  *             return values
  *         elif f.type == "Character":             # <<<<<<<<<<<<<<
@@ -11893,14 +11739,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":600
+    /* "cvcf.pyx":600
  *             return values
  *         elif f.type == "Character":
  *             for v in values:             # <<<<<<<<<<<<<<
@@ -11908,20 +11754,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  *             return values
  */
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_7 = 0; __pyx_t_3 = __pyx_v_values; __Pyx_INCREF(__pyx_t_3);
+      __pyx_t_7 = 0; __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9);
     } else {
-      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
+      if (likely(PyList_CheckExact(__pyx_t_9))) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
       } else {
-        __pyx_t_2 = PyIter_Next(__pyx_t_3);
+        __pyx_t_2 = PyIter_Next(__pyx_t_9);
         if (!__pyx_t_2) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
@@ -11932,7 +11778,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
       __pyx_v_v = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":601
+      /* "cvcf.pyx":601
  *         elif f.type == "Character":
  *             for v in values:
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)             # <<<<<<<<<<<<<<
@@ -11944,28 +11790,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
       if (__pyx_t_4) {
         __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_60); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_98); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
+        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_10);
         __Pyx_GIVEREF(__pyx_t_10);
         __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         goto __pyx_L27;
       }
       __pyx_L27:;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":602
+    /* "cvcf.pyx":602
  *             for v in values:
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
  *             return values             # <<<<<<<<<<<<<<
@@ -11979,23 +11825,23 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     goto __pyx_L10;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":603
+  /* "cvcf.pyx":603
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
  *             return values
  *         elif f.type == "Float":             # <<<<<<<<<<<<<<
  *             for idx,v in enumerate(values):
  *                 if v == ".": values[idx] = f.missingvalue
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":604
+    /* "cvcf.pyx":604
  *             return values
  *         elif f.type == "Float":
  *             for idx,v in enumerate(values):             # <<<<<<<<<<<<<<
@@ -12005,62 +11851,62 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
     __Pyx_INCREF(__pyx_int_0);
     __pyx_t_10 = __pyx_int_0;
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_7 = 0; __pyx_t_3 = __pyx_v_values; __Pyx_INCREF(__pyx_t_3);
+      __pyx_t_7 = 0; __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9);
     } else {
-      __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
+      if (likely(PyList_CheckExact(__pyx_t_9))) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
       } else {
-        __pyx_t_9 = PyIter_Next(__pyx_t_3);
-        if (!__pyx_t_9) {
+        __pyx_t_1 = PyIter_Next(__pyx_t_9);
+        if (!__pyx_t_1) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_1);
       }
       __Pyx_DECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_v = __pyx_t_1;
+      __pyx_t_1 = 0;
       __Pyx_INCREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_v_idx);
       __pyx_v_idx = __pyx_t_10;
-      __pyx_t_9 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_10);
-      __pyx_t_10 = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_t_10 = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":605
+      /* "cvcf.pyx":605
  *         elif f.type == "Float":
  *             for idx,v in enumerate(values):
  *                 if v == ".": values[idx] = f.missingvalue             # <<<<<<<<<<<<<<
  *             try: return map(float,values)
  *             except:
  */
-      __pyx_t_9 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_4) {
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L30;
       }
       __pyx_L30:;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":606
+    /* "cvcf.pyx":606
  *             for idx,v in enumerate(values):
  *                 if v == ".": values[idx] = f.missingvalue
  *             try: return map(float,values)             # <<<<<<<<<<<<<<
@@ -12076,18 +11922,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
       /*try:*/ {
         __Pyx_XDECREF(__pyx_r);
         __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_INCREF(((PyObject *)((PyObject*)&PyFloat_Type)));
-        PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)((PyObject*)&PyFloat_Type)));
-        __Pyx_GIVEREF(((PyObject *)((PyObject*)&PyFloat_Type)));
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+        __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
+        PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
+        __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
         __Pyx_INCREF(__pyx_v_values);
         PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_values);
         __Pyx_GIVEREF(__pyx_v_values);
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_map, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_r = __pyx_t_3;
-        __pyx_t_3 = 0;
+        __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __pyx_r = __pyx_t_9;
+        __pyx_t_9 = 0;
         goto __pyx_L35_try_return;
       }
       __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
@@ -12104,13 +11950,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":607
+      /* "cvcf.pyx":607
  *                 if v == ".": values[idx] = f.missingvalue
  *             try: return map(float,values)
  *             except:             # <<<<<<<<<<<<<<
@@ -12119,12 +11965,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
       /*except:*/ {
         __Pyx_AddTraceback("cvcf.VCF.parse_formatdata");
-        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_10, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_GOTREF(__pyx_t_10);
+        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(__pyx_t_1);
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":608
+        /* "cvcf.pyx":608
  *             try: return map(float,values)
  *             except:
  *                 self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)             # <<<<<<<<<<<<<<
@@ -12133,26 +11979,26 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  */
         __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_59); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_97); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(__pyx_t_3);
         __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_11);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_11));
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
+        __Pyx_GIVEREF(__pyx_t_3);
         __Pyx_INCREF(__pyx_v_values);
         PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_values);
         __Pyx_GIVEREF(__pyx_v_values);
-        __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_3 = 0;
+        __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":609
+        /* "cvcf.pyx":609
  *             except:
  *                 self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
  *                 return [0.0] * len(values)             # <<<<<<<<<<<<<<
@@ -12160,29 +12006,29 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  *             # can't happen
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(__pyx_t_3);
         __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_11));
-        PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
-        __pyx_t_1 = 0;
+        PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
+        __Pyx_GIVEREF(__pyx_t_3);
+        __pyx_t_3 = 0;
         __pyx_t_7 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_t_11), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_t_11), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __pyx_r = __pyx_t_2;
         __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         goto __pyx_L34_except_return;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L32_exception_handled;
       }
       __pyx_L33_except_error:;
@@ -12208,29 +12054,29 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":612
+    /* "cvcf.pyx":612
  *         else:
  *             # can't happen
  *             self.error(line,self.ERROR_INFO_STRING)             # <<<<<<<<<<<<<<
  * 
  * 
  */
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_10);
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   }
   __pyx_L10:;
@@ -12258,7 +12104,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":615
+/* "cvcf.pyx":615
  * 
  * 
  *     def inregion(self, chrom, pos):             # <<<<<<<<<<<<<<
@@ -12266,9 +12112,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_formatdata(PyObject *__pyx_self, PyOb
  *         for r in self._regions:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_inregion = {__Pyx_NAMESTR("inregion"), (PyCFunction)__pyx_pf_4cvcf_3VCF_inregion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_15inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_15inregion = {__Pyx_NAMESTR("inregion"), (PyCFunction)__pyx_pf_4cvcf_3VCF_15inregion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_15inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_chrom = 0;
   PyObject *__pyx_v_pos = 0;
@@ -12336,7 +12182,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_r = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":616
+  /* "cvcf.pyx":616
  * 
  *     def inregion(self, chrom, pos):
  *         if not self._regions: return True             # <<<<<<<<<<<<<<
@@ -12359,7 +12205,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":617
+  /* "cvcf.pyx":617
  *     def inregion(self, chrom, pos):
  *         if not self._regions: return True
  *         for r in self._regions:             # <<<<<<<<<<<<<<
@@ -12394,7 +12240,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__
     __pyx_v_r = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":618
+    /* "cvcf.pyx":618
  *         if not self._regions: return True
  *         for r in self._regions:
  *             if r[0] == chrom and r[1] <= pos < r[2]: return True             # <<<<<<<<<<<<<<
@@ -12442,7 +12288,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__
   }
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":619
+  /* "cvcf.pyx":619
  *         for r in self._regions:
  *             if r[0] == chrom and r[1] <= pos < r[2]: return True
  *         return False             # <<<<<<<<<<<<<<
@@ -12472,7 +12318,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":622
+/* "cvcf.pyx":622
  * 
  * 
  *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
@@ -12480,9 +12326,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_inregion(PyObject *__pyx_self, PyObject *__
  *         if len(cols) != len(self._samples)+9:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_parse_data = {__Pyx_NAMESTR("parse_data"), (PyCFunction)__pyx_pf_4cvcf_3VCF_parse_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_16parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_16parse_data = {__Pyx_NAMESTR("parse_data"), (PyCFunction)__pyx_pf_4cvcf_3VCF_16parse_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_16parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_lineparse = 0;
@@ -12526,16 +12372,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   PyObject *__pyx_v_value;
   PyObject *__pyx_v_d;
   PyObject *__pyx_v_key;
-  PyObject *__pyx_8genexpr0__pyx_v_allele;
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  Py_ssize_t __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
+  int __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
+  PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
   PyObject *__pyx_t_11 = NULL;
@@ -12555,7 +12400,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
-    values[2] = __pyx_k_61;
+    values[2] = __pyx_k_99;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
       case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -12587,7 +12432,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_v_line = values[1];
     __pyx_v_lineparse = values[2];
   } else {
-    __pyx_v_lineparse = __pyx_k_61;
+    __pyx_v_lineparse = __pyx_k_99;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3:
       __pyx_v_lineparse = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -12617,13 +12462,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_v_faref = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_filter = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_info = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_info = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_blurp = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_format = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_newalts = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_newalts = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_a = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_addns = Py_None; __Pyx_INCREF(Py_None);
@@ -12634,17 +12479,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_v_allele = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_longest = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_shortest = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_samples = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_samples = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_sample = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_dict = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_dict = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_values = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_expected = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_d = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_8genexpr0__pyx_v_allele = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":623
+  /* "cvcf.pyx":623
  * 
  *     def parse_data( self, line, lineparse=False ):
  *         cols = line.split('\t')             # <<<<<<<<<<<<<<
@@ -12653,145 +12497,139 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_cols);
-  __pyx_v_cols = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_cols = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":624
+  /* "cvcf.pyx":624
  *     def parse_data( self, line, lineparse=False ):
  *         cols = line.split('\t')
  *         if len(cols) != len(self._samples)+9:             # <<<<<<<<<<<<<<
  *             # gracefully deal with absent FORMAT column
  *             if len(cols) == 8 and len(self._samples)==0:
  */
-  __pyx_t_4 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = (__pyx_t_4 != (__pyx_t_5 + 9));
-  if (__pyx_t_6) {
+  __pyx_t_3 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = (__pyx_t_3 != (__pyx_t_4 + 9));
+  if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":626
+    /* "cvcf.pyx":626
  *         if len(cols) != len(self._samples)+9:
  *             # gracefully deal with absent FORMAT column
  *             if len(cols) == 8 and len(self._samples)==0:             # <<<<<<<<<<<<<<
  *                 cols.append("")
  *             else:
  */
-    __pyx_t_5 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = (__pyx_t_5 == 8);
-    if (__pyx_t_6) {
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_7 = (__pyx_t_5 == 0);
-      __pyx_t_8 = __pyx_t_7;
+    __pyx_t_4 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = (__pyx_t_4 == 8);
+    if (__pyx_t_5) {
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_6 = (__pyx_t_4 == 0);
+      __pyx_t_7 = __pyx_t_6;
     } else {
-      __pyx_t_8 = __pyx_t_6;
+      __pyx_t_7 = __pyx_t_5;
     }
-    if (__pyx_t_8) {
+    if (__pyx_t_7) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":627
+      /* "cvcf.pyx":627
  *             # gracefully deal with absent FORMAT column
  *             if len(cols) == 8 and len(self._samples)==0:
  *                 cols.append("")             # <<<<<<<<<<<<<<
  *             else:
  *                 self.error(line,
  */
-      __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_cols, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_cols, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       goto __pyx_L7;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":629
+      /* "cvcf.pyx":629
  *                 cols.append("")
  *             else:
  *                 self.error(line,             # <<<<<<<<<<<<<<
  *                            self.BAD_NUMBER_OF_COLUMNS,
  *                            "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))
  */
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":630
+      /* "cvcf.pyx":630
  *             else:
  *                 self.error(line,
  *                            self.BAD_NUMBER_OF_COLUMNS,             # <<<<<<<<<<<<<<
  *                            "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))
  * 
  */
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_101); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":631
+      /* "cvcf.pyx":631
  *                 self.error(line,
  *                            self.BAD_NUMBER_OF_COLUMNS,
  *                            "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))             # <<<<<<<<<<<<<<
  * 
  *         chrom = cols[0]
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_5 + 9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_4 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_8 = PyInt_FromSsize_t((__pyx_t_4 + 9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_5 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_5 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
       __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
-      __Pyx_GIVEREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
+      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_9);
       __Pyx_GIVEREF(__pyx_t_9);
       PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_10);
       __Pyx_GIVEREF(__pyx_t_10);
       PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_11);
       __Pyx_GIVEREF(__pyx_t_11);
-      __pyx_t_1 = 0;
+      __pyx_t_8 = 0;
       __pyx_t_9 = 0;
       __pyx_t_10 = 0;
       __pyx_t_11 = 0;
-      __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_63), __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_102), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_11));
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
       __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
+      __Pyx_GIVEREF(__pyx_t_1);
       PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_t_11));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
-      __pyx_t_2 = 0;
+      __pyx_t_1 = 0;
       __pyx_t_11 = 0;
-      __pyx_t_11 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     }
     __pyx_L7:;
@@ -12799,7 +12637,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":633
+  /* "cvcf.pyx":633
  *                            "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))
  * 
  *         chrom = cols[0]             # <<<<<<<<<<<<<<
@@ -12812,7 +12650,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_v_chrom = __pyx_t_11;
   __pyx_t_11 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":636
+  /* "cvcf.pyx":636
  * 
  *         # get 0-based position
  *         try:    pos = int(cols[1])-1             # <<<<<<<<<<<<<<
@@ -12829,13 +12667,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
       __Pyx_GOTREF(__pyx_t_11);
       __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-      __Pyx_GOTREF(__pyx_t_12);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
       PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11);
       __Pyx_GIVEREF(__pyx_t_11);
       __pyx_t_11 = 0;
-      __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+      __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
       __pyx_t_12 = PyNumber_Subtract(__pyx_t_11, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
       __Pyx_GOTREF(__pyx_t_12);
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
@@ -12848,15 +12686,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
     goto __pyx_L15_try_end;
     __pyx_L8_error:;
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":637
+    /* "cvcf.pyx":637
  *         # get 0-based position
  *         try:    pos = int(cols[1])-1
  *         except: self.error(line,self.POS_NOT_NUMERICAL)             # <<<<<<<<<<<<<<
@@ -12865,30 +12703,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     /*except:*/ {
       __Pyx_AddTraceback("cvcf.VCF.parse_data");
-      if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+      if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
       __Pyx_GOTREF(__pyx_t_12);
       __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
       __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__POS_NOT_NUMERICAL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
       __Pyx_GIVEREF(__pyx_t_10);
       __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       goto __pyx_L9_exception_handled;
     }
     __pyx_L10_except_error:;
@@ -12905,40 +12743,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_L15_try_end:;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":638
+  /* "cvcf.pyx":638
  *         try:    pos = int(cols[1])-1
  *         except: self.error(line,self.POS_NOT_NUMERICAL)
  *         if pos < 0: self.error(line,self.POS_NOT_POSITIVE)             # <<<<<<<<<<<<<<
  * 
  *         # implement filtering
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_8) {
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_7) {
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__POS_NOT_POSITIVE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_12));
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
     __Pyx_GIVEREF(__pyx_t_11);
     __pyx_t_11 = 0;
-    __pyx_t_11 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     goto __pyx_L18;
   }
   __pyx_L18:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":641
+  /* "cvcf.pyx":641
  * 
  *         # implement filtering
  *         if not self.inregion(chrom,pos): return None             # <<<<<<<<<<<<<<
@@ -12948,21 +12786,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__inregion); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_11);
   __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
   __Pyx_INCREF(__pyx_v_chrom);
   PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_chrom);
   __Pyx_GIVEREF(__pyx_v_chrom);
   __Pyx_INCREF(__pyx_v_pos);
   PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_pos);
   __Pyx_GIVEREF(__pyx_v_pos);
-  __pyx_t_3 = PyObject_Call(__pyx_t_11, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = (!__pyx_t_8);
-  if (__pyx_t_6) {
+  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = (!__pyx_t_7);
+  if (__pyx_t_5) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
@@ -12971,105 +12809,105 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   __pyx_L19:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":644
+  /* "cvcf.pyx":644
  * 
  *         # end of first-pass parse for sortedVCF
  *         if lineparse: return chrom, pos, line             # <<<<<<<<<<<<<<
  * 
  *         id = cols[2]
  */
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_lineparse); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_6) {
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_lineparse); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_5) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_chrom);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
     __Pyx_GIVEREF(__pyx_v_chrom);
     __Pyx_INCREF(__pyx_v_pos);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_pos);
+    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pos);
     __Pyx_GIVEREF(__pyx_v_pos);
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    __pyx_r = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_r = ((PyObject *)__pyx_t_2);
+    __pyx_t_2 = 0;
     goto __pyx_L0;
     goto __pyx_L20;
   }
   __pyx_L20:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":646
+  /* "cvcf.pyx":646
  *         if lineparse: return chrom, pos, line
  * 
  *         id = cols[2]             # <<<<<<<<<<<<<<
  * 
  *         ref = cols[3].upper()
  */
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_cols, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cols, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_id);
-  __pyx_v_id = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_id = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":648
+  /* "cvcf.pyx":648
  *         id = cols[2]
  * 
  *         ref = cols[3].upper()             # <<<<<<<<<<<<<<
  *         if ref == ".":
  *             self.error(line,self.MISSING_REF)
  */
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_cols, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cols, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
   __Pyx_DECREF(__pyx_v_ref);
-  __pyx_v_ref = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_ref = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":649
+  /* "cvcf.pyx":649
  * 
  *         ref = cols[3].upper()
  *         if ref == ".":             # <<<<<<<<<<<<<<
  *             self.error(line,self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_6) {
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":650
+    /* "cvcf.pyx":650
  *         ref = cols[3].upper()
  *         if ref == ".":
  *             self.error(line,self.MISSING_REF)             # <<<<<<<<<<<<<<
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  *             else:                   ref = ""
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__MISSING_REF); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
     __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_11));
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
     __Pyx_GIVEREF(__pyx_t_12);
     __pyx_t_12 = 0;
-    __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":651
+    /* "cvcf.pyx":651
  *         if ref == ".":
  *             self.error(line,self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)             # <<<<<<<<<<<<<<
@@ -13081,17 +12919,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
       __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
       __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_chrom);
       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom);
       __Pyx_GIVEREF(__pyx_v_chrom);
@@ -13100,22 +12938,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __Pyx_GIVEREF(__pyx_v_pos);
       PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_12);
       __Pyx_GIVEREF(__pyx_t_12);
-      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_3);
-      __Pyx_GIVEREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_12 = 0;
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_11, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_ref = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L22;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":652
+      /* "cvcf.pyx":652
  *             self.error(line,self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  *             else:                   ref = ""             # <<<<<<<<<<<<<<
@@ -13131,7 +12969,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":654
+    /* "cvcf.pyx":654
  *             else:                   ref = ""
  *         else:
  *             for c in ref:             # <<<<<<<<<<<<<<
@@ -13139,20 +12977,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *             if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference)
  */
     if (PyList_CheckExact(__pyx_v_ref) || PyTuple_CheckExact(__pyx_v_ref)) {
-      __pyx_t_5 = 0; __pyx_t_3 = __pyx_v_ref; __Pyx_INCREF(__pyx_t_3);
+      __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_ref; __Pyx_INCREF(__pyx_t_2);
     } else {
-      __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_ref); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++;
+      if (likely(PyList_CheckExact(__pyx_t_2))) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
       } else {
-        __pyx_t_10 = PyIter_Next(__pyx_t_3);
+        __pyx_t_10 = PyIter_Next(__pyx_t_2);
         if (!__pyx_t_10) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
@@ -13163,51 +13001,51 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __pyx_v_c = __pyx_t_10;
       __pyx_t_10 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":655
+      /* "cvcf.pyx":655
  *         else:
  *             for c in ref:
  *                 if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF)             # <<<<<<<<<<<<<<
  *             if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference)
  * 
  */
-      __pyx_t_6 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_n_s__ACGTN), __pyx_v_c))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (__pyx_t_6) {
+      __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_n_s__ACGTN), __pyx_v_c))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__pyx_t_5) {
         __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__UNKNOWN_CHAR_IN_REF); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_11);
         __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_12));
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
         __Pyx_GIVEREF(__pyx_t_11);
         __pyx_t_11 = 0;
-        __pyx_t_11 = PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_11);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
         goto __pyx_L25;
       }
       __pyx_L25:;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":656
+    /* "cvcf.pyx":656
  *             for c in ref:
  *                 if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF)
  *             if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference)             # <<<<<<<<<<<<<<
  * 
  *         # make sure reference is sane
  */
-    __pyx_t_6 = ((PySequence_Contains(__pyx_v_ref, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_6) {
-      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = ((PySequence_Contains(__pyx_v_ref, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_5) {
+      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
       __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_12);
@@ -13215,7 +13053,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
       __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_chrom);
       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom);
       __Pyx_GIVEREF(__pyx_v_chrom);
@@ -13228,10 +13066,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __Pyx_GIVEREF(__pyx_t_11);
       __pyx_t_12 = 0;
       __pyx_t_11 = 0;
-      __pyx_t_11 = PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_v_ref);
       __pyx_v_ref = __pyx_t_11;
       __pyx_t_11 = 0;
@@ -13241,7 +13079,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   __pyx_L21:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":659
+  /* "cvcf.pyx":659
  * 
  *         # make sure reference is sane
  *         if self._reference:             # <<<<<<<<<<<<<<
@@ -13250,11 +13088,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
   __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_11);
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  if (__pyx_t_6) {
+  if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":660
+    /* "cvcf.pyx":660
  *         # make sure reference is sane
  *         if self._reference:
  *             left = max(0,pos-100)             # <<<<<<<<<<<<<<
@@ -13264,14 +13102,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_t_11 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_100); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __pyx_t_13 = 0;
-    __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
       __Pyx_INCREF(__pyx_t_11);
       __pyx_t_10 = __pyx_t_11;
     } else {
@@ -13286,7 +13124,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_v_left = __pyx_t_10;
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":661
+    /* "cvcf.pyx":661
  *         if self._reference:
  *             left = max(0,pos-100)
  *             faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference)             # <<<<<<<<<<<<<<
@@ -13295,37 +13133,37 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_5 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_chrom);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
     __Pyx_GIVEREF(__pyx_v_chrom);
     __Pyx_INCREF(__pyx_v_left);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_left);
+    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_left);
     __Pyx_GIVEREF(__pyx_v_left);
-    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_12);
+    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_12);
     __Pyx_GIVEREF(__pyx_t_12);
-    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_11);
+    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_11);
     __Pyx_GIVEREF(__pyx_t_11);
     __pyx_t_12 = 0;
     __pyx_t_11 = 0;
-    __pyx_t_11 = PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_faref_leftflank);
     __pyx_v_faref_leftflank = __pyx_t_11;
     __pyx_t_11 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":662
+    /* "cvcf.pyx":662
  *             left = max(0,pos-100)
  *             faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference)
  *             faref = faref_leftflank[pos-left:]             # <<<<<<<<<<<<<<
@@ -13334,15 +13172,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     __pyx_t_11 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __pyx_t_11 = PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(__pyx_v_faref);
     __pyx_v_faref = __pyx_t_11;
     __pyx_t_11 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":663
+    /* "cvcf.pyx":663
  *             faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference)
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))             # <<<<<<<<<<<<<<
@@ -13351,45 +13189,45 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     __pyx_t_11 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
       __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__WRONG_REF); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__WRONG_REF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_faref);
       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_faref);
       __Pyx_GIVEREF(__pyx_v_faref);
       __Pyx_INCREF(__pyx_v_ref);
       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_ref);
       __Pyx_GIVEREF(__pyx_v_ref);
-      __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_64), __pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_103), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
-      __Pyx_GIVEREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_t_12));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
-      __pyx_t_3 = 0;
+      __pyx_t_2 = 0;
       __pyx_t_12 = 0;
-      __pyx_t_12 = PyObject_Call(__pyx_t_11, __pyx_t_10, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_12);
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       goto __pyx_L28;
     }
     __pyx_L28:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":664
+    /* "cvcf.pyx":664
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
  *             ref = faref             # <<<<<<<<<<<<<<
@@ -13403,7 +13241,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   __pyx_L27:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":667
+  /* "cvcf.pyx":667
  * 
  *         # convert v3.3 to v4.0 alleles below
  *         if cols[4] == ".": alt = []             # <<<<<<<<<<<<<<
@@ -13412,12 +13250,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
   __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  if (__pyx_t_6) {
+  if (__pyx_t_5) {
     __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_10));
     __Pyx_DECREF(__pyx_v_alt);
@@ -13427,7 +13265,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":668
+    /* "cvcf.pyx":668
  *         # convert v3.3 to v4.0 alleles below
  *         if cols[4] == ".": alt = []
  *         else: alt = cols[4].upper().split(',')             # <<<<<<<<<<<<<<
@@ -13445,42 +13283,36 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_s_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-    __pyx_t_11 = PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __Pyx_DECREF(__pyx_v_alt);
-    __pyx_v_alt = __pyx_t_11;
-    __pyx_t_11 = 0;
+    __pyx_v_alt = __pyx_t_10;
+    __pyx_t_10 = 0;
   }
   __pyx_L29:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":670
+  /* "cvcf.pyx":670
  *         else: alt = cols[4].upper().split(',')
  * 
  *         if cols[5] == ".": qual = -1             # <<<<<<<<<<<<<<
  *         else:
  *             try:    qual = float(cols[5])
  */
-  __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  if (__pyx_t_6) {
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  if (__pyx_t_5) {
     __pyx_v_qual = -1.0;
     goto __pyx_L30;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":672
+    /* "cvcf.pyx":672
  *         if cols[5] == ".": qual = -1
  *         else:
  *             try:    qual = float(cols[5])             # <<<<<<<<<<<<<<
@@ -13494,10 +13326,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __Pyx_XGOTREF(__pyx_save_exc_value);
       __Pyx_XGOTREF(__pyx_save_exc_tb);
       /*try:*/ {
-        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_t_10); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
+        __Pyx_GOTREF(__pyx_t_12);
+        __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_t_12); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __pyx_v_qual = __pyx_t_14;
       }
       __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
@@ -13505,15 +13337,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
       goto __pyx_L38_try_end;
       __pyx_L31_error:;
+      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":673
+      /* "cvcf.pyx":673
  *         else:
  *             try:    qual = float(cols[5])
  *             except: self.error(line,self.QUAL_NOT_NUMERICAL)             # <<<<<<<<<<<<<<
@@ -13522,30 +13354,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
       /*except:*/ {
         __Pyx_AddTraceback("cvcf.VCF.parse_data");
-        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(__pyx_t_12);
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_GOTREF(__pyx_t_11);
-        __Pyx_GOTREF(__pyx_t_12);
-        __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__QUAL_NOT_NUMERICAL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9);
         __Pyx_GIVEREF(__pyx_t_9);
         __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
+        __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         goto __pyx_L32_exception_handled;
       }
       __pyx_L33_except_error:;
@@ -13564,74 +13396,68 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   __pyx_L30:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":676
+  /* "cvcf.pyx":676
  * 
  *         # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
  *         if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []             # <<<<<<<<<<<<<<
  *         else: filter = cols[6].split(';')
  * 
  */
-  __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_11);
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  if (!__pyx_t_6) {
-    __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  if (!__pyx_t_5) {
+    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__PASS), Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_n_s__PASS), Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (!__pyx_t_8) {
-      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_kp_s__0), Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!__pyx_t_7) {
+      __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s__0), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __pyx_t_15 = __pyx_t_7;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_15 = __pyx_t_6;
     } else {
-      __pyx_t_15 = __pyx_t_8;
+      __pyx_t_15 = __pyx_t_7;
     }
-    __pyx_t_8 = __pyx_t_15;
+    __pyx_t_7 = __pyx_t_15;
   } else {
-    __pyx_t_8 = __pyx_t_6;
+    __pyx_t_7 = __pyx_t_5;
   }
-  if (__pyx_t_8) {
-    __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_11));
+  if (__pyx_t_7) {
+    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
     __Pyx_DECREF(__pyx_v_filter);
-    __pyx_v_filter = ((PyObject *)__pyx_t_11);
-    __pyx_t_11 = 0;
+    __pyx_v_filter = ((PyObject *)__pyx_t_10);
+    __pyx_t_10 = 0;
     goto __pyx_L41;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":677
+    /* "cvcf.pyx":677
  *         # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
  *         if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []
  *         else: filter = cols[6].split(';')             # <<<<<<<<<<<<<<
  * 
  *         # dictionary of keys, and list of values
  */
-    __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
-    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_s_7));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
-    __pyx_t_10 = PyObject_Call(__pyx_t_12, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     __Pyx_DECREF(__pyx_v_filter);
     __pyx_v_filter = __pyx_t_10;
@@ -13639,7 +13465,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   __pyx_L41:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":680
+  /* "cvcf.pyx":680
  * 
  *         # dictionary of keys, and list of values
  *         info = {}             # <<<<<<<<<<<<<<
@@ -13652,7 +13478,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_v_info = __pyx_t_10;
   __pyx_t_10 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":681
+  /* "cvcf.pyx":681
  *         # dictionary of keys, and list of values
  *         info = {}
  *         if cols[7] != ".":             # <<<<<<<<<<<<<<
@@ -13661,14 +13487,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
   __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_6), Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_11);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  if (__pyx_t_8) {
+  if (__pyx_t_7) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":682
+    /* "cvcf.pyx":682
  *         info = {}
  *         if cols[7] != ".":
  *             for blurp in cols[7].split(';'):             # <<<<<<<<<<<<<<
@@ -13680,219 +13506,201 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_11);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
-    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_s_7));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
-    __pyx_t_12 = PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) {
-      __pyx_t_5 = 0; __pyx_t_11 = __pyx_t_12; __Pyx_INCREF(__pyx_t_11);
+    if (PyList_CheckExact(__pyx_t_11) || PyTuple_CheckExact(__pyx_t_11)) {
+      __pyx_t_4 = 0; __pyx_t_10 = __pyx_t_11; __Pyx_INCREF(__pyx_t_10);
     } else {
-      __pyx_t_5 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
     }
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_11))) {
-        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_11)) break;
-        __pyx_t_12 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_5); __Pyx_INCREF(__pyx_t_12); __pyx_t_5++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_11))) {
-        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
-        __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_5); __Pyx_INCREF(__pyx_t_12); __pyx_t_5++;
+      if (likely(PyList_CheckExact(__pyx_t_10))) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
+        __pyx_t_11 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_11); __pyx_t_4++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_10))) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
+        __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_11); __pyx_t_4++;
       } else {
-        __pyx_t_12 = PyIter_Next(__pyx_t_11);
-        if (!__pyx_t_12) {
+        __pyx_t_11 = PyIter_Next(__pyx_t_10);
+        if (!__pyx_t_11) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_GOTREF(__pyx_t_11);
       }
       __Pyx_DECREF(__pyx_v_blurp);
-      __pyx_v_blurp = __pyx_t_12;
-      __pyx_t_12 = 0;
+      __pyx_v_blurp = __pyx_t_11;
+      __pyx_t_11 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":683
+      /* "cvcf.pyx":683
  *         if cols[7] != ".":
  *             for blurp in cols[7].split(';'):
  *                 elts = blurp.split('=')             # <<<<<<<<<<<<<<
  *                 if len(elts) == 1: v = None
  *                 elif len(elts) == 2: v = elts[1]
  */
-      __pyx_t_12 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
-      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_s_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
-      __pyx_t_9 = PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
       __Pyx_DECREF(__pyx_v_elts);
-      __pyx_v_elts = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_elts = __pyx_t_12;
+      __pyx_t_12 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":684
+      /* "cvcf.pyx":684
  *             for blurp in cols[7].split(';'):
  *                 elts = blurp.split('=')
  *                 if len(elts) == 1: v = None             # <<<<<<<<<<<<<<
  *                 elif len(elts) == 2: v = elts[1]
  *                 else: self.error(line,self.ERROR_INFO_STRING)
  */
-      __pyx_t_4 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = (__pyx_t_4 == 1);
-      if (__pyx_t_8) {
+      __pyx_t_3 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = (__pyx_t_3 == 1);
+      if (__pyx_t_7) {
         __Pyx_INCREF(Py_None);
         __Pyx_DECREF(__pyx_v_v);
         __pyx_v_v = Py_None;
         goto __pyx_L45;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":685
+      /* "cvcf.pyx":685
  *                 elts = blurp.split('=')
  *                 if len(elts) == 1: v = None
  *                 elif len(elts) == 2: v = elts[1]             # <<<<<<<<<<<<<<
  *                 else: self.error(line,self.ERROR_INFO_STRING)
  *                 info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line)
  */
-      __pyx_t_4 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = (__pyx_t_4 == 2);
-      if (__pyx_t_8) {
-        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_3 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = (__pyx_t_3 == 2);
+      if (__pyx_t_7) {
+        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
         __Pyx_DECREF(__pyx_v_v);
-        __pyx_v_v = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_v = __pyx_t_12;
+        __pyx_t_12 = 0;
         goto __pyx_L45;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":686
+        /* "cvcf.pyx":686
  *                 if len(elts) == 1: v = None
  *                 elif len(elts) == 2: v = elts[1]
  *                 else: self.error(line,self.ERROR_INFO_STRING)             # <<<<<<<<<<<<<<
  *                 info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line)
  * 
  */
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_12);
+        __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_11);
+        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_10);
-        __Pyx_GIVEREF(__pyx_t_10);
-        __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
+        __Pyx_GIVEREF(__pyx_t_11);
+        __pyx_t_11 = 0;
+        __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_11);
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
       }
       __pyx_L45:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":687
+      /* "cvcf.pyx":687
  *                 elif len(elts) == 2: v = elts[1]
  *                 else: self.error(line,self.ERROR_INFO_STRING)
  *                 info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line)             # <<<<<<<<<<<<<<
  * 
  *         # Gracefully deal with absent FORMAT column
  */
-      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12);
-      __Pyx_GIVEREF(__pyx_t_12);
+      __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+      __Pyx_GIVEREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_v);
-      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_v);
+      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v);
       __Pyx_GIVEREF(__pyx_v_v);
-      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
-      __Pyx_GIVEREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_12);
+      __Pyx_GIVEREF(__pyx_t_12);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      __pyx_t_12 = 0;
       __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      if (PyDict_SetItem(((PyObject *)__pyx_v_info), __pyx_t_2, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = 0;
+      __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_info), __pyx_t_1, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     }
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     goto __pyx_L42;
   }
   __pyx_L42:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":690
+  /* "cvcf.pyx":690
  * 
  *         # Gracefully deal with absent FORMAT column
  *         if cols[8] == "": format = []             # <<<<<<<<<<<<<<
  *         else: format = cols[8].split(':')
  * 
  */
-  __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (__pyx_t_8) {
-    __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  if (__pyx_t_7) {
+    __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_12));
     __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = ((PyObject *)__pyx_t_9);
-    __pyx_t_9 = 0;
+    __pyx_v_format = ((PyObject *)__pyx_t_12);
+    __pyx_t_12 = 0;
     goto __pyx_L46;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":691
+    /* "cvcf.pyx":691
  *         # Gracefully deal with absent FORMAT column
  *         if cols[8] == "": format = []
  *         else: format = cols[8].split(':')             # <<<<<<<<<<<<<<
  * 
  *         # check: all filters are defined
  */
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__split); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_2 = PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_format = __pyx_t_12;
+    __pyx_t_12 = 0;
   }
   __pyx_L46:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":694
+  /* "cvcf.pyx":694
  * 
  *         # check: all filters are defined
  *         for f in filter:             # <<<<<<<<<<<<<<
@@ -13900,69 +13708,69 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  * 
  */
   if (PyList_CheckExact(__pyx_v_filter) || PyTuple_CheckExact(__pyx_v_filter)) {
-    __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_12);
   } else {
-    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
   }
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
+    if (likely(PyList_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
     } else {
-      __pyx_t_9 = PyIter_Next(__pyx_t_2);
-      if (!__pyx_t_9) {
+      __pyx_t_10 = PyIter_Next(__pyx_t_12);
+      if (!__pyx_t_10) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(__pyx_t_10);
     }
     __Pyx_DECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_v_f = __pyx_t_10;
+    __pyx_t_10 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":695
+    /* "cvcf.pyx":695
  *         # check: all filters are defined
  *         for f in filter:
  *             if f not in self._filter: self.error(line,self.FILTER_NOT_DEFINED, f)             # <<<<<<<<<<<<<<
  * 
  *         # check: format fields are defined
  */
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_8 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_9, __pyx_v_f))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (__pyx_t_8) {
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_7 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, __pyx_v_f))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    if (__pyx_t_7) {
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
-      __Pyx_GIVEREF(__pyx_t_11);
+      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
+      __Pyx_GIVEREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_v_f);
-      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_f);
+      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
-      __pyx_t_11 = 0;
-      __pyx_t_11 = PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       goto __pyx_L49;
     }
     __pyx_L49:;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":698
+  /* "cvcf.pyx":698
  * 
  *         # check: format fields are defined
  *         for f in format:             # <<<<<<<<<<<<<<
@@ -13970,129 +13778,129 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  * 
  */
   if (PyList_CheckExact(__pyx_v_format) || PyTuple_CheckExact(__pyx_v_format)) {
-    __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_format; __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_format; __Pyx_INCREF(__pyx_t_12);
   } else {
-    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
   }
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_11); __pyx_t_5++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_11); __pyx_t_5++;
+    if (likely(PyList_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
     } else {
-      __pyx_t_11 = PyIter_Next(__pyx_t_2);
-      if (!__pyx_t_11) {
+      __pyx_t_1 = PyIter_Next(__pyx_t_12);
+      if (!__pyx_t_1) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_GOTREF(__pyx_t_1);
     }
     __Pyx_DECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_11;
-    __pyx_t_11 = 0;
+    __pyx_v_f = __pyx_t_1;
+    __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":699
+    /* "cvcf.pyx":699
  *         # check: format fields are defined
  *         for f in format:
  *             if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f)             # <<<<<<<<<<<<<<
  * 
  *         # convert v3.3 alleles
  */
-    __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_8 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_11, __pyx_v_f))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    if (__pyx_t_8) {
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_7 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_1, __pyx_v_f))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (__pyx_t_7) {
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
-      __Pyx_GIVEREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
+      __Pyx_GIVEREF(__pyx_t_11);
       __Pyx_INCREF(__pyx_v_f);
-      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_f);
+      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
-      __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_11 = 0;
+      __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L52;
     }
     __pyx_L52:;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":702
+  /* "cvcf.pyx":702
  * 
  *         # convert v3.3 alleles
  *         if self._version == 33:             # <<<<<<<<<<<<<<
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
  *             newalts = []
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_2, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_11);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+  if (__pyx_t_7) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":703
+    /* "cvcf.pyx":703
  *         # convert v3.3 alleles
  *         if self._version == 33:
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)             # <<<<<<<<<<<<<<
  *             newalts = []
  *             have_deletions = False
  */
-    __pyx_t_5 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = (__pyx_t_5 != 1);
-    if (__pyx_t_8) {
-      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = (__pyx_t_4 != 1);
+    if (__pyx_t_7) {
+      __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
+      __Pyx_GIVEREF(__pyx_t_12);
+      __pyx_t_12 = 0;
+      __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       goto __pyx_L54;
     }
     __pyx_L54:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":704
+    /* "cvcf.pyx":704
  *         if self._version == 33:
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
  *             newalts = []             # <<<<<<<<<<<<<<
  *             have_deletions = False
  *             for a in alt:
  */
-    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_12));
     __Pyx_DECREF(((PyObject *)__pyx_v_newalts));
-    __pyx_v_newalts = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_newalts = __pyx_t_12;
+    __pyx_t_12 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":705
+    /* "cvcf.pyx":705
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
  *             newalts = []
  *             have_deletions = False             # <<<<<<<<<<<<<<
@@ -14101,7 +13909,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     __pyx_v_have_deletions = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":706
+    /* "cvcf.pyx":706
  *             newalts = []
  *             have_deletions = False
  *             for a in alt:             # <<<<<<<<<<<<<<
@@ -14109,115 +13917,103 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  */
     if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-      __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+      __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
     } else {
-      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_2))) {
-        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
+      if (likely(PyList_CheckExact(__pyx_t_12))) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
       } else {
-        __pyx_t_9 = PyIter_Next(__pyx_t_2);
-        if (!__pyx_t_9) {
+        __pyx_t_10 = PyIter_Next(__pyx_t_12);
+        if (!__pyx_t_10) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_10);
       }
       __Pyx_DECREF(__pyx_v_a);
-      __pyx_v_a = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_a = __pyx_t_10;
+      __pyx_t_10 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":707
+      /* "cvcf.pyx":707
  *             have_deletions = False
  *             for a in alt:
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference             # <<<<<<<<<<<<<<
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  */
-      __pyx_t_4 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = (__pyx_t_4 == 1);
-      if (__pyx_t_8) {
-        __pyx_t_9 = PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyNumber_Add(__pyx_v_a, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = (__pyx_t_3 == 1);
+      if (__pyx_t_7) {
+        __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_11 = PyNumber_Add(__pyx_v_a, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_11);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_a = __pyx_t_11;
+        __pyx_t_11 = 0;
         goto __pyx_L57;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":708
+      /* "cvcf.pyx":708
  *             for a in alt:
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference             # <<<<<<<<<<<<<<
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True
  */
-      __pyx_t_10 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_INCREF(((PyObject *)__pyx_n_s__I));
-      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_n_s__I));
-      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
-      __pyx_t_11 = PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      if (__pyx_t_8) {
-        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      if (__pyx_t_7) {
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_11);
-        __pyx_t_9 = PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_11);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_11;
-        __pyx_t_11 = 0;
+        __pyx_v_a = __pyx_t_10;
+        __pyx_t_10 = 0;
         goto __pyx_L57;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":709
+      /* "cvcf.pyx":709
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  *                 elif a.startswith('D'): # allow D<seq> and D<num>             # <<<<<<<<<<<<<<
  *                     have_deletions = True
  *                     try:
  */
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
-      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_n_s__D));
-      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
-      __pyx_t_10 = PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      if (__pyx_t_8) {
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      if (__pyx_t_7) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":710
+        /* "cvcf.pyx":710
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True             # <<<<<<<<<<<<<<
@@ -14226,7 +14022,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
         __pyx_v_have_deletions = 1;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":711
+        /* "cvcf.pyx":711
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True
  *                     try:             # <<<<<<<<<<<<<<
@@ -14241,99 +14037,99 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
           __Pyx_XGOTREF(__pyx_save_exc_tb);
           /*try:*/ {
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":712
+            /* "cvcf.pyx":712
  *                     have_deletions = True
  *                     try:
  *                         l = int(a[1:])          # throws ValueError if sequence             # <<<<<<<<<<<<<<
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  */
-            __pyx_t_10 = PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __Pyx_GOTREF(__pyx_t_10);
-            __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __Pyx_GOTREF(__pyx_t_9);
-            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
-            __Pyx_GIVEREF(__pyx_t_10);
-            __pyx_t_10 = 0;
-            __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __Pyx_GOTREF(__pyx_t_10);
-            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+            __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __Pyx_GOTREF(__pyx_t_11);
+            __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+            PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
+            __Pyx_GIVEREF(__pyx_t_11);
+            __pyx_t_11 = 0;
+            __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __Pyx_GOTREF(__pyx_t_11);
+            __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
             __Pyx_DECREF(__pyx_v_l);
-            __pyx_v_l = __pyx_t_10;
-            __pyx_t_10 = 0;
+            __pyx_v_l = __pyx_t_11;
+            __pyx_t_11 = 0;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":713
+            /* "cvcf.pyx":713
  *                     try:
  *                         l = int(a[1:])          # throws ValueError if sequence
  *                         if len(ref) < l:        # add to reference if necessary             # <<<<<<<<<<<<<<
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns
  */
-            __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __Pyx_GOTREF(__pyx_t_11);
+            __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
             __Pyx_GOTREF(__pyx_t_10);
-            __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __Pyx_GOTREF(__pyx_t_9);
+            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+            __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-            __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-            if (__pyx_t_8) {
+            if (__pyx_t_7) {
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":714
+              /* "cvcf.pyx":714
  *                         l = int(a[1:])          # throws ValueError if sequence
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)             # <<<<<<<<<<<<<<
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  */
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_11 = PyNumber_Add(__pyx_v_pos, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
               __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __Pyx_GOTREF(__pyx_t_3);
+              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __Pyx_GOTREF(__pyx_t_9);
+              __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_2));
               __Pyx_INCREF(__pyx_v_chrom);
-              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
+              PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
               __Pyx_GIVEREF(__pyx_v_chrom);
-              PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11);
+              PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
+              __Pyx_GIVEREF(__pyx_t_1);
+              PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_11);
               __Pyx_GIVEREF(__pyx_t_11);
-              PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_10);
-              __Pyx_GIVEREF(__pyx_t_10);
-              PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_12);
-              __Pyx_GIVEREF(__pyx_t_12);
+              PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9);
+              __Pyx_GIVEREF(__pyx_t_9);
+              __pyx_t_1 = 0;
               __pyx_t_11 = 0;
-              __pyx_t_10 = 0;
-              __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+              __pyx_t_9 = 0;
+              __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
               __Pyx_DECREF(__pyx_v_addns);
-              __pyx_v_addns = __pyx_t_12;
-              __pyx_t_12 = 0;
+              __pyx_v_addns = __pyx_t_9;
+              __pyx_t_9 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":715
+              /* "cvcf.pyx":715
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns             # <<<<<<<<<<<<<<
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
  */
-              __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addns); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              __Pyx_GOTREF(__pyx_t_12);
+              __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addns); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+              __Pyx_GOTREF(__pyx_t_9);
               __Pyx_DECREF(__pyx_v_ref);
-              __pyx_v_ref = __pyx_t_12;
-              __pyx_t_12 = 0;
+              __pyx_v_ref = __pyx_t_9;
+              __pyx_t_9 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":716
+              /* "cvcf.pyx":716
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns             # <<<<<<<<<<<<<<
@@ -14341,64 +14137,60 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                     except ValueError:
  */
               __Pyx_INCREF(__pyx_int_0);
-              __pyx_t_12 = __pyx_int_0;
-              if (likely(((PyObject *)__pyx_v_newalts) != Py_None)) {
-                __pyx_t_4 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_3);
-              } else {
-                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-              }
+              __pyx_t_9 = __pyx_int_0;
+              __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_2);
               for (;;) {
-                if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
-                __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
+                if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+                __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_10); __pyx_t_3++;
                 __Pyx_DECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_9;
-                __pyx_t_9 = 0;
-                __Pyx_INCREF(__pyx_t_12);
+                __pyx_v_na = __pyx_t_10;
+                __pyx_t_10 = 0;
+                __Pyx_INCREF(__pyx_t_9);
                 __Pyx_DECREF(__pyx_v_i);
-                __pyx_v_i = __pyx_t_12;
-                __pyx_t_9 = PyNumber_Add(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-                __Pyx_GOTREF(__pyx_t_9);
-                __Pyx_DECREF(__pyx_t_12);
-                __pyx_t_12 = __pyx_t_9;
-                __pyx_t_9 = 0;
-                __pyx_t_9 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-                __Pyx_GOTREF(__pyx_t_9);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+                __pyx_v_i = __pyx_t_9;
+                __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+                __Pyx_GOTREF(__pyx_t_10);
+                __Pyx_DECREF(__pyx_t_9);
+                __pyx_t_9 = __pyx_t_10;
+                __pyx_t_10 = 0;
+                __pyx_t_10 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+                __Pyx_GOTREF(__pyx_t_10);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
               }
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
               goto __pyx_L66;
             }
             __pyx_L66:;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":717
+            /* "cvcf.pyx":717
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l             # <<<<<<<<<<<<<<
  *                     except ValueError:
  *                         s = a[1:]
  */
-            __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_l); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __pyx_t_12 = PySequence_GetSlice(__pyx_v_ref, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
-            __Pyx_GOTREF(__pyx_t_12);
+            __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_l); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+            __Pyx_GOTREF(__pyx_t_9);
             __Pyx_DECREF(__pyx_v_a);
-            __pyx_v_a = __pyx_t_12;
-            __pyx_t_12 = 0;
+            __pyx_v_a = __pyx_t_9;
+            __pyx_t_9 = 0;
           }
           __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
           __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
           __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
           goto __pyx_L65_try_end;
           __pyx_L58_error:;
+          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":718
+          /* "cvcf.pyx":718
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
  *                     except ValueError:             # <<<<<<<<<<<<<<
@@ -14408,180 +14200,180 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
           __pyx_t_16 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
           if (__pyx_t_16) {
             __Pyx_AddTraceback("cvcf.VCF.parse_data");
-            if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_3, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-            __Pyx_GOTREF(__pyx_t_12);
-            __Pyx_GOTREF(__pyx_t_3);
+            if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
             __Pyx_GOTREF(__pyx_t_9);
+            __Pyx_GOTREF(__pyx_t_2);
+            __Pyx_GOTREF(__pyx_t_10);
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":719
+            /* "cvcf.pyx":719
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
  *                     except ValueError:
  *                         s = a[1:]             # <<<<<<<<<<<<<<
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  */
-            __pyx_t_10 = PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-            __Pyx_GOTREF(__pyx_t_10);
+            __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+            __Pyx_GOTREF(__pyx_t_11);
             __Pyx_DECREF(__pyx_v_s);
-            __pyx_v_s = __pyx_t_10;
-            __pyx_t_10 = 0;
+            __pyx_v_s = __pyx_t_11;
+            __pyx_t_11 = 0;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":720
+            /* "cvcf.pyx":720
  *                     except ValueError:
  *                         s = a[1:]
  *                         if len(ref) < len(s):   # add Ns to reference if necessary             # <<<<<<<<<<<<<<
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  */
-            __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+            __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
             __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-            __pyx_t_8 = (__pyx_t_4 < __pyx_t_17);
-            if (__pyx_t_8) {
+            __pyx_t_7 = (__pyx_t_3 < __pyx_t_17);
+            if (__pyx_t_7) {
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":721
+              /* "cvcf.pyx":721
  *                         s = a[1:]
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)             # <<<<<<<<<<<<<<
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(line,self.V33_UNMATCHED_DELETION,
  */
-              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_17 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
               __Pyx_GOTREF(__pyx_t_11);
-              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __pyx_t_17 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_8 = PyNumber_Add(__pyx_v_pos, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __Pyx_GOTREF(__pyx_t_8);
+              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __pyx_t_18 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __Pyx_GOTREF(__pyx_t_1);
+              __pyx_t_18 = PyNumber_Add(__pyx_v_pos, __pyx_t_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
               __Pyx_GOTREF(__pyx_t_18);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __Pyx_GOTREF(__pyx_t_1);
               __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_19);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_19));
               __Pyx_INCREF(__pyx_v_chrom);
               PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_chrom);
               __Pyx_GIVEREF(__pyx_v_chrom);
-              PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_1);
-              __Pyx_GIVEREF(__pyx_t_1);
+              PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_8);
+              __Pyx_GIVEREF(__pyx_t_8);
               PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_18);
               __Pyx_GIVEREF(__pyx_t_18);
-              PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_11);
-              __Pyx_GIVEREF(__pyx_t_11);
-              __pyx_t_1 = 0;
+              PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_1);
+              __Pyx_GIVEREF(__pyx_t_1);
+              __pyx_t_8 = 0;
               __pyx_t_18 = 0;
-              __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_Call(__pyx_t_10, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
+              __pyx_t_1 = 0;
+              __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
               __Pyx_DECREF(__pyx_v_addns);
-              __pyx_v_addns = __pyx_t_11;
-              __pyx_t_11 = 0;
+              __pyx_v_addns = __pyx_t_1;
+              __pyx_t_1 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":722
+              /* "cvcf.pyx":722
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):             # <<<<<<<<<<<<<<
  *                                 self.error(line,self.V33_UNMATCHED_DELETION,
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  */
-              __pyx_t_11 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__endswith); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_1 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__endswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __Pyx_GOTREF(__pyx_t_1);
               __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_19);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_19));
               __Pyx_INCREF(__pyx_v_addns);
               PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_addns);
               __Pyx_GIVEREF(__pyx_v_addns);
-              __pyx_t_10 = PyObject_Call(__pyx_t_11, __pyx_t_19, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
+              __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
               __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
-              __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_6 = (!__pyx_t_8);
-              if (__pyx_t_6) {
+              __pyx_t_5 = (!__pyx_t_7);
+              if (__pyx_t_5) {
                 __pyx_t_17 = PyObject_Length(__pyx_v_addns); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_10);
-                __pyx_t_19 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_10); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_11);
+                __pyx_t_19 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_11); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(((PyObject *)__pyx_t_19));
-                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-                __pyx_t_10 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_19), Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_10);
+                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+                __pyx_t_11 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_19), Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_11);
                 __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
-                __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-                __pyx_t_15 = __pyx_t_8;
+                __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+                __pyx_t_15 = __pyx_t_7;
               } else {
-                __pyx_t_15 = __pyx_t_6;
+                __pyx_t_15 = __pyx_t_5;
               }
               if (__pyx_t_15) {
 
-                /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":723
+                /* "cvcf.pyx":723
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(line,self.V33_UNMATCHED_DELETION,             # <<<<<<<<<<<<<<
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns
  */
-                __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_10);
-                __pyx_t_19 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_65); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_11);
+                __pyx_t_19 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_111); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(__pyx_t_19);
 
-                /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":724
+                /* "cvcf.pyx":724
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(line,self.V33_UNMATCHED_DELETION,
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))             # <<<<<<<<<<<<<<
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  */
-                __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_11);
+                __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_1);
                 __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(__pyx_t_18);
-                __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
+                __pyx_t_8 = PyNumber_Add(__pyx_v_pos, __pyx_t_18); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_8);
                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                 __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(__pyx_t_18);
                 __pyx_t_20 = PyTuple_New(4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_20);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_20));
                 __Pyx_INCREF(__pyx_v_chrom);
                 PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_chrom);
                 __Pyx_GIVEREF(__pyx_v_chrom);
                 __Pyx_INCREF(__pyx_v_pos);
                 PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_pos);
                 __Pyx_GIVEREF(__pyx_v_pos);
-                PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_1);
-                __Pyx_GIVEREF(__pyx_t_1);
+                PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_8);
+                __Pyx_GIVEREF(__pyx_t_8);
                 PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_t_18);
                 __Pyx_GIVEREF(__pyx_t_18);
-                __pyx_t_1 = 0;
+                __pyx_t_8 = 0;
                 __pyx_t_18 = 0;
-                __pyx_t_18 = PyObject_Call(__pyx_t_11, __pyx_t_20, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __pyx_t_18 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(__pyx_t_18);
-                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-                __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+                __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
                 __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_20);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_20));
                 __Pyx_INCREF(__pyx_v_a);
                 PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_a);
                 __Pyx_GIVEREF(__pyx_v_a);
                 PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18);
                 __Pyx_GIVEREF(__pyx_t_18);
                 __pyx_t_18 = 0;
-                __pyx_t_18 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), __pyx_t_20); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __pyx_t_18 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_112), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(((PyObject *)__pyx_t_18));
-                __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+                __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
                 __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_20);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_20));
                 __Pyx_INCREF(__pyx_v_line);
                 PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_line);
                 __Pyx_GIVEREF(__pyx_v_line);
@@ -14591,16 +14383,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
                 __Pyx_GIVEREF(((PyObject *)__pyx_t_18));
                 __pyx_t_19 = 0;
                 __pyx_t_18 = 0;
-                __pyx_t_18 = PyObject_Call(__pyx_t_10, __pyx_t_20, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __pyx_t_18 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
                 __Pyx_GOTREF(__pyx_t_18);
-                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-                __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+                __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
                 goto __pyx_L72;
               }
               __pyx_L72:;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":725
+              /* "cvcf.pyx":725
  *                                 self.error(line,self.V33_UNMATCHED_DELETION,
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns             # <<<<<<<<<<<<<<
@@ -14613,7 +14405,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
               __pyx_v_ref = __pyx_t_18;
               __pyx_t_18 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":726
+              /* "cvcf.pyx":726
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns             # <<<<<<<<<<<<<<
@@ -14622,29 +14414,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
               __Pyx_INCREF(__pyx_int_0);
               __pyx_t_18 = __pyx_int_0;
-              if (likely(((PyObject *)__pyx_v_newalts) != Py_None)) {
-                __pyx_t_17 = 0; __pyx_t_20 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_20);
-              } else {
-                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-              }
+              __pyx_t_17 = 0; __pyx_t_20 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_20);
               for (;;) {
                 if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_20)) break;
-                __pyx_t_10 = PyList_GET_ITEM(__pyx_t_20, __pyx_t_17); __Pyx_INCREF(__pyx_t_10); __pyx_t_17++;
+                __pyx_t_11 = PyList_GET_ITEM(__pyx_t_20, __pyx_t_17); __Pyx_INCREF(__pyx_t_11); __pyx_t_17++;
                 __Pyx_DECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_10;
-                __pyx_t_10 = 0;
+                __pyx_v_na = __pyx_t_11;
+                __pyx_t_11 = 0;
                 __Pyx_INCREF(__pyx_t_18);
                 __Pyx_DECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_18;
-                __pyx_t_10 = PyNumber_Add(__pyx_t_18, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_10);
+                __pyx_t_11 = PyNumber_Add(__pyx_t_18, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_11);
                 __Pyx_DECREF(__pyx_t_18);
-                __pyx_t_18 = __pyx_t_10;
-                __pyx_t_10 = 0;
-                __pyx_t_10 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_GOTREF(__pyx_t_10);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+                __pyx_t_18 = __pyx_t_11;
+                __pyx_t_11 = 0;
+                __pyx_t_11 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_GOTREF(__pyx_t_11);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
               }
               __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
               __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
@@ -14652,7 +14440,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
             }
             __pyx_L71:;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":727
+            /* "cvcf.pyx":727
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[len(s):]        # new deletion, deleting from pos             # <<<<<<<<<<<<<<
@@ -14660,14 +14448,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                     self.error(line,self.V33_BAD_ALLELE)
  */
             __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
-            __pyx_t_18 = PySequence_GetSlice(__pyx_v_ref, __pyx_t_17, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
+            __pyx_t_18 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_17, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;}
             __Pyx_GOTREF(__pyx_t_18);
             __Pyx_DECREF(__pyx_v_a);
             __pyx_v_a = __pyx_t_18;
             __pyx_t_18 = 0;
-            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             goto __pyx_L59_exception_handled;
           }
           __pyx_L60_except_error:;
@@ -14687,34 +14475,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":729
+        /* "cvcf.pyx":729
  *                         a = ref[len(s):]        # new deletion, deleting from pos
  *                 else:
  *                     self.error(line,self.V33_BAD_ALLELE)             # <<<<<<<<<<<<<<
  *                 newalts.append(a)
  *             alt = newalts
  */
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_ALLELE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_12);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_ALLELE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3);
-        __Pyx_GIVEREF(__pyx_t_3);
-        __pyx_t_3 = 0;
-        __pyx_t_3 = PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
       __pyx_L57:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":730
+      /* "cvcf.pyx":730
  *                 else:
  *                     self.error(line,self.V33_BAD_ALLELE)
  *                 newalts.append(a)             # <<<<<<<<<<<<<<
@@ -14724,11 +14512,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       if (unlikely(__pyx_v_newalts == Py_None)) {
         PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
-      __pyx_t_16 = PyList_Append(((PyObject *)__pyx_v_newalts), __pyx_v_a); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_16 = PyList_Append(__pyx_v_newalts, __pyx_v_a); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":731
+    /* "cvcf.pyx":731
  *                     self.error(line,self.V33_BAD_ALLELE)
  *                 newalts.append(a)
  *             alt = newalts             # <<<<<<<<<<<<<<
@@ -14739,7 +14527,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __Pyx_DECREF(__pyx_v_alt);
     __pyx_v_alt = ((PyObject *)__pyx_v_newalts);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":733
+    /* "cvcf.pyx":733
  *             alt = newalts
  *             # deletion alleles exist, add dummy 1st reference allele, and account for leading base
  *             if have_deletions:             # <<<<<<<<<<<<<<
@@ -14748,231 +14536,231 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     if (__pyx_v_have_deletions) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":734
+      /* "cvcf.pyx":734
  *             # deletion alleles exist, add dummy 1st reference allele, and account for leading base
  *             if have_deletions:
  *                 if pos == 0:             # <<<<<<<<<<<<<<
  *                     # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
  */
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_12 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       if (__pyx_t_15) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":736
+        /* "cvcf.pyx":736
  *                 if pos == 0:
  *                     # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)             # <<<<<<<<<<<<<<
  *                     ref += addn
  *                     alt = [allele+addn for allele in alt]
  */
-        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_5 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_12);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_5 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_18 = PyTuple_New(4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_18);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_18));
         __Pyx_INCREF(__pyx_v_chrom);
         PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
-        PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_12);
-        __Pyx_GIVEREF(__pyx_t_12);
-        PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_3);
-        __Pyx_GIVEREF(__pyx_t_3);
-        PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_9);
         __Pyx_GIVEREF(__pyx_t_9);
-        __pyx_t_12 = 0;
-        __pyx_t_3 = 0;
+        PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
         __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+        __pyx_t_2 = 0;
+        __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
         __Pyx_DECREF(__pyx_v_addn);
-        __pyx_v_addn = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_addn = __pyx_t_10;
+        __pyx_t_10 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":737
+        /* "cvcf.pyx":737
  *                     # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
  *                     ref += addn             # <<<<<<<<<<<<<<
  *                     alt = [allele+addn for allele in alt]
  *                 else:
  */
-        __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_ref = __pyx_t_10;
+        __pyx_t_10 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":738
+        /* "cvcf.pyx":738
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
  *                     ref += addn
  *                     alt = [allele+addn for allele in alt]             # <<<<<<<<<<<<<<
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  */
-        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+        __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-          __pyx_t_5 = 0; __pyx_t_18 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_18);
+          __pyx_t_4 = 0; __pyx_t_18 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_18);
         } else {
-          __pyx_t_5 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_4 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_18);
         }
         for (;;) {
           if (likely(PyList_CheckExact(__pyx_t_18))) {
-            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_18)) break;
-            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_18)) break;
+            __pyx_t_12 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
           } else if (likely(PyTuple_CheckExact(__pyx_t_18))) {
-            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
-            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
+            __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
           } else {
-            __pyx_t_2 = PyIter_Next(__pyx_t_18);
-            if (!__pyx_t_2) {
+            __pyx_t_12 = PyIter_Next(__pyx_t_18);
+            if (!__pyx_t_12) {
               if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               break;
             }
-            __Pyx_GOTREF(__pyx_t_2);
+            __Pyx_GOTREF(__pyx_t_12);
           }
           __Pyx_DECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_2;
-          __pyx_t_2 = 0;
-          __pyx_t_2 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          if (unlikely(PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_v_allele = __pyx_t_12;
+          __pyx_t_12 = 0;
+          __pyx_t_12 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_12);
+          if (unlikely(PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         }
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_9));
+        __Pyx_INCREF(((PyObject *)__pyx_t_10));
         __Pyx_DECREF(__pyx_v_alt);
-        __pyx_v_alt = ((PyObject *)__pyx_t_9);
-        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __pyx_v_alt = ((PyObject *)__pyx_t_10);
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         goto __pyx_L76;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":740
+        /* "cvcf.pyx":740
  *                     alt = [allele+addn for allele in alt]
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)             # <<<<<<<<<<<<<<
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]
  */
-        __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_18 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
+        __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_chrom);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
-        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_18);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_18);
         __Pyx_GIVEREF(__pyx_t_18);
         __Pyx_INCREF(__pyx_v_pos);
-        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_pos);
+        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_pos);
         __Pyx_GIVEREF(__pyx_v_pos);
-        PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_12);
+        __Pyx_GIVEREF(__pyx_t_12);
         __pyx_t_18 = 0;
-        __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_12 = 0;
+        __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_v_addn);
-        __pyx_v_addn = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_addn = __pyx_t_12;
+        __pyx_t_12 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":741
+        /* "cvcf.pyx":741
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  *                     ref = addn + ref             # <<<<<<<<<<<<<<
  *                     alt = [addn + allele for allele in alt]
  *                     pos -= 1
  */
-        __pyx_t_2 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_12 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_ref = __pyx_t_12;
+        __pyx_t_12 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":742
+        /* "cvcf.pyx":742
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]             # <<<<<<<<<<<<<<
  *                     pos -= 1
  *         else:
  */
-        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_12));
         if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-          __pyx_t_5 = 0; __pyx_t_3 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_3);
+          __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
         } else {
-          __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
         }
         for (;;) {
-          if (likely(PyList_CheckExact(__pyx_t_3))) {
-            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
-            __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
-          } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
-            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-            __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
+          if (likely(PyList_CheckExact(__pyx_t_2))) {
+            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+          } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
           } else {
-            __pyx_t_9 = PyIter_Next(__pyx_t_3);
-            if (!__pyx_t_9) {
+            __pyx_t_10 = PyIter_Next(__pyx_t_2);
+            if (!__pyx_t_10) {
               if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               break;
             }
-            __Pyx_GOTREF(__pyx_t_9);
+            __Pyx_GOTREF(__pyx_t_10);
           }
           __Pyx_DECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_9;
-          __pyx_t_9 = 0;
-          __pyx_t_9 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          __pyx_v_allele = __pyx_t_10;
+          __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          if (unlikely(PyList_Append(__pyx_t_12, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         }
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_2));
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_INCREF(((PyObject *)__pyx_t_12));
         __Pyx_DECREF(__pyx_v_alt);
-        __pyx_v_alt = ((PyObject *)__pyx_t_2);
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_v_alt = ((PyObject *)__pyx_t_12);
+        __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":743
+        /* "cvcf.pyx":743
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]
  *                     pos -= 1             # <<<<<<<<<<<<<<
  *         else:
  *             # format v4.0 -- just check for nucleotides
  */
-        __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_12 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
         __Pyx_DECREF(__pyx_v_pos);
-        __pyx_v_pos = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_pos = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
       __pyx_L76:;
       goto __pyx_L75;
@@ -14982,7 +14770,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":746
+    /* "cvcf.pyx":746
  *         else:
  *             # format v4.0 -- just check for nucleotides
  *             for allele in alt:             # <<<<<<<<<<<<<<
@@ -14990,57 +14778,57 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                     self.error(line,self.V40_BAD_ALLELE,allele)
  */
     if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-      __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+      __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
     } else {
-      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_2))) {
-        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
+      if (likely(PyList_CheckExact(__pyx_t_12))) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else {
-        __pyx_t_3 = PyIter_Next(__pyx_t_2);
-        if (!__pyx_t_3) {
+        __pyx_t_2 = PyIter_Next(__pyx_t_12);
+        if (!__pyx_t_2) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_GOTREF(__pyx_t_2);
       }
       __Pyx_DECREF(__pyx_v_allele);
-      __pyx_v_allele = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_allele = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":747
+      /* "cvcf.pyx":747
  *             # format v4.0 -- just check for nucleotides
  *             for allele in alt:
  *                 if not alleleRegEx.match(allele):             # <<<<<<<<<<<<<<
  *                     self.error(line,self.V40_BAD_ALLELE,allele)
  * 
  */
-      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__match); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_INCREF(__pyx_v_allele);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_allele);
+      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__match); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __Pyx_INCREF(__pyx_v_allele);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_allele);
       __Pyx_GIVEREF(__pyx_v_allele);
-      __pyx_t_18 = PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_18 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-      __pyx_t_6 = (!__pyx_t_15);
-      if (__pyx_t_6) {
+      __pyx_t_5 = (!__pyx_t_15);
+      if (__pyx_t_5) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":748
+        /* "cvcf.pyx":748
  *             for allele in alt:
  *                 if not alleleRegEx.match(allele):
  *                     self.error(line,self.V40_BAD_ALLELE,allele)             # <<<<<<<<<<<<<<
@@ -15049,33 +14837,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
         __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
-        __Pyx_GIVEREF(__pyx_t_3);
+        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_allele);
-        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_allele);
+        PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_allele);
         __Pyx_GIVEREF(__pyx_v_allele);
-        __pyx_t_3 = 0;
-        __pyx_t_3 = PyObject_Call(__pyx_t_18, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         goto __pyx_L83;
       }
       __pyx_L83:;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
   }
   __pyx_L53:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":751
+  /* "cvcf.pyx":751
  * 
  *         # check for leading nucleotide in indel calls
  *         for allele in alt:             # <<<<<<<<<<<<<<
@@ -15083,31 +14871,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
  */
   if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-    __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
   } else {
-    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
   }
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
+    if (likely(PyList_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else {
-      __pyx_t_3 = PyIter_Next(__pyx_t_2);
-      if (!__pyx_t_3) {
+      __pyx_t_2 = PyIter_Next(__pyx_t_12);
+      if (!__pyx_t_2) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_GOTREF(__pyx_t_2);
     }
     __Pyx_DECREF(__pyx_v_allele);
-    __pyx_v_allele = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_allele = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":752
+    /* "cvcf.pyx":752
  *         # check for leading nucleotide in indel calls
  *         for allele in alt:
  *             if len(allele) != len(ref):             # <<<<<<<<<<<<<<
@@ -15115,116 +14903,116 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                 if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
  */
     __pyx_t_17 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = (__pyx_t_17 != __pyx_t_4);
-    if (__pyx_t_6) {
+    __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = (__pyx_t_17 != __pyx_t_3);
+    if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":753
+      /* "cvcf.pyx":753
  *         for allele in alt:
  *             if len(allele) != len(ref):
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)             # <<<<<<<<<<<<<<
  *                 if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
  *                     self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
  */
-      __pyx_t_4 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_6 = (__pyx_t_4 == 0);
-      if (__pyx_t_6) {
-        __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_3 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = (__pyx_t_3 == 0);
+      if (__pyx_t_5) {
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_18);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_18));
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
-        __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_3, __pyx_t_18, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
+        __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         goto __pyx_L87;
       }
       __pyx_L87:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":754
+      /* "cvcf.pyx":754
  *             if len(allele) != len(ref):
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
  *                 if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():             # <<<<<<<<<<<<<<
  *                     self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
  * 
  */
-      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_18 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_18 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
       __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_18, __pyx_n_s__upper); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_t_18, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-      __pyx_t_18 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_18 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_18, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_18, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (__pyx_t_5) {
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __pyx_t_9 = PyNumber_Add(__pyx_t_3, __pyx_t_18); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_t_18); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __pyx_t_18 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_18 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __pyx_t_15 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_9, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_8 = __pyx_t_15;
+        __pyx_t_15 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_7 = __pyx_t_15;
       } else {
-        __pyx_t_8 = __pyx_t_6;
+        __pyx_t_7 = __pyx_t_5;
       }
-      if (__pyx_t_8) {
+      if (__pyx_t_7) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":755
+        /* "cvcf.pyx":755
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
  *                 if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
  *                     self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)             # <<<<<<<<<<<<<<
  * 
  *         # trim trailing bases in alleles
  */
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_67); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_113); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_18);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_18);
         __Pyx_GIVEREF(__pyx_t_18);
         __pyx_t_18 = 0;
-        __pyx_t_18 = PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_18 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
         goto __pyx_L88;
       }
@@ -15233,171 +15021,181 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     }
     __pyx_L86:;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":758
+  /* "cvcf.pyx":758
  * 
  *         # trim trailing bases in alleles
  *         for i in range(1,min(len(ref),min(map(len,alt)))):             # <<<<<<<<<<<<<<
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
  *                 break
  */
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
   __Pyx_INCREF(__pyx_builtin_len);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_len);
+  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_builtin_len);
   __Pyx_GIVEREF(__pyx_builtin_len);
   __Pyx_INCREF(__pyx_v_alt);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_alt);
+  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_alt);
   __Pyx_GIVEREF(__pyx_v_alt);
-  __pyx_t_18 = PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_18 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_18);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_18);
+  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
+  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_18);
   __Pyx_GIVEREF(__pyx_t_18);
   __pyx_t_18 = 0;
-  __pyx_t_18 = PyObject_Call(__pyx_builtin_min, __pyx_t_2, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_18 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_18);
+  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+  __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_18, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_18, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  if (__pyx_t_7) {
     __Pyx_INCREF(__pyx_t_18);
-    __pyx_t_2 = __pyx_t_18;
+    __pyx_t_12 = __pyx_t_18;
   } else {
-    __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_2 = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_12 = __pyx_t_10;
+    __pyx_t_10 = 0;
   }
   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
   __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_18);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_18));
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
-  __Pyx_INCREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-    __pyx_t_5 = 0; __pyx_t_18 = __pyx_t_2; __Pyx_INCREF(__pyx_t_18);
+  __Pyx_INCREF(__pyx_t_12);
+  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
+  if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) {
+    __pyx_t_4 = 0; __pyx_t_18 = __pyx_t_12; __Pyx_INCREF(__pyx_t_18);
   } else {
-    __pyx_t_5 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_18);
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
   for (;;) {
     if (likely(PyList_CheckExact(__pyx_t_18))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_18)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_18)) break;
+      __pyx_t_12 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
     } else if (likely(PyTuple_CheckExact(__pyx_t_18))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
+      __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
     } else {
-      __pyx_t_2 = PyIter_Next(__pyx_t_18);
-      if (!__pyx_t_2) {
+      __pyx_t_12 = PyIter_Next(__pyx_t_18);
+      if (!__pyx_t_12) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_12);
     }
     __Pyx_DECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_i = __pyx_t_12;
+    __pyx_t_12 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":759
+    /* "cvcf.pyx":759
  *         # trim trailing bases in alleles
  *         for i in range(1,min(len(ref),min(map(len,alt)))):
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():             # <<<<<<<<<<<<<<
  *                 break
  *             ref, alt = ref[:-1], [allele[:-1] for allele in alt]
  */
-    __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-      __pyx_t_4 = 0; __pyx_t_9 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_9);
-    } else {
-      __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-    }
-    for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_9))) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
-        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
+    { /* enter inner scope */
+      PyObject *__pyx_7genexpr__pyx_v_allele;
+      __pyx_7genexpr__pyx_v_allele = Py_None; __Pyx_INCREF(Py_None);
+      __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
+      if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
+        __pyx_t_3 = 0; __pyx_t_10 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_10);
       } else {
-        __pyx_t_3 = PyIter_Next(__pyx_t_9);
-        if (!__pyx_t_3) {
-          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          break;
+        __pyx_t_3 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+      }
+      for (;;) {
+        if (likely(PyList_CheckExact(__pyx_t_10))) {
+          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_10)) break;
+          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+        } else if (likely(PyTuple_CheckExact(__pyx_t_10))) {
+          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
+          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+        } else {
+          __pyx_t_2 = PyIter_Next(__pyx_t_10);
+          if (!__pyx_t_2) {
+            if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+            break;
+          }
+          __Pyx_GOTREF(__pyx_t_2);
         }
-        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_DECREF(__pyx_7genexpr__pyx_v_allele);
+        __pyx_7genexpr__pyx_v_allele = __pyx_t_2;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_allele, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        if (unlikely(PySet_Add(__pyx_t_12, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
-      __Pyx_DECREF(__pyx_8genexpr0__pyx_v_allele);
-      __pyx_8genexpr0__pyx_v_allele = __pyx_t_3;
-      __pyx_t_3 = 0;
-      __pyx_t_3 = __Pyx_GetItemInt(__pyx_8genexpr0__pyx_v_allele, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_12 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_7genexpr__pyx_v_allele);
+      goto __pyx_L97_exit_scope;
+      __pyx_L94_error:;
+      __Pyx_DECREF(__pyx_7genexpr__pyx_v_allele);
+      goto __pyx_L1_error;
+      __pyx_L97_exit_scope:;
+    } /* exit inner scope */
+    __pyx_t_3 = PySet_Size(((PyObject *)__pyx_t_12)); 
+    __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+    __pyx_t_7 = (__pyx_t_3 > 1);
+    if (!__pyx_t_7) {
+      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      if (unlikely(PySet_Add(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    }
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_4 = PySet_Size(((PyObject *)__pyx_t_2)); 
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_8 = (__pyx_t_4 > 1);
-    if (!__pyx_t_8) {
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_15 = __pyx_t_6;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_15 = __pyx_t_5;
     } else {
-      __pyx_t_15 = __pyx_t_8;
+      __pyx_t_15 = __pyx_t_7;
     }
     if (__pyx_t_15) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":760
+      /* "cvcf.pyx":760
  *         for i in range(1,min(len(ref),min(map(len,alt)))):
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
  *                 break             # <<<<<<<<<<<<<<
@@ -15409,61 +15207,61 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     }
     __pyx_L91:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":761
+    /* "cvcf.pyx":761
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
  *                 break
  *             ref, alt = ref[:-1], [allele[:-1] for allele in alt]             # <<<<<<<<<<<<<<
  * 
  *         # left-align alleles, if a reference is available
  */
-    __pyx_t_9 = PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-      __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+      __pyx_t_3 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
     } else {
-      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_2))) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_12 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
+      if (likely(PyList_CheckExact(__pyx_t_12))) {
+        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_12)) break;
+        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++;
       } else {
-        __pyx_t_12 = PyIter_Next(__pyx_t_2);
-        if (!__pyx_t_12) {
+        __pyx_t_9 = PyIter_Next(__pyx_t_12);
+        if (!__pyx_t_9) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
         }
-        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_GOTREF(__pyx_t_9);
       }
       __Pyx_DECREF(__pyx_v_allele);
-      __pyx_v_allele = __pyx_t_12;
-      __pyx_t_12 = 0;
-      __pyx_t_12 = PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_allele = __pyx_t_9;
+      __pyx_t_9 = 0;
+      __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = ((PyObject *)__pyx_t_3);
-    __Pyx_INCREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __pyx_t_12 = ((PyObject *)__pyx_t_2);
+    __Pyx_INCREF(__pyx_t_12);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_ref);
-    __pyx_v_ref = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_v_ref = __pyx_t_10;
+    __pyx_t_10 = 0;
     __Pyx_DECREF(__pyx_v_alt);
-    __pyx_v_alt = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_alt = __pyx_t_12;
+    __pyx_t_12 = 0;
   }
   __pyx_L90_break:;
   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":764
+  /* "cvcf.pyx":764
  * 
  *         # left-align alleles, if a reference is available
  *         if self._leftalign and self._reference:             # <<<<<<<<<<<<<<
@@ -15477,15 +15275,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   if (__pyx_t_15) {
     __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_18);
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-    __pyx_t_6 = __pyx_t_8;
+    __pyx_t_5 = __pyx_t_7;
   } else {
-    __pyx_t_6 = __pyx_t_15;
+    __pyx_t_5 = __pyx_t_15;
   }
-  if (__pyx_t_6) {
+  if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":765
+    /* "cvcf.pyx":765
  *         # left-align alleles, if a reference is available
  *         if self._leftalign and self._reference:
  *             while left < pos:             # <<<<<<<<<<<<<<
@@ -15495,11 +15293,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     while (1) {
       __pyx_t_18 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-      if (!__pyx_t_6) break;
+      if (!__pyx_t_5) break;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":766
+      /* "cvcf.pyx":766
  *         if self._leftalign and self._reference:
  *             while left < pos:
  *                 movable = True             # <<<<<<<<<<<<<<
@@ -15508,7 +15306,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
       __pyx_v_movable = 1;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":767
+      /* "cvcf.pyx":767
  *             while left < pos:
  *                 movable = True
  *                 for allele in alt:             # <<<<<<<<<<<<<<
@@ -15516,84 +15314,84 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                         longest, shortest = allele, ref
  */
       if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-        __pyx_t_5 = 0; __pyx_t_18 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_18);
+        __pyx_t_4 = 0; __pyx_t_18 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_18);
       } else {
-        __pyx_t_5 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
       }
       for (;;) {
         if (likely(PyList_CheckExact(__pyx_t_18))) {
-          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_18)) break;
-          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_18)) break;
+          __pyx_t_12 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
         } else if (likely(PyTuple_CheckExact(__pyx_t_18))) {
-          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
-          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
+          __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
         } else {
-          __pyx_t_2 = PyIter_Next(__pyx_t_18);
-          if (!__pyx_t_2) {
+          __pyx_t_12 = PyIter_Next(__pyx_t_18);
+          if (!__pyx_t_12) {
             if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             break;
           }
-          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_GOTREF(__pyx_t_12);
         }
         __Pyx_DECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_allele = __pyx_t_12;
+        __pyx_t_12 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":768
+        /* "cvcf.pyx":768
  *                 movable = True
  *                 for allele in alt:
  *                     if len(allele) > len(ref):             # <<<<<<<<<<<<<<
  *                         longest, shortest = allele, ref
  *                     else:
  */
-        __pyx_t_4 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_17 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_6 = (__pyx_t_4 > __pyx_t_17);
-        if (__pyx_t_6) {
+        __pyx_t_5 = (__pyx_t_3 > __pyx_t_17);
+        if (__pyx_t_5) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":769
+          /* "cvcf.pyx":769
  *                 for allele in alt:
  *                     if len(allele) > len(ref):
  *                         longest, shortest = allele, ref             # <<<<<<<<<<<<<<
  *                     else:
  *                         longest, shortest = ref, allele
  */
-          __pyx_t_2 = __pyx_v_allele;
-          __Pyx_INCREF(__pyx_t_2);
-          __pyx_t_9 = __pyx_v_ref;
-          __Pyx_INCREF(__pyx_t_9);
+          __pyx_t_12 = __pyx_v_allele;
+          __Pyx_INCREF(__pyx_t_12);
+          __pyx_t_10 = __pyx_v_ref;
+          __Pyx_INCREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_v_longest);
-          __pyx_v_longest = __pyx_t_2;
-          __pyx_t_2 = 0;
+          __pyx_v_longest = __pyx_t_12;
+          __pyx_t_12 = 0;
           __Pyx_DECREF(__pyx_v_shortest);
-          __pyx_v_shortest = __pyx_t_9;
-          __pyx_t_9 = 0;
-          goto __pyx_L101;
+          __pyx_v_shortest = __pyx_t_10;
+          __pyx_t_10 = 0;
+          goto __pyx_L105;
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":771
+          /* "cvcf.pyx":771
  *                         longest, shortest = allele, ref
  *                     else:
  *                         longest, shortest = ref, allele             # <<<<<<<<<<<<<<
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False
  */
-          __pyx_t_9 = __pyx_v_ref;
-          __Pyx_INCREF(__pyx_t_9);
-          __pyx_t_2 = __pyx_v_allele;
-          __Pyx_INCREF(__pyx_t_2);
+          __pyx_t_10 = __pyx_v_ref;
+          __Pyx_INCREF(__pyx_t_10);
+          __pyx_t_12 = __pyx_v_allele;
+          __Pyx_INCREF(__pyx_t_12);
           __Pyx_DECREF(__pyx_v_longest);
-          __pyx_v_longest = __pyx_t_9;
-          __pyx_t_9 = 0;
+          __pyx_v_longest = __pyx_t_10;
+          __pyx_t_10 = 0;
           __Pyx_DECREF(__pyx_v_shortest);
-          __pyx_v_shortest = __pyx_t_2;
-          __pyx_t_2 = 0;
+          __pyx_v_shortest = __pyx_t_12;
+          __pyx_t_12 = 0;
         }
-        __pyx_L101:;
+        __pyx_L105:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":772
+        /* "cvcf.pyx":772
  *                     else:
  *                         longest, shortest = ref, allele
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():             # <<<<<<<<<<<<<<
@@ -15601,36 +15399,36 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  */
         __pyx_t_17 = PyObject_Length(__pyx_v_longest); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_4 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_6 = (__pyx_t_17 == __pyx_t_4);
-        if (!__pyx_t_6) {
-          __pyx_t_4 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_2 = PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = (__pyx_t_17 == __pyx_t_3);
+        if (!__pyx_t_5) {
+          __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_12 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_12);
+          __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+          __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_12);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __pyx_t_9 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __pyx_t_8 = __pyx_t_15;
+          __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_7 = __pyx_t_15;
         } else {
-          __pyx_t_8 = __pyx_t_6;
+          __pyx_t_7 = __pyx_t_5;
         }
-        if (__pyx_t_8) {
+        if (__pyx_t_7) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":773
+          /* "cvcf.pyx":773
  *                         longest, shortest = ref, allele
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False             # <<<<<<<<<<<<<<
@@ -15638,44 +15436,44 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                         movable = False
  */
           __pyx_v_movable = 0;
-          goto __pyx_L102;
+          goto __pyx_L106;
         }
-        __pyx_L102:;
+        __pyx_L106:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":774
+        /* "cvcf.pyx":774
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():             # <<<<<<<<<<<<<<
  *                         movable = False
  *                 if not movable:
  */
-        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_4 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_17 = (__pyx_t_4 - 1);
-        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_17, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_17 = (__pyx_t_3 - 1);
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_17, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+        __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        if (__pyx_t_8) {
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+        if (__pyx_t_7) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":775
+          /* "cvcf.pyx":775
  *                         movable = False
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  *                         movable = False             # <<<<<<<<<<<<<<
@@ -15683,48 +15481,48 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *                     break
  */
           __pyx_v_movable = 0;
-          goto __pyx_L103;
+          goto __pyx_L107;
         }
-        __pyx_L103:;
+        __pyx_L107:;
       }
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":776
+      /* "cvcf.pyx":776
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  *                         movable = False
  *                 if not movable:             # <<<<<<<<<<<<<<
  *                     break
  *                 ref = ref[:-1]
  */
-      __pyx_t_8 = (!__pyx_v_movable);
-      if (__pyx_t_8) {
+      __pyx_t_7 = (!__pyx_v_movable);
+      if (__pyx_t_7) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":777
+        /* "cvcf.pyx":777
  *                         movable = False
  *                 if not movable:
  *                     break             # <<<<<<<<<<<<<<
  *                 ref = ref[:-1]
  *                 alt = [allele[:-1] for allele in alt]
  */
-        goto __pyx_L98_break;
-        goto __pyx_L104;
+        goto __pyx_L102_break;
+        goto __pyx_L108;
       }
-      __pyx_L104:;
+      __pyx_L108:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":778
+      /* "cvcf.pyx":778
  *                 if not movable:
  *                     break
  *                 ref = ref[:-1]             # <<<<<<<<<<<<<<
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  */
-      __pyx_t_18 = PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_18 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
       __Pyx_DECREF(__pyx_v_ref);
       __pyx_v_ref = __pyx_t_18;
       __pyx_t_18 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":779
+      /* "cvcf.pyx":779
  *                     break
  *                 ref = ref[:-1]
  *                 alt = [allele[:-1] for allele in alt]             # <<<<<<<<<<<<<<
@@ -15734,41 +15532,41 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_18));
       if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-        __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+        __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
       } else {
-        __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
       }
       for (;;) {
-        if (likely(PyList_CheckExact(__pyx_t_2))) {
-          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
-        } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
+        if (likely(PyList_CheckExact(__pyx_t_12))) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+        } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
         } else {
-          __pyx_t_3 = PyIter_Next(__pyx_t_2);
-          if (!__pyx_t_3) {
+          __pyx_t_2 = PyIter_Next(__pyx_t_12);
+          if (!__pyx_t_2) {
             if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             break;
           }
-          __Pyx_GOTREF(__pyx_t_3);
+          __Pyx_GOTREF(__pyx_t_2);
         }
         __Pyx_DECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_3;
-        __pyx_t_3 = 0;
-        __pyx_t_3 = PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_v_allele = __pyx_t_2;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __Pyx_INCREF(((PyObject *)__pyx_t_18));
       __Pyx_DECREF(__pyx_v_alt);
       __pyx_v_alt = ((PyObject *)__pyx_t_18);
       __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":780
+      /* "cvcf.pyx":780
  *                 ref = ref[:-1]
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:             # <<<<<<<<<<<<<<
@@ -15778,82 +15576,82 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_18));
       if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-        __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+        __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
       } else {
-        __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
       }
       for (;;) {
-        if (likely(PyList_CheckExact(__pyx_t_2))) {
-          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
-        } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
+        if (likely(PyList_CheckExact(__pyx_t_12))) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+        } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
         } else {
-          __pyx_t_3 = PyIter_Next(__pyx_t_2);
-          if (!__pyx_t_3) {
+          __pyx_t_2 = PyIter_Next(__pyx_t_12);
+          if (!__pyx_t_2) {
             if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             break;
           }
-          __Pyx_GOTREF(__pyx_t_3);
+          __Pyx_GOTREF(__pyx_t_2);
         }
         __Pyx_DECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_3;
-        __pyx_t_3 = 0;
+        __pyx_v_allele = __pyx_t_2;
+        __pyx_t_2 = 0;
         __pyx_t_17 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
       __Pyx_INCREF(((PyObject *)__pyx_t_18));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_18));
+      PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_18));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_18));
       __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
-      __pyx_t_18 = PyObject_Call(__pyx_builtin_min, __pyx_t_2, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_18 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_18, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+      __pyx_t_12 = PyObject_RichCompare(__pyx_t_18, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (!__pyx_t_8) {
-        __pyx_t_5 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_6 = (__pyx_t_5 == 0);
-        __pyx_t_15 = __pyx_t_6;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      if (!__pyx_t_7) {
+        __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = (__pyx_t_4 == 0);
+        __pyx_t_15 = __pyx_t_5;
       } else {
-        __pyx_t_15 = __pyx_t_8;
+        __pyx_t_15 = __pyx_t_7;
       }
       if (__pyx_t_15) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":781
+        /* "cvcf.pyx":781
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  *                     ref = faref_leftflank[pos-left-1] + ref             # <<<<<<<<<<<<<<
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
  *                     pos -= 1
  */
-        __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_18 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_12 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
+        __pyx_t_18 = PyNumber_Subtract(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_18); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+        __pyx_t_12 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_18); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_12);
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __pyx_t_18 = PyNumber_Add(__pyx_t_2, __pyx_v_ref); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_18 = PyNumber_Add(__pyx_t_12, __pyx_v_ref); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_DECREF(__pyx_v_ref);
         __pyx_v_ref = __pyx_t_18;
         __pyx_t_18 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":782
+        /* "cvcf.pyx":782
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]             # <<<<<<<<<<<<<<
@@ -15863,50 +15661,50 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
         __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_18));
         if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) {
-          __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2);
+          __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12);
         } else {
-          __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_12);
         }
         for (;;) {
-          if (likely(PyList_CheckExact(__pyx_t_2))) {
-            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
-          } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-            __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
+          if (likely(PyList_CheckExact(__pyx_t_12))) {
+            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+          } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
           } else {
-            __pyx_t_3 = PyIter_Next(__pyx_t_2);
-            if (!__pyx_t_3) {
+            __pyx_t_2 = PyIter_Next(__pyx_t_12);
+            if (!__pyx_t_2) {
               if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               break;
             }
-            __Pyx_GOTREF(__pyx_t_3);
+            __Pyx_GOTREF(__pyx_t_2);
           }
           __Pyx_DECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_3;
-          __pyx_t_3 = 0;
-          __pyx_t_3 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __pyx_t_9 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __pyx_t_3 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_9); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __pyx_t_9 = PyNumber_Add(__pyx_t_3, __pyx_v_allele); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          __pyx_v_allele = __pyx_t_2;
+          __pyx_t_2 = 0;
+          __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_t_2 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_10); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_v_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         }
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(((PyObject *)__pyx_t_18));
         __Pyx_DECREF(__pyx_v_alt);
         __pyx_v_alt = ((PyObject *)__pyx_t_18);
         __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":783
+        /* "cvcf.pyx":783
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
  *                     pos -= 1             # <<<<<<<<<<<<<<
@@ -15918,16 +15716,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
         __Pyx_DECREF(__pyx_v_pos);
         __pyx_v_pos = __pyx_t_18;
         __pyx_t_18 = 0;
-        goto __pyx_L107;
+        goto __pyx_L111;
       }
-      __pyx_L107:;
+      __pyx_L111:;
     }
-    __pyx_L98_break:;
-    goto __pyx_L96;
+    __pyx_L102_break:;
+    goto __pyx_L100;
   }
-  __pyx_L96:;
+  __pyx_L100:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":786
+  /* "cvcf.pyx":786
  * 
  *         # parse sample columns
  *         samples = []             # <<<<<<<<<<<<<<
@@ -15940,31 +15738,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_v_samples = __pyx_t_18;
   __pyx_t_18 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":787
+  /* "cvcf.pyx":787
  *         # parse sample columns
  *         samples = []
  *         for sample in cols[9:]:             # <<<<<<<<<<<<<<
  *             dict = {}
  *             values = sample.split(':')
  */
-  __pyx_t_18 = PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_18 = __Pyx_PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_18);
   if (PyList_CheckExact(__pyx_t_18) || PyTuple_CheckExact(__pyx_t_18)) {
-    __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_18; __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_4 = 0; __pyx_t_12 = __pyx_t_18; __Pyx_INCREF(__pyx_t_12);
   } else {
-    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
   }
   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_18 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_18); __pyx_t_5++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_18 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_18); __pyx_t_5++;
+    if (likely(PyList_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_18 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_18); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_12))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
+      __pyx_t_18 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_18); __pyx_t_4++;
     } else {
-      __pyx_t_18 = PyIter_Next(__pyx_t_2);
+      __pyx_t_18 = PyIter_Next(__pyx_t_12);
       if (!__pyx_t_18) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
@@ -15975,7 +15773,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_v_sample = __pyx_t_18;
     __pyx_t_18 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":788
+    /* "cvcf.pyx":788
  *         samples = []
  *         for sample in cols[9:]:
  *             dict = {}             # <<<<<<<<<<<<<<
@@ -15988,7 +15786,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     __pyx_v_dict = __pyx_t_18;
     __pyx_t_18 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":789
+    /* "cvcf.pyx":789
  *         for sample in cols[9:]:
  *             dict = {}
  *             values = sample.split(':')             # <<<<<<<<<<<<<<
@@ -15997,20 +15795,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     __pyx_t_18 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__split); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_18);
-    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_3 = PyObject_Call(__pyx_t_18, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_v_values);
-    __pyx_v_values = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_values = __pyx_t_10;
+    __pyx_t_10 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":790
+    /* "cvcf.pyx":790
  *             dict = {}
  *             values = sample.split(':')
  *             if len(values) > len(format):             # <<<<<<<<<<<<<<
@@ -16018,105 +15810,105 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *             for idx in range(len(format)):
  */
     __pyx_t_17 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_15 = (__pyx_t_17 > __pyx_t_4);
+    __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_15 = (__pyx_t_17 > __pyx_t_3);
     if (__pyx_t_15) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":791
+      /* "cvcf.pyx":791
  *             values = sample.split(':')
  *             if len(values) > len(format):
  *                 self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))             # <<<<<<<<<<<<<<
  *             for idx in range(len(format)):
  *                 expected = self.get_expected(format[idx], self._format, alt)
  */
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_4 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_18);
-      __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_12 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_20);
-      PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18);
-      __Pyx_GIVEREF(__pyx_t_18);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_20));
+      PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_sample);
       PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_sample);
       __Pyx_GIVEREF(__pyx_v_sample);
-      PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_12);
-      __Pyx_GIVEREF(__pyx_t_12);
-      __pyx_t_18 = 0;
-      __pyx_t_12 = 0;
-      __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_20); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+      PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_9);
+      __Pyx_GIVEREF(__pyx_t_9);
+      __pyx_t_2 = 0;
+      __pyx_t_9 = 0;
+      __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+      __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
       __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_20);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_20));
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_9);
-      __Pyx_GIVEREF(__pyx_t_9);
-      PyTuple_SET_ITEM(__pyx_t_20, 2, ((PyObject *)__pyx_t_12));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
+      PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18);
+      __Pyx_GIVEREF(__pyx_t_18);
+      PyTuple_SET_ITEM(__pyx_t_20, 2, ((PyObject *)__pyx_t_9));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
+      __pyx_t_18 = 0;
       __pyx_t_9 = 0;
-      __pyx_t_12 = 0;
-      __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_20, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      goto __pyx_L114;
+      __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      goto __pyx_L118;
     }
-    __pyx_L114:;
+    __pyx_L118:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":792
+    /* "cvcf.pyx":792
  *             if len(values) > len(format):
  *                 self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
  *             for idx in range(len(format)):             # <<<<<<<<<<<<<<
  *                 expected = self.get_expected(format[idx], self._format, alt)
  *                 if idx < len(values): value = values[idx]
  */
-    __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_4; __pyx_t_17+=1) {
+    __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_3; __pyx_t_17+=1) {
       __pyx_v_idx = __pyx_t_17;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":793
+      /* "cvcf.pyx":793
  *                 self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
  *             for idx in range(len(format)):
  *                 expected = self.get_expected(format[idx], self._format, alt)             # <<<<<<<<<<<<<<
  *                 if idx < len(values): value = values[idx]
  *                 else:
  */
-      __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_expected); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_expected); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_20 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_20);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_18));
+      PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_20);
       __Pyx_GIVEREF(__pyx_t_20);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
-      __Pyx_GIVEREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_10);
+      __Pyx_GIVEREF(__pyx_t_10);
       __Pyx_INCREF(__pyx_v_alt);
-      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_alt);
+      PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_v_alt);
       __Pyx_GIVEREF(__pyx_v_alt);
       __pyx_t_20 = 0;
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_12, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
       __Pyx_DECREF(__pyx_v_expected);
-      __pyx_v_expected = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_expected = __pyx_t_10;
+      __pyx_t_10 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":794
+      /* "cvcf.pyx":794
  *             for idx in range(len(format)):
  *                 expected = self.get_expected(format[idx], self._format, alt)
  *                 if idx < len(values): value = values[idx]             # <<<<<<<<<<<<<<
@@ -16126,287 +15918,287 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
       __pyx_t_21 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_15 = (__pyx_v_idx < __pyx_t_21);
       if (__pyx_t_15) {
-        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_v_value);
-        __pyx_v_value = __pyx_t_3;
-        __pyx_t_3 = 0;
-        goto __pyx_L117;
+        __pyx_v_value = __pyx_t_10;
+        __pyx_t_10 = 0;
+        goto __pyx_L121;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":796
+        /* "cvcf.pyx":796
  *                 if idx < len(values): value = values[idx]
  *                 else:
  *                     if expected == -1: value = "."             # <<<<<<<<<<<<<<
  *                     else: value = ",".join(["."]*expected)
  *                 dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)
  */
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         if (__pyx_t_15) {
-          __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+          __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
           __Pyx_DECREF(__pyx_v_value);
-          __pyx_v_value = ((PyObject *)__pyx_kp_s_6);
-          goto __pyx_L118;
+          __pyx_v_value = ((PyObject *)__pyx_kp_s_9);
+          goto __pyx_L122;
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":797
+          /* "cvcf.pyx":797
  *                 else:
  *                     if expected == -1: value = "."
  *                     else: value = ",".join(["."]*expected)             # <<<<<<<<<<<<<<
  *                 dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  */
-          __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-          __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
-          PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_6));
-          __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
-          __pyx_t_12 = PyNumber_Multiply(((PyObject *)__pyx_t_9), __pyx_v_expected); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_12);
-          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __pyx_t_18 = PyList_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_18));
+          __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+          PyList_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_9));
+          __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+          __pyx_t_9 = PyNumber_Multiply(((PyObject *)__pyx_t_18), __pyx_v_expected); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_9);
-          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12);
-          __Pyx_GIVEREF(__pyx_t_12);
-          __pyx_t_12 = 0;
-          __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_12);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
+          __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_18));
+          PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_9);
+          __Pyx_GIVEREF(__pyx_t_9);
+          __pyx_t_9 = 0;
+          __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
           __Pyx_DECREF(__pyx_v_value);
-          __pyx_v_value = __pyx_t_12;
-          __pyx_t_12 = 0;
+          __pyx_v_value = __pyx_t_9;
+          __pyx_t_9 = 0;
         }
-        __pyx_L118:;
+        __pyx_L122:;
       }
-      __pyx_L117:;
+      __pyx_L121:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":798
+      /* "cvcf.pyx":798
  *                     if expected == -1: value = "."
  *                     else: value = ",".join(["."]*expected)
  *                 dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)             # <<<<<<<<<<<<<<
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  */
-      __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_18);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __pyx_t_20 = PyTuple_New(4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_20);
-      PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_9);
-      __Pyx_GIVEREF(__pyx_t_9);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_20));
+      PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18);
+      __Pyx_GIVEREF(__pyx_t_18);
       __Pyx_INCREF(__pyx_v_value);
       PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_value);
       __Pyx_GIVEREF(__pyx_v_value);
-      PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_3);
-      __Pyx_GIVEREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_10);
+      __Pyx_GIVEREF(__pyx_t_10);
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      __pyx_t_9 = 0;
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_12, __pyx_t_20, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+      __pyx_t_18 = 0;
+      __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
       __pyx_t_20 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_20);
-      if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_20, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_20, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":799
+      /* "cvcf.pyx":799
  *                     else: value = ",".join(["."]*expected)
  *                 dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)
  *                 if expected != -1 and len(dict[format[idx]]) != expected:             # <<<<<<<<<<<<<<
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  *                                "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
  */
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_15) {
-        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_20 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_3); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_20 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_20);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __pyx_t_21 = PyObject_Length(__pyx_t_20); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
         __pyx_t_20 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_20);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_t_20, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_10 = PyObject_RichCompare(__pyx_t_20, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_6 = __pyx_t_8;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_5 = __pyx_t_7;
       } else {
-        __pyx_t_6 = __pyx_t_15;
+        __pyx_t_5 = __pyx_t_15;
       }
-      if (__pyx_t_6) {
+      if (__pyx_t_5) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":800
+        /* "cvcf.pyx":800
  *                 dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,             # <<<<<<<<<<<<<<
  *                                "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
  *                     if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))
  */
-        __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_20 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_11); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_20 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_20);
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":801
+        /* "cvcf.pyx":801
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  *                                "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))             # <<<<<<<<<<<<<<
  *                     if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))
  *                     dict[format[idx]] = dict[format[idx]][:expected]
  */
-        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_12);
         __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_9); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12);
-        __Pyx_GIVEREF(__pyx_t_12);
+        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+        __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_18));
+        PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
         __Pyx_INCREF(__pyx_v_expected);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_expected);
+        PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_expected);
         __Pyx_GIVEREF(__pyx_v_expected);
-        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_18);
-        __Pyx_GIVEREF(__pyx_t_18);
-        __pyx_t_12 = 0;
-        __pyx_t_18 = 0;
-        __pyx_t_18 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_t_9); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_t_9 = 0;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
+        __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_18));
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_20);
+        PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
         __Pyx_GIVEREF(__pyx_t_20);
-        PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_t_18));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_18));
+        PyTuple_SET_ITEM(__pyx_t_18, 2, ((PyObject *)__pyx_t_2));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
         __pyx_t_20 = 0;
-        __pyx_t_18 = 0;
-        __pyx_t_18 = PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":802
+        /* "cvcf.pyx":802
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  *                                "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
  *                     if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))             # <<<<<<<<<<<<<<
  *                     dict[format[idx]] = dict[format[idx]][:expected]
  *             samples.append( dict )
  */
-        __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_21 = PyObject_Length(__pyx_t_18); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        __pyx_t_21 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_18 = PyObject_RichCompare(__pyx_t_9, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_RichCompare(__pyx_t_18, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        if (__pyx_t_6) {
-          __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_18);
-          __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-          __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_9, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        if (__pyx_t_5) {
+          __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_18);
+          __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __pyx_t_20 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_20);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_20, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+          __pyx_t_20 = PyList_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_20));
+          PyList_SET_ITEM(__pyx_t_20, 0, __pyx_t_10);
+          __Pyx_GIVEREF(__pyx_t_10);
+          __pyx_t_10 = 0;
+          __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_21 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-          PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_18);
-          __Pyx_GIVEREF(__pyx_t_18);
-          __pyx_t_18 = 0;
-          __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_18);
-          __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-          __pyx_t_21 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __pyx_t_18 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_18);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_9), __pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-          __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_18);
-          __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_9);
-          __pyx_t_20 = PyNumber_InPlaceAdd(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_20);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+          __pyx_t_10 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_18, __pyx_t_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+          __pyx_t_9 = PyNumber_Multiply(((PyObject *)__pyx_t_20), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
+          __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_t_18, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-          goto __pyx_L120;
+          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_2, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          goto __pyx_L124;
         }
-        __pyx_L120:;
+        __pyx_L124:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":803
+        /* "cvcf.pyx":803
  *                                "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
  *                     if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))
  *                     dict[format[idx]] = dict[format[idx]][:expected]             # <<<<<<<<<<<<<<
  *             samples.append( dict )
  * 
  */
-        __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_18);
-        __pyx_t_20 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_20);
-        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_expected); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_18 = PySequence_GetSlice(__pyx_t_20, 0, __pyx_t_21); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_18);
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __pyx_t_20 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_20);
-        if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_20, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-        goto __pyx_L119;
+        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_10, 0, __pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_10, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        goto __pyx_L123;
       }
-      __pyx_L119:;
+      __pyx_L123:;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":804
+    /* "cvcf.pyx":804
  *                     if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))
  *                     dict[format[idx]] = dict[format[idx]][:expected]
  *             samples.append( dict )             # <<<<<<<<<<<<<<
@@ -16416,171 +16208,171 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
     if (unlikely(__pyx_v_samples == Py_None)) {
       PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_16 = PyList_Append(((PyObject *)__pyx_v_samples), ((PyObject *)__pyx_v_dict)); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_16 = PyList_Append(__pyx_v_samples, ((PyObject *)__pyx_v_dict)); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":807
+  /* "cvcf.pyx":807
  * 
  *         # done
  *         d = {'chrom':chrom,             # <<<<<<<<<<<<<<
  *              'pos':pos,      # return 0-based position
  *              'id':id,
  */
-  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":808
+  /* "cvcf.pyx":808
  *         # done
  *         d = {'chrom':chrom,
  *              'pos':pos,      # return 0-based position             # <<<<<<<<<<<<<<
  *              'id':id,
  *              'ref':ref,
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":809
+  /* "cvcf.pyx":809
  *         d = {'chrom':chrom,
  *              'pos':pos,      # return 0-based position
  *              'id':id,             # <<<<<<<<<<<<<<
  *              'ref':ref,
  *              'alt':alt,
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":810
+  /* "cvcf.pyx":810
  *              'pos':pos,      # return 0-based position
  *              'id':id,
  *              'ref':ref,             # <<<<<<<<<<<<<<
  *              'alt':alt,
  *              'qual':qual,
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":811
+  /* "cvcf.pyx":811
  *              'id':id,
  *              'ref':ref,
  *              'alt':alt,             # <<<<<<<<<<<<<<
  *              'qual':qual,
  *              'filter':filter,
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__alt), __pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__alt), __pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":812
+  /* "cvcf.pyx":812
  *              'ref':ref,
  *              'alt':alt,
  *              'qual':qual,             # <<<<<<<<<<<<<<
  *              'filter':filter,
  *              'info':info,
  */
-  __pyx_t_18 = PyFloat_FromDouble(__pyx_v_qual); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_18);
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__qual), __pyx_t_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__qual), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":813
+  /* "cvcf.pyx":813
  *              'alt':alt,
  *              'qual':qual,
  *              'filter':filter,             # <<<<<<<<<<<<<<
  *              'info':info,
  *              'format':format}
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":814
+  /* "cvcf.pyx":814
  *              'qual':qual,
  *              'filter':filter,
  *              'info':info,             # <<<<<<<<<<<<<<
  *              'format':format}
  *         for key,value in zip(self._samples,samples):
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":815
+  /* "cvcf.pyx":815
  *              'filter':filter,
  *              'info':info,
  *              'format':format}             # <<<<<<<<<<<<<<
  *         for key,value in zip(self._samples,samples):
  *             d[key] = value
  */
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_v_d));
-  __pyx_v_d = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_v_d = __pyx_t_12;
+  __pyx_t_12 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":816
+  /* "cvcf.pyx":816
  *              'info':info,
  *              'format':format}
  *         for key,value in zip(self._samples,samples):             # <<<<<<<<<<<<<<
  *             d[key] = value
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_18);
-  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
   __Pyx_INCREF(((PyObject *)__pyx_v_samples));
-  PyTuple_SET_ITEM(__pyx_t_18, 1, ((PyObject *)__pyx_v_samples));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_samples));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samples));
-  __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_zip, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-    __pyx_t_5 = 0; __pyx_t_18 = __pyx_t_2; __Pyx_INCREF(__pyx_t_18);
+  __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) {
+    __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_12; __Pyx_INCREF(__pyx_t_2);
   } else {
-    __pyx_t_5 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_18);
+    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_18))) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_18)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_18))) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+    if (likely(PyList_CheckExact(__pyx_t_2))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+      __pyx_t_12 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+      __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++;
     } else {
-      __pyx_t_2 = PyIter_Next(__pyx_t_18);
-      if (!__pyx_t_2) {
+      __pyx_t_12 = PyIter_Next(__pyx_t_2);
+      if (!__pyx_t_12) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_12);
     }
-    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
-      PyObject* tuple = __pyx_t_2;
-      __pyx_t_20 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_20);
+    if (PyTuple_CheckExact(__pyx_t_12) && likely(PyTuple_GET_SIZE(__pyx_t_12) == 2)) {
+      PyObject* tuple = __pyx_t_12;
+      __pyx_t_10 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_10);
       __pyx_t_9 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __Pyx_DECREF(__pyx_v_key);
-      __pyx_v_key = __pyx_t_20;
-      __pyx_t_20 = 0;
+      __pyx_v_key = __pyx_t_10;
+      __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_9;
       __pyx_t_9 = 0;
     } else {
-      __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_20 = __Pyx_UnpackItem(__pyx_t_3, 0); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_3, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_18 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_18);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_18, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_18, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      if (__Pyx_EndUnpack(__pyx_t_3, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__Pyx_EndUnpack(__pyx_t_18, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
       __Pyx_DECREF(__pyx_v_key);
-      __pyx_v_key = __pyx_t_20;
-      __pyx_t_20 = 0;
+      __pyx_v_key = __pyx_t_10;
+      __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_v_value);
       __pyx_v_value = __pyx_t_9;
       __pyx_t_9 = 0;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":817
+    /* "cvcf.pyx":817
  *              'format':format}
  *         for key,value in zip(self._samples,samples):
  *             d[key] = value             # <<<<<<<<<<<<<<
@@ -16589,9 +16381,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  */
     if (PyDict_SetItem(((PyObject *)__pyx_v_d), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":819
+  /* "cvcf.pyx":819
  *             d[key] = value
  * 
  *         return d             # <<<<<<<<<<<<<<
@@ -16608,7 +16400,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
@@ -16655,13 +16447,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
   __Pyx_DECREF(__pyx_v_value);
   __Pyx_DECREF(__pyx_v_d);
   __Pyx_DECREF(__pyx_v_key);
-  __Pyx_DECREF(__pyx_8genexpr0__pyx_v_allele);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":822
+/* "cvcf.pyx":822
  * 
  * 
  *     def write_data(self, stream, data):             # <<<<<<<<<<<<<<
@@ -16669,9 +16460,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse_data(PyObject *__pyx_self, PyObject *
  *         for k in required:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_write_data = {__Pyx_NAMESTR("write_data"), (PyCFunction)__pyx_pf_4cvcf_3VCF_write_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_17write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_17write_data = {__Pyx_NAMESTR("write_data"), (PyCFunction)__pyx_pf_4cvcf_3VCF_17write_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_17write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_data = 0;
@@ -16752,10 +16543,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_filter = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_output = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_output = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":823
+  /* "cvcf.pyx":823
  * 
  *     def write_data(self, stream, data):
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples             # <<<<<<<<<<<<<<
@@ -16801,7 +16592,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_v_required = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":824
+  /* "cvcf.pyx":824
  *     def write_data(self, stream, data):
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
  *         for k in required:             # <<<<<<<<<<<<<<
@@ -16833,7 +16624,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __pyx_v_k = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":825
+    /* "cvcf.pyx":825
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
  *         for k in required:
  *             if k not in data: raise ValueError("Required key %s not found in data" % str(k))             # <<<<<<<<<<<<<<
@@ -16843,24 +16634,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_data, __pyx_v_k))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_5) {
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_k);
       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k);
       __Pyx_GIVEREF(__pyx_v_k);
-      __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_68), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_115), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
       __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_Raise(__pyx_t_2, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -16870,7 +16661,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":826
+  /* "cvcf.pyx":826
  *         for k in required:
  *             if k not in data: raise ValueError("Required key %s not found in data" % str(k))
  *         if data['alt'] == []: alt = "."             # <<<<<<<<<<<<<<
@@ -16888,14 +16679,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_5) {
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
     __Pyx_DECREF(__pyx_v_alt);
-    __pyx_v_alt = ((PyObject *)__pyx_kp_s_6);
+    __pyx_v_alt = ((PyObject *)__pyx_kp_s_9);
     goto __pyx_L9;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":827
+    /* "cvcf.pyx":827
  *             if k not in data: raise ValueError("Required key %s not found in data" % str(k))
  *         if data['alt'] == []: alt = "."
  *         else: alt = ",".join(data['alt'])             # <<<<<<<<<<<<<<
@@ -16907,21 +16698,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__alt)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_alt);
     __pyx_v_alt = __pyx_t_2;
     __pyx_t_2 = 0;
   }
   __pyx_L9:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":828
+  /* "cvcf.pyx":828
  *         if data['alt'] == []: alt = "."
  *         else: alt = ",".join(data['alt'])
  *         if data['filter'] == None: filter = "."             # <<<<<<<<<<<<<<
@@ -16936,13 +16727,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_5) {
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
     __Pyx_DECREF(__pyx_v_filter);
-    __pyx_v_filter = ((PyObject *)__pyx_kp_s_6);
+    __pyx_v_filter = ((PyObject *)__pyx_kp_s_9);
     goto __pyx_L10;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":829
+  /* "cvcf.pyx":829
  *         else: alt = ",".join(data['alt'])
  *         if data['filter'] == None: filter = "."
  *         elif data['filter'] == []:             # <<<<<<<<<<<<<<
@@ -16961,7 +16752,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_5) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":830
+    /* "cvcf.pyx":830
  *         if data['filter'] == None: filter = "."
  *         elif data['filter'] == []:
  *             if self._version == 33: filter = "0"             # <<<<<<<<<<<<<<
@@ -16983,7 +16774,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":831
+      /* "cvcf.pyx":831
  *         elif data['filter'] == []:
  *             if self._version == 33: filter = "0"
  *             else: filter = "PASS"             # <<<<<<<<<<<<<<
@@ -16999,33 +16790,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":832
+    /* "cvcf.pyx":832
  *             if self._version == 33: filter = "0"
  *             else: filter = "PASS"
  *         else: filter = ';'.join(data['filter'])             # <<<<<<<<<<<<<<
  *         if data['qual'] == -1: qual = "."
  *         else: qual = str(data['qual'])
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_11), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__filter)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_v_filter);
     __pyx_v_filter = __pyx_t_1;
     __pyx_t_1 = 0;
   }
   __pyx_L10:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":833
+  /* "cvcf.pyx":833
  *             else: filter = "PASS"
  *         else: filter = ';'.join(data['filter'])
  *         if data['qual'] == -1: qual = "."             # <<<<<<<<<<<<<<
@@ -17040,14 +16831,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_5) {
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
     __Pyx_DECREF(__pyx_v_qual);
-    __pyx_v_qual = ((PyObject *)__pyx_kp_s_6);
+    __pyx_v_qual = ((PyObject *)__pyx_kp_s_9);
     goto __pyx_L12;
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":834
+    /* "cvcf.pyx":834
  *         else: filter = ';'.join(data['filter'])
  *         if data['qual'] == -1: qual = "."
  *         else: qual = str(data['qual'])             # <<<<<<<<<<<<<<
@@ -17057,20 +16848,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__qual)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_qual);
     __pyx_v_qual = __pyx_t_3;
     __pyx_t_3 = 0;
   }
   __pyx_L12:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":836
+  /* "cvcf.pyx":836
  *         else: qual = str(data['qual'])
  * 
  *         output = [data['chrom'],             # <<<<<<<<<<<<<<
@@ -17080,7 +16871,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__chrom)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":837
+  /* "cvcf.pyx":837
  * 
  *         output = [data['chrom'],
  *                   str(data['pos']+1),   # change to 1-based position             # <<<<<<<<<<<<<<
@@ -17093,15 +16884,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":838
+  /* "cvcf.pyx":838
  *         output = [data['chrom'],
  *                   str(data['pos']+1),   # change to 1-based position
  *                   data['id'],             # <<<<<<<<<<<<<<
@@ -17111,7 +16902,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":839
+  /* "cvcf.pyx":839
  *                   str(data['pos']+1),   # change to 1-based position
  *                   data['id'],
  *                   data['ref'],             # <<<<<<<<<<<<<<
@@ -17121,7 +16912,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_6 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__ref)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":843
+  /* "cvcf.pyx":843
  *                   qual,
  *                   filter,
  *                   self.format_formatdata( data['info'], self._info, separator=";" ),             # <<<<<<<<<<<<<<
@@ -17135,7 +16926,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
@@ -17144,14 +16935,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_9 = 0;
   __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__separator), ((PyObject *)__pyx_kp_s_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, __pyx_t_10, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__separator), ((PyObject *)__pyx_kp_s_11)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":844
+  /* "cvcf.pyx":844
  *                   filter,
  *                   self.format_formatdata( data['info'], self._info, separator=";" ),
  *                   self.format_formatdata( data['format'], self._format, value=False ) ]             # <<<<<<<<<<<<<<
@@ -17165,7 +16956,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
   __Pyx_GIVEREF(__pyx_t_10);
   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_7);
@@ -17178,10 +16969,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __Pyx_GOTREF(__pyx_t_10);
   if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__value), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_9, __pyx_t_11, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
   __pyx_t_7 = PyList_New(9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_7));
@@ -17216,7 +17007,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   __pyx_v_output = __pyx_t_7;
   __pyx_t_7 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":846
+  /* "cvcf.pyx":846
  *                   self.format_formatdata( data['format'], self._format, value=False ) ]
  * 
  *         for s in self._samples:             # <<<<<<<<<<<<<<
@@ -17251,7 +17042,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __pyx_v_s = __pyx_t_7;
     __pyx_t_7 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":847
+    /* "cvcf.pyx":847
  * 
  *         for s in self._samples:
  *             output.append( self.format_formatdata( data[s], self._format, key=False ) )             # <<<<<<<<<<<<<<
@@ -17268,7 +17059,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
     __Pyx_GIVEREF(__pyx_t_8);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
@@ -17281,17 +17072,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
     __Pyx_GOTREF(__pyx_t_8);
     if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__key), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, __pyx_t_1, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_t_12 = PyList_Append(((PyObject *)__pyx_v_output), __pyx_t_8); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = PyList_Append(__pyx_v_output, __pyx_t_8); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   }
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":849
+  /* "cvcf.pyx":849
  *             output.append( self.format_formatdata( data[s], self._format, key=False ) )
  * 
  *         stream.write( "\t".join(output) + "\n" )             # <<<<<<<<<<<<<<
@@ -17300,29 +17091,29 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
  */
   __pyx_t_10 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_51), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_85), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   __Pyx_INCREF(((PyObject *)__pyx_v_output));
   PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_output));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_output));
-  __pyx_t_1 = PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  __pyx_t_6 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_91)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
   __Pyx_GIVEREF(__pyx_t_6);
   __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -17352,7 +17143,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":851
+/* "cvcf.pyx":851
  *         stream.write( "\t".join(output) + "\n" )
  * 
  *     def _parse_header(self, stream):             # <<<<<<<<<<<<<<
@@ -17360,9 +17151,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write_data(PyObject *__pyx_self, PyObject *
  *         for line in stream:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF__parse_header = {__Pyx_NAMESTR("_parse_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF__parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_18_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_18_parse_header = {__Pyx_NAMESTR("_parse_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_18_parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_18_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_line;
@@ -17371,8 +17162,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   __Pyx_RefNannySetupContext("_parse_header");
   __pyx_self = __pyx_self;
@@ -17418,7 +17209,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_line = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":852
+  /* "cvcf.pyx":852
  * 
  *     def _parse_header(self, stream):
  *         self._lineno = 0             # <<<<<<<<<<<<<<
@@ -17427,7 +17218,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
  */
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":853
+  /* "cvcf.pyx":853
  *     def _parse_header(self, stream):
  *         self._lineno = 0
  *         for line in stream:             # <<<<<<<<<<<<<<
@@ -17459,7 +17250,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
     __pyx_v_line = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":854
+    /* "cvcf.pyx":854
  *         self._lineno = 0
  *         for line in stream:
  *             self._lineno += 1             # <<<<<<<<<<<<<<
@@ -17474,7 +17265,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":855
+    /* "cvcf.pyx":855
  *         for line in stream:
  *             self._lineno += 1
  *             if line.startswith('##'):             # <<<<<<<<<<<<<<
@@ -17483,111 +17274,99 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
  */
     __pyx_t_4 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_43));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":856
+      /* "cvcf.pyx":856
  *             self._lineno += 1
  *             if line.startswith('##'):
  *                 self.parse_header( line.strip() )             # <<<<<<<<<<<<<<
  *             elif line.startswith('#'):
  *                 self.parse_heading( line.strip() )
  */
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+      __Pyx_GIVEREF(__pyx_t_6);
+      __pyx_t_6 = 0;
+      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L8;
     }
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":857
+    /* "cvcf.pyx":857
  *             if line.startswith('##'):
  *                 self.parse_header( line.strip() )
  *             elif line.startswith('#'):             # <<<<<<<<<<<<<<
  *                 self.parse_heading( line.strip() )
  *                 self.enter_default_format()
  */
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_50));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (__pyx_t_6) {
+    if (__pyx_t_5) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":858
+      /* "cvcf.pyx":858
  *                 self.parse_header( line.strip() )
  *             elif line.startswith('#'):
  *                 self.parse_heading( line.strip() )             # <<<<<<<<<<<<<<
  *                 self.enter_default_format()
  *             else:
  */
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_heading); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_heading); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
+      __Pyx_GIVEREF(__pyx_t_3);
+      __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":859
+      /* "cvcf.pyx":859
  *             elif line.startswith('#'):
  *                 self.parse_heading( line.strip() )
  *                 self.enter_default_format()             # <<<<<<<<<<<<<<
  *             else:
  *                 break
  */
-      __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_69); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_118); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L8;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":861
+      /* "cvcf.pyx":861
  *                 self.enter_default_format()
  *             else:
  *                 break             # <<<<<<<<<<<<<<
@@ -17601,7 +17380,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
   __pyx_L7_break:;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":862
+  /* "cvcf.pyx":862
  *             else:
  *                 break
  *         return line             # <<<<<<<<<<<<<<
@@ -17619,7 +17398,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("cvcf.VCF._parse_header");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -17629,7 +17408,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":864
+/* "cvcf.pyx":864
  *         return line
  * 
  *     def _parse(self, line, stream):             # <<<<<<<<<<<<<<
@@ -17637,9 +17416,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse_header(PyObject *__pyx_self, PyObjec
  *             d = self.parse_data( line.strip() )
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF__parse = {__Pyx_NAMESTR("_parse"), (PyCFunction)__pyx_pf_4cvcf_3VCF__parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_19_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_19_parse = {__Pyx_NAMESTR("_parse"), (PyCFunction)__pyx_pf_4cvcf_3VCF_19_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_19_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_stream = 0;
@@ -17708,7 +17487,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
   __Pyx_INCREF(__pyx_v_line);
   __pyx_v_d = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":865
+  /* "cvcf.pyx":865
  * 
  *     def _parse(self, line, stream):
  *         if len(line.strip()) > 0:             # <<<<<<<<<<<<<<
@@ -17725,7 +17504,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
   __pyx_t_4 = (__pyx_t_3 > 0);
   if (__pyx_t_4) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":866
+    /* "cvcf.pyx":866
  *     def _parse(self, line, stream):
  *         if len(line.strip()) > 0:
  *             d = self.parse_data( line.strip() )             # <<<<<<<<<<<<<<
@@ -17740,14 +17519,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_d);
     __pyx_v_d = __pyx_t_5;
     __pyx_t_5 = 0;
@@ -17755,7 +17534,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":868
+  /* "cvcf.pyx":868
  *             d = self.parse_data( line.strip() )
  *             #if d: yield d
  *         for line in stream:             # <<<<<<<<<<<<<<
@@ -17787,7 +17566,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
     __pyx_v_line = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":869
+    /* "cvcf.pyx":869
  *             #if d: yield d
  *         for line in stream:
  *             self._lineno += 1             # <<<<<<<<<<<<<<
@@ -17802,7 +17581,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":870
+    /* "cvcf.pyx":870
  *         for line in stream:
  *             self._lineno += 1
  *             if self._lines and self._lineno > self._lines: raise StopIteration             # <<<<<<<<<<<<<<
@@ -17835,7 +17614,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
     }
     __pyx_L9:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":871
+    /* "cvcf.pyx":871
  *             self._lineno += 1
  *             if self._lines and self._lineno > self._lines: raise StopIteration
  *             d = self.parse_data( line.strip() )             # <<<<<<<<<<<<<<
@@ -17850,14 +17629,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_v_d);
     __pyx_v_d = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -17881,7 +17660,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":880
+/* "cvcf.pyx":880
  *     ######################################################################################################
  * 
  *     def getsamples(self):             # <<<<<<<<<<<<<<
@@ -17889,16 +17668,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF__parse(PyObject *__pyx_self, PyObject *__py
  *         return self._samples
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_getsamples[] = " List of samples in VCF file ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_getsamples = {__Pyx_NAMESTR("getsamples"), (PyCFunction)__pyx_pf_4cvcf_3VCF_getsamples, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_getsamples)};
-static PyObject *__pyx_pf_4cvcf_3VCF_getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_4cvcf_3VCF_20getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_20getsamples[] = " List of samples in VCF file ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_20getsamples = {__Pyx_NAMESTR("getsamples"), (PyCFunction)__pyx_pf_4cvcf_3VCF_20getsamples, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_20getsamples)};
+static PyObject *__pyx_pf_4cvcf_3VCF_20getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("getsamples");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":882
+  /* "cvcf.pyx":882
  *     def getsamples(self):
  *         """ List of samples in VCF file """
  *         return self._samples             # <<<<<<<<<<<<<<
@@ -17924,7 +17703,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getsamples(PyObject *__pyx_self, PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":884
+/* "cvcf.pyx":884
  *         return self._samples
  * 
  *     def setsamples(self,samples):             # <<<<<<<<<<<<<<
@@ -17932,10 +17711,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getsamples(PyObject *__pyx_self, PyObject *
  *         self._samples = samples
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_setsamples[] = " List of samples in VCF file ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setsamples = {__Pyx_NAMESTR("setsamples"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setsamples, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_setsamples)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_21setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_21setsamples[] = " List of samples in VCF file ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_21setsamples = {__Pyx_NAMESTR("setsamples"), (PyCFunction)__pyx_pf_4cvcf_3VCF_21setsamples, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_21setsamples)};
+static PyObject *__pyx_pf_4cvcf_3VCF_21setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_samples = 0;
   PyObject *__pyx_r = NULL;
@@ -17983,7 +17762,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setsamples(PyObject *__pyx_self, PyObject *
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":886
+  /* "cvcf.pyx":886
  *     def setsamples(self,samples):
  *         """ List of samples in VCF file """
  *         self._samples = samples             # <<<<<<<<<<<<<<
@@ -18003,7 +17782,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setsamples(PyObject *__pyx_self, PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":888
+/* "cvcf.pyx":888
  *         self._samples = samples
  * 
  *     def getheader(self):             # <<<<<<<<<<<<<<
@@ -18011,16 +17790,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setsamples(PyObject *__pyx_self, PyObject *
  *         return self._header
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_getheader(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_getheader[] = " List of header key-value pairs (strings) ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_getheader = {__Pyx_NAMESTR("getheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_getheader, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_getheader)};
-static PyObject *__pyx_pf_4cvcf_3VCF_getheader(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_4cvcf_3VCF_22getheader(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_22getheader[] = " List of header key-value pairs (strings) ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_22getheader = {__Pyx_NAMESTR("getheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_22getheader, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_22getheader)};
+static PyObject *__pyx_pf_4cvcf_3VCF_22getheader(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("getheader");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":890
+  /* "cvcf.pyx":890
  *     def getheader(self):
  *         """ List of header key-value pairs (strings) """
  *         return self._header             # <<<<<<<<<<<<<<
@@ -18046,7 +17825,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getheader(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":892
+/* "cvcf.pyx":892
  *         return self._header
  * 
  *     def setheader(self,header):             # <<<<<<<<<<<<<<
@@ -18054,10 +17833,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getheader(PyObject *__pyx_self, PyObject *_
  *         self._header = header
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_setheader[] = " List of header key-value pairs (strings) ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setheader = {__Pyx_NAMESTR("setheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_setheader)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_23setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_23setheader[] = " List of header key-value pairs (strings) ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_23setheader = {__Pyx_NAMESTR("setheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_23setheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_23setheader)};
+static PyObject *__pyx_pf_4cvcf_3VCF_23setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_header = 0;
   PyObject *__pyx_r = NULL;
@@ -18105,7 +17884,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setheader(PyObject *__pyx_self, PyObject *_
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":894
+  /* "cvcf.pyx":894
  *     def setheader(self,header):
  *         """ List of header key-value pairs (strings) """
  *         self._header = header             # <<<<<<<<<<<<<<
@@ -18125,7 +17904,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setheader(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":896
+/* "cvcf.pyx":896
  *         self._header = header
  * 
  *     def getinfo(self):             # <<<<<<<<<<<<<<
@@ -18133,16 +17912,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setheader(PyObject *__pyx_self, PyObject *_
  *         return self._info
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_getinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_getinfo = {__Pyx_NAMESTR("getinfo"), (PyCFunction)__pyx_pf_4cvcf_3VCF_getinfo, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_getinfo)};
-static PyObject *__pyx_pf_4cvcf_3VCF_getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_4cvcf_3VCF_24getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_24getinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_24getinfo = {__Pyx_NAMESTR("getinfo"), (PyCFunction)__pyx_pf_4cvcf_3VCF_24getinfo, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_24getinfo)};
+static PyObject *__pyx_pf_4cvcf_3VCF_24getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("getinfo");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":898
+  /* "cvcf.pyx":898
  *     def getinfo(self):
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         return self._info             # <<<<<<<<<<<<<<
@@ -18168,7 +17947,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getinfo(PyObject *__pyx_self, PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":900
+/* "cvcf.pyx":900
  *         return self._info
  * 
  *     def setinfo(self,info):             # <<<<<<<<<<<<<<
@@ -18176,10 +17955,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getinfo(PyObject *__pyx_self, PyObject *__p
  *         self._info = info
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_setinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setinfo = {__Pyx_NAMESTR("setinfo"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_setinfo)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_25setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_25setinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_25setinfo = {__Pyx_NAMESTR("setinfo"), (PyCFunction)__pyx_pf_4cvcf_3VCF_25setinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_25setinfo)};
+static PyObject *__pyx_pf_4cvcf_3VCF_25setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_info = 0;
   PyObject *__pyx_r = NULL;
@@ -18227,7 +18006,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setinfo(PyObject *__pyx_self, PyObject *__p
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":902
+  /* "cvcf.pyx":902
  *     def setinfo(self,info):
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         self._info = info             # <<<<<<<<<<<<<<
@@ -18247,7 +18026,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setinfo(PyObject *__pyx_self, PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":904
+/* "cvcf.pyx":904
  *         self._info = info
  * 
  *     def getformat(self):             # <<<<<<<<<<<<<<
@@ -18255,16 +18034,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setinfo(PyObject *__pyx_self, PyObject *__p
  *         return self._format
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_getformat(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_getformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_getformat = {__Pyx_NAMESTR("getformat"), (PyCFunction)__pyx_pf_4cvcf_3VCF_getformat, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_getformat)};
-static PyObject *__pyx_pf_4cvcf_3VCF_getformat(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_4cvcf_3VCF_26getformat(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_26getformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_26getformat = {__Pyx_NAMESTR("getformat"), (PyCFunction)__pyx_pf_4cvcf_3VCF_26getformat, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_26getformat)};
+static PyObject *__pyx_pf_4cvcf_3VCF_26getformat(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("getformat");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":906
+  /* "cvcf.pyx":906
  *     def getformat(self):
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         return self._format             # <<<<<<<<<<<<<<
@@ -18290,7 +18069,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getformat(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":908
+/* "cvcf.pyx":908
  *         return self._format
  * 
  *     def setformat(self,format):             # <<<<<<<<<<<<<<
@@ -18298,10 +18077,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getformat(PyObject *__pyx_self, PyObject *_
  *         self._format = format
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_setformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setformat = {__Pyx_NAMESTR("setformat"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setformat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_setformat)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_27setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_27setformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_27setformat = {__Pyx_NAMESTR("setformat"), (PyCFunction)__pyx_pf_4cvcf_3VCF_27setformat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_27setformat)};
+static PyObject *__pyx_pf_4cvcf_3VCF_27setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_r = NULL;
@@ -18349,7 +18128,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setformat(PyObject *__pyx_self, PyObject *_
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":910
+  /* "cvcf.pyx":910
  *     def setformat(self,format):
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         self._format = format             # <<<<<<<<<<<<<<
@@ -18369,7 +18148,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setformat(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":912
+/* "cvcf.pyx":912
  *         self._format = format
  * 
  *     def getfilter(self):             # <<<<<<<<<<<<<<
@@ -18377,16 +18156,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setformat(PyObject *__pyx_self, PyObject *_
  *         return self._filter
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_getfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_getfilter = {__Pyx_NAMESTR("getfilter"), (PyCFunction)__pyx_pf_4cvcf_3VCF_getfilter, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_getfilter)};
-static PyObject *__pyx_pf_4cvcf_3VCF_getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_4cvcf_3VCF_28getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_28getfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_28getfilter = {__Pyx_NAMESTR("getfilter"), (PyCFunction)__pyx_pf_4cvcf_3VCF_28getfilter, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_28getfilter)};
+static PyObject *__pyx_pf_4cvcf_3VCF_28getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   __Pyx_RefNannySetupContext("getfilter");
   __pyx_self = __pyx_self;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":914
+  /* "cvcf.pyx":914
  *     def getfilter(self):
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         return self._filter             # <<<<<<<<<<<<<<
@@ -18412,7 +18191,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getfilter(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":916
+/* "cvcf.pyx":916
  *         return self._filter
  * 
  *     def setfilter(self,filter):             # <<<<<<<<<<<<<<
@@ -18420,10 +18199,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_getfilter(PyObject *__pyx_self, PyObject *_
  *         self._filter = filter
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_setfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setfilter = {__Pyx_NAMESTR("setfilter"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setfilter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_setfilter)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_29setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_29setfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_29setfilter = {__Pyx_NAMESTR("setfilter"), (PyCFunction)__pyx_pf_4cvcf_3VCF_29setfilter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_29setfilter)};
+static PyObject *__pyx_pf_4cvcf_3VCF_29setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filter = 0;
   PyObject *__pyx_r = NULL;
@@ -18471,7 +18250,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setfilter(PyObject *__pyx_self, PyObject *_
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":918
+  /* "cvcf.pyx":918
  *     def setfilter(self,filter):
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         self._filter = filter             # <<<<<<<<<<<<<<
@@ -18491,7 +18270,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setfilter(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":920
+/* "cvcf.pyx":920
  *         self._filter = filter
  * 
  *     def setversion(self, version):             # <<<<<<<<<<<<<<
@@ -18499,9 +18278,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setfilter(PyObject *__pyx_self, PyObject *_
  *         self._version = version
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setversion = {__Pyx_NAMESTR("setversion"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setversion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_30setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_30setversion = {__Pyx_NAMESTR("setversion"), (PyCFunction)__pyx_pf_4cvcf_3VCF_30setversion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_30setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_version = 0;
   PyObject *__pyx_r = NULL;
@@ -18509,7 +18288,6 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__version,0};
   __Pyx_RefNannySetupContext("setversion");
   __pyx_self = __pyx_self;
@@ -18554,7 +18332,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":921
+  /* "cvcf.pyx":921
  * 
  *     def setversion(self, version):
  *         if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files")             # <<<<<<<<<<<<<<
@@ -18575,22 +18353,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *
     __pyx_t_4 = __pyx_t_2;
   }
   if (__pyx_t_4) {
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_70));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_70));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_70));
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_Raise(__pyx_t_1, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":922
+  /* "cvcf.pyx":922
  *     def setversion(self, version):
  *         if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files")
  *         self._version = version             # <<<<<<<<<<<<<<
@@ -18603,7 +18375,6 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_5);
   __Pyx_AddTraceback("cvcf.VCF.setversion");
   __pyx_r = NULL;
   __pyx_L0:;
@@ -18612,7 +18383,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":924
+/* "cvcf.pyx":924
  *         self._version = version
  * 
  *     def setregions(self, regions):             # <<<<<<<<<<<<<<
@@ -18620,9 +18391,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setversion(PyObject *__pyx_self, PyObject *
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setregions = {__Pyx_NAMESTR("setregions"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setregions, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_31setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_31setregions = {__Pyx_NAMESTR("setregions"), (PyCFunction)__pyx_pf_4cvcf_3VCF_31setregions, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_31setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_regions = 0;
   PyObject *__pyx_r = NULL;
@@ -18670,7 +18441,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setregions(PyObject *__pyx_self, PyObject *
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":925
+  /* "cvcf.pyx":925
  * 
  *     def setregions(self, regions):
  *         self._regions = regions             # <<<<<<<<<<<<<<
@@ -18690,7 +18461,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setregions(PyObject *__pyx_self, PyObject *
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":927
+/* "cvcf.pyx":927
  *         self._regions = regions
  * 
  *     def setreference(self, ref):             # <<<<<<<<<<<<<<
@@ -18698,10 +18469,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setregions(PyObject *__pyx_self, PyObject *
  *         self._reference = ref
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_setreference[] = " Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_setreference = {__Pyx_NAMESTR("setreference"), (PyCFunction)__pyx_pf_4cvcf_3VCF_setreference, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_setreference)};
-static PyObject *__pyx_pf_4cvcf_3VCF_setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_32setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_32setreference[] = " Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_32setreference = {__Pyx_NAMESTR("setreference"), (PyCFunction)__pyx_pf_4cvcf_3VCF_32setreference, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_32setreference)};
+static PyObject *__pyx_pf_4cvcf_3VCF_32setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_ref = 0;
   PyObject *__pyx_r = NULL;
@@ -18749,7 +18520,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setreference(PyObject *__pyx_self, PyObject
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":929
+  /* "cvcf.pyx":929
  *     def setreference(self, ref):
  *         """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """
  *         self._reference = ref             # <<<<<<<<<<<<<<
@@ -18769,7 +18540,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setreference(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":931
+/* "cvcf.pyx":931
  *         self._reference = ref
  * 
  *     def ignoreerror(self, errorstring):             # <<<<<<<<<<<<<<
@@ -18777,9 +18548,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_setreference(PyObject *__pyx_self, PyObject
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_ignoreerror = {__Pyx_NAMESTR("ignoreerror"), (PyCFunction)__pyx_pf_4cvcf_3VCF_ignoreerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_33ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_33ignoreerror = {__Pyx_NAMESTR("ignoreerror"), (PyCFunction)__pyx_pf_4cvcf_3VCF_33ignoreerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_33ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_errorstring = 0;
   PyObject *__pyx_r = NULL;
@@ -18833,7 +18604,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":932
+  /* "cvcf.pyx":932
  * 
  *     def ignoreerror(self, errorstring):
  *         try:             self._ignored_errors.add(self.__dict__[errorstring])             # <<<<<<<<<<<<<<
@@ -18858,14 +18629,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
       __Pyx_GIVEREF(__pyx_t_3);
       __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     }
     __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
@@ -18877,7 +18648,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject
     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":933
+    /* "cvcf.pyx":933
  *     def ignoreerror(self, errorstring):
  *         try:             self._ignored_errors.add(self.__dict__[errorstring])
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)             # <<<<<<<<<<<<<<
@@ -18891,16 +18662,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_v_errorstring); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_v_errorstring); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_Raise(__pyx_t_5, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
@@ -18939,7 +18710,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":935
+/* "cvcf.pyx":935
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  * 
  *     def warnerror(self, errorstring):             # <<<<<<<<<<<<<<
@@ -18947,9 +18718,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_ignoreerror(PyObject *__pyx_self, PyObject
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_warnerror = {__Pyx_NAMESTR("warnerror"), (PyCFunction)__pyx_pf_4cvcf_3VCF_warnerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_34warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_34warnerror = {__Pyx_NAMESTR("warnerror"), (PyCFunction)__pyx_pf_4cvcf_3VCF_34warnerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pf_4cvcf_3VCF_34warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_errorstring = 0;
   PyObject *__pyx_r = NULL;
@@ -19003,7 +18774,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *_
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":936
+  /* "cvcf.pyx":936
  * 
  *     def warnerror(self, errorstring):
  *         try:             self._warn_errors.add(self.__dict__[errorstring])             # <<<<<<<<<<<<<<
@@ -19028,14 +18799,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *_
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
       __Pyx_GIVEREF(__pyx_t_3);
       __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     }
     __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
@@ -19047,7 +18818,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *_
     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":937
+    /* "cvcf.pyx":937
  *     def warnerror(self, errorstring):
  *         try:             self._warn_errors.add(self.__dict__[errorstring])
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)             # <<<<<<<<<<<<<<
@@ -19061,16 +18832,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *_
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_v_errorstring); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_v_errorstring); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_Raise(__pyx_t_5, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
@@ -19109,7 +18880,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *_
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":939
+/* "cvcf.pyx":939
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  * 
  *     def parse(self, stream):             # <<<<<<<<<<<<<<
@@ -19117,10 +18888,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_warnerror(PyObject *__pyx_self, PyObject *_
  *         last_line = self._parse_header(stream)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_parse[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4cvcf_3VCF_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_parse)};
-static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_35parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_35parse[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_35parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4cvcf_3VCF_35parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_35parse)};
+static PyObject *__pyx_pf_4cvcf_3VCF_35parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_last_line;
@@ -19173,7 +18944,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_last_line = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":941
+  /* "cvcf.pyx":941
  *     def parse(self, stream):
  *         """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
  *         last_line = self._parse_header(stream)             # <<<<<<<<<<<<<<
@@ -19183,19 +18954,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parse_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_stream);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream);
   __Pyx_GIVEREF(__pyx_v_stream);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_last_line);
   __pyx_v_last_line = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":944
+  /* "cvcf.pyx":944
  *         # now return a generator that does the actual work.  In this way the pre-processing is done
  *         # before the first piece of data is yielded
  *         return self._parse(last_line, stream)             # <<<<<<<<<<<<<<
@@ -19206,17 +18977,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_last_line);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_last_line);
   __Pyx_GIVEREF(__pyx_v_last_line);
   __Pyx_INCREF(__pyx_v_stream);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_stream);
   __Pyx_GIVEREF(__pyx_v_stream);
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -19236,7 +19007,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":946
+/* "cvcf.pyx":946
  *         return self._parse(last_line, stream)
  * 
  *     def write(self, stream, datagenerator):             # <<<<<<<<<<<<<<
@@ -19244,10 +19015,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_parse(PyObject *__pyx_self, PyObject *__pyx
  *         self.write_header(stream)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_write[] = " Writes a VCF file to a stream, using a data generator (or list) ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_write = {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4cvcf_3VCF_write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_write)};
-static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_36write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_36write[] = " Writes a VCF file to a stream, using a data generator (or list) ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_36write = {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4cvcf_3VCF_36write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_36write)};
+static PyObject *__pyx_pf_4cvcf_3VCF_36write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_datagenerator = 0;
@@ -19312,7 +19083,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":948
+  /* "cvcf.pyx":948
  *     def write(self, stream, datagenerator):
  *         """ Writes a VCF file to a stream, using a data generator (or list) """
  *         self.write_header(stream)             # <<<<<<<<<<<<<<
@@ -19322,17 +19093,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_stream);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream);
   __Pyx_GIVEREF(__pyx_v_stream);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":949
+  /* "cvcf.pyx":949
  *         """ Writes a VCF file to a stream, using a data generator (or list) """
  *         self.write_header(stream)
  *         self.write_heading(stream)             # <<<<<<<<<<<<<<
@@ -19342,17 +19113,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_heading); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_stream);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream);
   __Pyx_GIVEREF(__pyx_v_stream);
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":950
+  /* "cvcf.pyx":950
  *         self.write_header(stream)
  *         self.write_heading(stream)
  *         for data in datagenerator: self.write_data(stream,data)             # <<<<<<<<<<<<<<
@@ -19386,17 +19157,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(__pyx_v_stream);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stream);
     __Pyx_GIVEREF(__pyx_v_stream);
     __Pyx_INCREF(__pyx_v_data);
     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data);
     __Pyx_GIVEREF(__pyx_v_data);
-    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -19417,7 +19188,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":952
+/* "cvcf.pyx":952
  *         for data in datagenerator: self.write_data(stream,data)
  * 
  *     def writeheader(self, stream):             # <<<<<<<<<<<<<<
@@ -19425,10 +19196,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_write(PyObject *__pyx_self, PyObject *__pyx
  *         self.write_header(stream)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_writeheader[] = " Writes a VCF header ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_writeheader = {__Pyx_NAMESTR("writeheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_writeheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_writeheader)};
-static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_37writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_37writeheader[] = " Writes a VCF header ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_37writeheader = {__Pyx_NAMESTR("writeheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_37writeheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_37writeheader)};
+static PyObject *__pyx_pf_4cvcf_3VCF_37writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_r = NULL;
@@ -19479,7 +19250,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":954
+  /* "cvcf.pyx":954
  *     def writeheader(self, stream):
  *         """ Writes a VCF header """
  *         self.write_header(stream)             # <<<<<<<<<<<<<<
@@ -19489,17 +19260,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_stream);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream);
   __Pyx_GIVEREF(__pyx_v_stream);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":955
+  /* "cvcf.pyx":955
  *         """ Writes a VCF header """
  *         self.write_header(stream)
  *         self.write_heading(stream)             # <<<<<<<<<<<<<<
@@ -19509,14 +19280,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_heading); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_stream);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream);
   __Pyx_GIVEREF(__pyx_v_stream);
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -19533,7 +19304,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":957
+/* "cvcf.pyx":957
  *         self.write_heading(stream)
  * 
  *     def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2):             # <<<<<<<<<<<<<<
@@ -19541,10 +19312,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_writeheader(PyObject *__pyx_self, PyObject
  *         # a variant should always be assigned to a unique position, one base before
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_compare_calls[] = " Utility function: compares two calls for equality ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_compare_calls = {__Pyx_NAMESTR("compare_calls"), (PyCFunction)__pyx_pf_4cvcf_3VCF_compare_calls, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_compare_calls)};
-static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_38compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_38compare_calls[] = " Utility function: compares two calls for equality ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_38compare_calls = {__Pyx_NAMESTR("compare_calls"), (PyCFunction)__pyx_pf_4cvcf_3VCF_38compare_calls, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_38compare_calls)};
+static PyObject *__pyx_pf_4cvcf_3VCF_38compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_pos1 = 0;
   PyObject *__pyx_v_ref1 = 0;
@@ -19654,7 +19425,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObjec
   __Pyx_INCREF(__pyx_v_ref2);
   __Pyx_INCREF(__pyx_v_alt2);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":962
+  /* "cvcf.pyx":962
  *         # the leftmost position of the alignment gap.  If this rule is implemented
  *         # correctly, the two positions must be equal for the calls to be identical.
  *         if pos1 != pos2: return False             # <<<<<<<<<<<<<<
@@ -19676,7 +19447,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObjec
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":965
+  /* "cvcf.pyx":965
  *         # from both calls, trim rightmost bases when identical.  Do this safely, i.e.
  *         # only when the reference bases are not Ns
  *         while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:             # <<<<<<<<<<<<<<
@@ -19710,34 +19481,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObjec
     }
     if (!__pyx_t_4) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":966
+    /* "cvcf.pyx":966
  *         # only when the reference bases are not Ns
  *         while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:
  *             ref1 = ref1[:-1]             # <<<<<<<<<<<<<<
  *             alt1 = alt1[:-1]
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
  */
-    __pyx_t_6 = PySequence_GetSlice(__pyx_v_ref1, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_ref1, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_v_ref1);
     __pyx_v_ref1 = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":967
+    /* "cvcf.pyx":967
  *         while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:
  *             ref1 = ref1[:-1]
  *             alt1 = alt1[:-1]             # <<<<<<<<<<<<<<
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
  *             ref2 = ref2[:-1]
  */
-    __pyx_t_6 = PySequence_GetSlice(__pyx_v_alt1, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_alt1, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_v_alt1);
     __pyx_v_alt1 = __pyx_t_6;
     __pyx_t_6 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":968
+  /* "cvcf.pyx":968
  *             ref1 = ref1[:-1]
  *             alt1 = alt1[:-1]
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:             # <<<<<<<<<<<<<<
@@ -19771,34 +19542,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObjec
     }
     if (!__pyx_t_2) break;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":969
+    /* "cvcf.pyx":969
  *             alt1 = alt1[:-1]
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
  *             ref2 = ref2[:-1]             # <<<<<<<<<<<<<<
  *             alt2 = alt2[:-1]
  *         # now, the alternative alleles must be identical
  */
-    __pyx_t_1 = PySequence_GetSlice(__pyx_v_ref2, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_ref2, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_ref2);
     __pyx_v_ref2 = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":970
+    /* "cvcf.pyx":970
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
  *             ref2 = ref2[:-1]
  *             alt2 = alt2[:-1]             # <<<<<<<<<<<<<<
  *         # now, the alternative alleles must be identical
  *         return alt1 == alt2
  */
-    __pyx_t_1 = PySequence_GetSlice(__pyx_v_alt2, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_alt2, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_alt2);
     __pyx_v_alt2 = __pyx_t_1;
     __pyx_t_1 = 0;
   }
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":972
+  /* "cvcf.pyx":972
  *             alt2 = alt2[:-1]
  *         # now, the alternative alleles must be identical
  *         return alt1 == alt2             # <<<<<<<<<<<<<<
@@ -19830,7 +19601,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObjec
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":979
+/* "cvcf.pyx":979
  * ###########################################################################################################
  * 
  *     def connect( self, filename ):             # <<<<<<<<<<<<<<
@@ -19838,10 +19609,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_compare_calls(PyObject *__pyx_self, PyObjec
  *         self.tabixfile = pysam.Tabixfile( filename )
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_connect[] = "connect to tabix file.";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_4cvcf_3VCF_connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_connect)};
-static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_39connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_39connect[] = "connect to tabix file.";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_39connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_4cvcf_3VCF_39connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_39connect)};
+static PyObject *__pyx_pf_4cvcf_3VCF_39connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_r = NULL;
@@ -19892,7 +19663,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__p
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":981
+  /* "cvcf.pyx":981
  *     def connect( self, filename ):
  *         '''connect to tabix file.'''
  *         self.tabixfile = pysam.Tabixfile( filename )             # <<<<<<<<<<<<<<
@@ -19905,18 +19676,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__p
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
   __Pyx_GIVEREF(__pyx_v_filename);
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tabixfile, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":982
+  /* "cvcf.pyx":982
  *         '''connect to tabix file.'''
  *         self.tabixfile = pysam.Tabixfile( filename )
  *         self._parse_header(self.tabixfile.header)             # <<<<<<<<<<<<<<
@@ -19931,14 +19702,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__p
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -19955,7 +19726,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__p
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":984
+/* "cvcf.pyx":984
  *         self._parse_header(self.tabixfile.header)
  * 
  *     def fetch(self,             # <<<<<<<<<<<<<<
@@ -19963,10 +19734,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_connect(PyObject *__pyx_self, PyObject *__p
  *               start = None,
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_fetch[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_fetch = {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_4cvcf_3VCF_fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_fetch)};
-static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_40fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_40fetch[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_40fetch = {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_4cvcf_3VCF_40fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_40fetch)};
+static PyObject *__pyx_pf_4cvcf_3VCF_40fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
@@ -19985,7 +19756,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[5] = {0,0,0,0,0};
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":985
+    /* "cvcf.pyx":985
  * 
  *     def fetch(self,
  *               reference = None,             # <<<<<<<<<<<<<<
@@ -19994,7 +19765,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":986
+    /* "cvcf.pyx":986
  *     def fetch(self,
  *               reference = None,
  *               start = None,             # <<<<<<<<<<<<<<
@@ -20003,7 +19774,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":987
+    /* "cvcf.pyx":987
  *               reference = None,
  *               start = None,
  *               end = None,             # <<<<<<<<<<<<<<
@@ -20012,7 +19783,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":988
+    /* "cvcf.pyx":988
  *               start = None,
  *               end = None,
  *               region = None ):             # <<<<<<<<<<<<<<
@@ -20065,7 +19836,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
     __pyx_v_region = values[4];
   } else {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":985
+    /* "cvcf.pyx":985
  * 
  *     def fetch(self,
  *               reference = None,             # <<<<<<<<<<<<<<
@@ -20074,7 +19845,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  */
     __pyx_v_reference = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":986
+    /* "cvcf.pyx":986
  *     def fetch(self,
  *               reference = None,
  *               start = None,             # <<<<<<<<<<<<<<
@@ -20083,7 +19854,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  */
     __pyx_v_start = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":987
+    /* "cvcf.pyx":987
  *               reference = None,
  *               start = None,
  *               end = None,             # <<<<<<<<<<<<<<
@@ -20092,7 +19863,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  */
     __pyx_v_end = ((PyObject *)Py_None);
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":988
+    /* "cvcf.pyx":988
  *               start = None,
  *               end = None,
  *               region = None ):             # <<<<<<<<<<<<<<
@@ -20119,7 +19890,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
   return NULL;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":991
+  /* "cvcf.pyx":991
  *         """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
  * 
  *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )             # <<<<<<<<<<<<<<
@@ -20133,7 +19904,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
@@ -20149,19 +19920,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
   __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
   __Pyx_GIVEREF(__pyx_v_self);
-  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cvcf_asVCFRecord)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cvcf_asVCFRecord)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__parser), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_r = __pyx_t_5;
   __pyx_t_5 = 0;
@@ -20183,7 +19954,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
   return __pyx_r;
 }
 
-/* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":993
+/* "cvcf.pyx":993
  *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )
  * 
  *     def validate( self, record ):             # <<<<<<<<<<<<<<
@@ -20191,10 +19962,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_fetch(PyObject *__pyx_self, PyObject *__pyx
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_validate[] = "validate vcf record.\n\n        returns a validated record.\n        ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_validate = {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pf_4cvcf_3VCF_validate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_validate)};
-static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pf_4cvcf_3VCF_41validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cvcf_3VCF_41validate[] = "validate vcf record.\n\n        returns a validated record.\n        ";
+static PyMethodDef __pyx_mdef_4cvcf_3VCF_41validate = {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pf_4cvcf_3VCF_41validate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_41validate)};
+static PyObject *__pyx_pf_4cvcf_3VCF_41validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_record = 0;
   PyObject *__pyx_v_chrom;
@@ -20219,7 +19990,6 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   int __pyx_v_movable;
   PyObject *__pyx_v_longest;
   PyObject *__pyx_v_shortest;
-  PyObject *__pyx_8genexpr1__pyx_v_allele;
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -20291,163 +20061,156 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   __pyx_v_faref_leftflank = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_faref = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_newalts = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_newalts = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_a = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_addns = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_na = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_alt = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_alt = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   __pyx_v_addn = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_allele = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_longest = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_shortest = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_8genexpr1__pyx_v_allele = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":999
+  /* "cvcf.pyx":999
  *         '''
  * 
  *         raise NotImplementedError( "needs to be checked" )             # <<<<<<<<<<<<<<
  * 
  *         chrom, pos = record.chrom, record.pos
  */
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_72));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_72));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_72));
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_Raise(__pyx_t_1, 0, 0);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_Raise(__pyx_t_2, 0, 0);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1001
+  /* "cvcf.pyx":1001
  *         raise NotImplementedError( "needs to be checked" )
  * 
  *         chrom, pos = record.chrom, record.pos             # <<<<<<<<<<<<<<
  * 
  *         # check reference
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_chrom);
-  __pyx_v_chrom = __pyx_t_2;
-  __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_pos);
-  __pyx_v_pos = __pyx_t_1;
+  __pyx_v_chrom = __pyx_t_1;
   __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_v_pos);
+  __pyx_v_pos = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1004
+  /* "cvcf.pyx":1004
  * 
  *         # check reference
  *         ref = record.ref             # <<<<<<<<<<<<<<
  *         if ref == ".":
  *             self.error(str(record),self.MISSING_REF)
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_ref);
-  __pyx_v_ref = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_ref = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1005
+  /* "cvcf.pyx":1005
  *         # check reference
  *         ref = record.ref
  *         if ref == ".":             # <<<<<<<<<<<<<<
  *             self.error(str(record),self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_6), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1006
+    /* "cvcf.pyx":1006
  *         ref = record.ref
  *         if ref == ".":
  *             self.error(str(record),self.MISSING_REF)             # <<<<<<<<<<<<<<
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  *             else:                   ref = ""
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_record);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_record);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
     __Pyx_GIVEREF(__pyx_v_record);
-    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__MISSING_REF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__MISSING_REF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_4 = 0;
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1007
+    /* "cvcf.pyx":1007
  *         if ref == ".":
  *             self.error(str(record),self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)             # <<<<<<<<<<<<<<
  *             else:                   ref = ""
  *         else:
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_3) {
       __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyNumber_Add(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_INCREF(__pyx_v_chrom);
       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom);
       __Pyx_GIVEREF(__pyx_v_chrom);
       __Pyx_INCREF(__pyx_v_pos);
       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_pos);
       __Pyx_GIVEREF(__pyx_v_pos);
-      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
-      __pyx_t_2 = 0;
+      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_1;
-      __pyx_t_1 = 0;
+      __pyx_v_ref = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L7;
     }
     /*else*/ {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1008
+      /* "cvcf.pyx":1008
  *             self.error(str(record),self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  *             else:                   ref = ""             # <<<<<<<<<<<<<<
@@ -20463,7 +20226,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1010
+    /* "cvcf.pyx":1010
  *             else:                   ref = ""
  *         else:
  *             for c in ref:             # <<<<<<<<<<<<<<
@@ -20471,20 +20234,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                 if "N" in ref: ref = get_sequence(chrom,
  */
     if (PyList_CheckExact(__pyx_v_ref) || PyTuple_CheckExact(__pyx_v_ref)) {
-      __pyx_t_6 = 0; __pyx_t_1 = __pyx_v_ref; __Pyx_INCREF(__pyx_t_1);
+      __pyx_t_6 = 0; __pyx_t_2 = __pyx_v_ref; __Pyx_INCREF(__pyx_t_2);
     } else {
-      __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
     }
     for (;;) {
-      if (likely(PyList_CheckExact(__pyx_t_1))) {
-        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
-        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
-      } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
-        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
+      if (likely(PyList_CheckExact(__pyx_t_2))) {
+        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
+        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
+      } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
       } else {
-        __pyx_t_4 = PyIter_Next(__pyx_t_1);
+        __pyx_t_4 = PyIter_Next(__pyx_t_2);
         if (!__pyx_t_4) {
           if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           break;
@@ -20495,7 +20258,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __pyx_v_c = __pyx_t_4;
       __pyx_t_4 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1011
+      /* "cvcf.pyx":1011
  *         else:
  *             for c in ref:
  *                 if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF)             # <<<<<<<<<<<<<<
@@ -20507,33 +20270,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
-        __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
         __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__UNKNOWN_CHAR_IN_REF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
+        __Pyx_GIVEREF(__pyx_t_1);
         PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
         __Pyx_GIVEREF(__pyx_t_5);
-        __pyx_t_2 = 0;
+        __pyx_t_1 = 0;
         __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         goto __pyx_L10;
       }
       __pyx_L10:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1012
+      /* "cvcf.pyx":1012
  *             for c in ref:
  *                 if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF)
  *                 if "N" in ref: ref = get_sequence(chrom,             # <<<<<<<<<<<<<<
@@ -20545,7 +20308,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1014
+        /* "cvcf.pyx":1014
  *                 if "N" in ref: ref = get_sequence(chrom,
  *                                                   pos,
  *                                                   pos+len(ref),             # <<<<<<<<<<<<<<
@@ -20559,7 +20322,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1015
+        /* "cvcf.pyx":1015
  *                                                   pos,
  *                                                   pos+len(ref),
  *                                                   self._reference)             # <<<<<<<<<<<<<<
@@ -20568,24 +20331,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_chrom);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
         __Pyx_INCREF(__pyx_v_pos);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pos);
+        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pos);
         __Pyx_GIVEREF(__pyx_v_pos);
-        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
+        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
         __Pyx_GIVEREF(__pyx_t_4);
-        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7);
+        PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_4 = 0;
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_v_ref);
         __pyx_v_ref = __pyx_t_7;
         __pyx_t_7 = 0;
@@ -20593,101 +20356,101 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       }
       __pyx_L11:;
     }
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
   __pyx_L6:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1018
+  /* "cvcf.pyx":1018
  * 
  *         # make sure reference is sane
  *         if self._reference:             # <<<<<<<<<<<<<<
  *             left = max(0,self.pos-100)
  *             faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1019
+    /* "cvcf.pyx":1019
  *         # make sure reference is sane
  *         if self._reference:
  *             left = max(0,self.pos-100)             # <<<<<<<<<<<<<<
  *             faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)
  *             faref = faref_leftflank[pos-left:]
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = PyNumber_Subtract(__pyx_t_1, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_9 = 0;
-    __pyx_t_2 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_3) {
       __Pyx_INCREF(__pyx_t_7);
-      __pyx_t_1 = __pyx_t_7;
+      __pyx_t_2 = __pyx_t_7;
     } else {
       __pyx_t_5 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = __pyx_t_5;
+      __pyx_t_2 = __pyx_t_5;
       __pyx_t_5 = 0;
     }
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_v_left);
-    __pyx_v_left = __pyx_t_1;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_left = __pyx_t_2;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1020
+    /* "cvcf.pyx":1020
  *         if self._reference:
  *             left = max(0,self.pos-100)
  *             faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)             # <<<<<<<<<<<<<<
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     __Pyx_INCREF(__pyx_v_chrom);
     PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chrom);
     __Pyx_GIVEREF(__pyx_v_chrom);
     __Pyx_INCREF(__pyx_v_left);
     PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_left);
     __Pyx_GIVEREF(__pyx_v_left);
-    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_2 = 0;
+    __pyx_t_1 = 0;
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_v_faref_leftflank);
     __pyx_v_faref_leftflank = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1021
+    /* "cvcf.pyx":1021
  *             left = max(0,self.pos-100)
  *             faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)
  *             faref = faref_leftflank[pos-left:]             # <<<<<<<<<<<<<<
@@ -20698,13 +20461,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_6, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_6, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_v_faref);
     __pyx_v_faref = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1022
+    /* "cvcf.pyx":1022
  *             faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))             # <<<<<<<<<<<<<<
@@ -20719,47 +20482,47 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_INCREF(__pyx_v_record);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_record);
       __Pyx_GIVEREF(__pyx_v_record);
-      __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__WRONG_REF); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_INCREF(__pyx_v_faref);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_faref);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_faref);
       __Pyx_GIVEREF(__pyx_v_faref);
       __Pyx_INCREF(__pyx_v_ref);
-      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ref);
+      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref);
       __Pyx_GIVEREF(__pyx_v_ref);
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_64), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_103), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-      __Pyx_GIVEREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_4));
+      PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_1 = 0;
+      __pyx_t_2 = 0;
       __pyx_t_7 = 0;
       __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       goto __pyx_L13;
     }
     __pyx_L13:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1023
+    /* "cvcf.pyx":1023
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
  *             ref = faref             # <<<<<<<<<<<<<<
@@ -20773,7 +20536,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   }
   __pyx_L12:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1026
+  /* "cvcf.pyx":1026
  * 
  *         # check: format fields are defined
  *         for f in record.format:             # <<<<<<<<<<<<<<
@@ -20783,21 +20546,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   __pyx_t_4 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
-    __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1);
   } else {
-    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
+    if (likely(PyList_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
     } else {
-      __pyx_t_4 = PyIter_Next(__pyx_t_2);
+      __pyx_t_4 = PyIter_Next(__pyx_t_1);
       if (!__pyx_t_4) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
@@ -20808,7 +20571,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_v_f = __pyx_t_4;
     __pyx_t_4 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1027
+    /* "cvcf.pyx":1027
  *         # check: format fields are defined
  *         for f in record.format:
  *             if f not in self._format: self.error(str(record),self.FORMAT_NOT_DEFINED, f)             # <<<<<<<<<<<<<<
@@ -20823,119 +20586,119 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_record);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record);
       __Pyx_GIVEREF(__pyx_v_record);
-      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
+      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
       __Pyx_GIVEREF(__pyx_t_5);
       __Pyx_INCREF(__pyx_v_f);
-      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_f);
+      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
       __pyx_t_7 = 0;
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       goto __pyx_L16;
     }
     __pyx_L16:;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1030
+  /* "cvcf.pyx":1030
  * 
  *         # check: all filters are defined
  *         for f in record.filter:             # <<<<<<<<<<<<<<
  *             if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f)
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__filter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-    __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__filter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+    __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5);
   } else {
-    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   for (;;) {
     if (likely(PyList_CheckExact(__pyx_t_5))) {
       if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++;
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
     } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
       if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++;
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
     } else {
-      __pyx_t_2 = PyIter_Next(__pyx_t_5);
-      if (!__pyx_t_2) {
+      __pyx_t_1 = PyIter_Next(__pyx_t_5);
+      if (!__pyx_t_1) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_1);
     }
     __Pyx_DECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_f = __pyx_t_1;
+    __pyx_t_1 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1031
+    /* "cvcf.pyx":1031
  *         # check: all filters are defined
  *         for f in record.filter:
  *             if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f)             # <<<<<<<<<<<<<<
  * 
  *         # convert v3.3 alleles
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_2, __pyx_v_f))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_1, __pyx_v_f))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_3) {
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_record);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_record);
       __Pyx_GIVEREF(__pyx_v_record);
-      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
       __Pyx_GIVEREF(__pyx_t_4);
-      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
-      __Pyx_GIVEREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
       __pyx_t_4 = 0;
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       goto __pyx_L19;
     }
     __pyx_L19:;
   }
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1034
+  /* "cvcf.pyx":1034
  * 
  *         # convert v3.3 alleles
  *         if self._version == 33:             # <<<<<<<<<<<<<<
@@ -20944,14 +20707,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
   __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1035
+    /* "cvcf.pyx":1035
  *         # convert v3.3 alleles
  *         if self._version == 33:
  *             if len(ref) != 1: self.error(str(record),self.V33_BAD_REF)             # <<<<<<<<<<<<<<
@@ -20961,36 +20724,36 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = (__pyx_t_6 != 1);
     if (__pyx_t_3) {
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_INCREF(__pyx_v_record);
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record);
       __Pyx_GIVEREF(__pyx_v_record);
-      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
+      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
+      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
       __Pyx_GIVEREF(__pyx_t_5);
       __pyx_t_7 = 0;
       __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       goto __pyx_L21;
     }
     __pyx_L21:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1036
+    /* "cvcf.pyx":1036
  *         if self._version == 33:
  *             if len(ref) != 1: self.error(str(record),self.V33_BAD_REF)
  *             newalts = []             # <<<<<<<<<<<<<<
@@ -21003,7 +20766,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_v_newalts = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1037
+    /* "cvcf.pyx":1037
  *             if len(ref) != 1: self.error(str(record),self.V33_BAD_REF)
  *             newalts = []
  *             have_deletions = False             # <<<<<<<<<<<<<<
@@ -21012,26 +20775,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
     __pyx_v_have_deletions = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1038
+    /* "cvcf.pyx":1038
  *             newalts = []
  *             have_deletions = False
  *             for a in alt:             # <<<<<<<<<<<<<<
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  */
-    if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-      __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-    } else {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_v_alt == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
+    __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
     for (;;) {
       if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++;
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
       __Pyx_DECREF(__pyx_v_a);
-      __pyx_v_a = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_a = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1039
+      /* "cvcf.pyx":1039
  *             have_deletions = False
  *             for a in alt:
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference             # <<<<<<<<<<<<<<
@@ -21041,81 +20803,69 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __pyx_t_8 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_3 = (__pyx_t_8 == 1);
       if (__pyx_t_3) {
-        __pyx_t_2 = PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_1 = PyNumber_Add(__pyx_v_a, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyNumber_Add(__pyx_v_a, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_1;
-        __pyx_t_1 = 0;
+        __pyx_v_a = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L24;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1040
+      /* "cvcf.pyx":1040
  *             for a in alt:
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference             # <<<<<<<<<<<<<<
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_n_s__I));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__I));
-      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
-      __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_3) {
-        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_2 = PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_7;
-        __pyx_t_7 = 0;
+        __pyx_v_a = __pyx_t_1;
+        __pyx_t_1 = 0;
         goto __pyx_L24;
       }
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1041
+      /* "cvcf.pyx":1041
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  *                 elif a.startswith('D'): # allow D<seq> and D<num>             # <<<<<<<<<<<<<<
  *                     have_deletions = True
  *                     try:
  */
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__D));
-      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
-      __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_125), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_3) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1042
+        /* "cvcf.pyx":1042
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True             # <<<<<<<<<<<<<<
@@ -21124,7 +20874,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
         __pyx_v_have_deletions = 1;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1043
+        /* "cvcf.pyx":1043
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True
  *                     try:             # <<<<<<<<<<<<<<
@@ -21139,28 +20889,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           __Pyx_XGOTREF(__pyx_save_exc_tb);
           /*try:*/ {
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1044
+            /* "cvcf.pyx":1044
  *                     have_deletions = True
  *                     try:
  *                         l = int(a[1:])          # throws ValueError if sequence             # <<<<<<<<<<<<<<
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  */
-            __pyx_t_1 = PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-            __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
             __Pyx_GOTREF(__pyx_t_2);
-            PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-            __Pyx_GIVEREF(__pyx_t_1);
-            __pyx_t_1 = 0;
-            __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-            __Pyx_GOTREF(__pyx_t_1);
-            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+            __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+            PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+            __Pyx_GIVEREF(__pyx_t_2);
+            __pyx_t_2 = 0;
+            __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __Pyx_GOTREF(__pyx_t_2);
+            __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
             __Pyx_DECREF(__pyx_v_l);
-            __pyx_v_l = __pyx_t_1;
-            __pyx_t_1 = 0;
+            __pyx_v_l = __pyx_t_2;
+            __pyx_t_2 = 0;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1045
+            /* "cvcf.pyx":1045
  *                     try:
  *                         l = int(a[1:])          # throws ValueError if sequence
  *                         if len(ref) < l:        # add to reference if necessary             # <<<<<<<<<<<<<<
@@ -21168,57 +20918,57 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                             ref += addns
  */
             __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-            __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-            __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
             __Pyx_GOTREF(__pyx_t_2);
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-            __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __Pyx_GOTREF(__pyx_t_1);
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+            __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             if (__pyx_t_3) {
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1046
+              /* "cvcf.pyx":1046
  *                         l = int(a[1:])          # throws ValueError if sequence
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)             # <<<<<<<<<<<<<<
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  */
-              __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-              __Pyx_GOTREF(__pyx_t_2);
-              __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-              __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_7 = PyNumber_Add(__pyx_v_pos, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+              __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+              __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+              __Pyx_GOTREF(__pyx_t_2);
+              __pyx_t_7 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
               __Pyx_GOTREF(__pyx_t_7);
-              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-              __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+              __pyx_t_2 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+              __Pyx_GOTREF(__pyx_t_2);
               __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
               __Pyx_GOTREF(__pyx_t_4);
               __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
               __Pyx_INCREF(__pyx_v_chrom);
               PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom);
               __Pyx_GIVEREF(__pyx_v_chrom);
               PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7);
               __Pyx_GIVEREF(__pyx_t_7);
-              PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1);
-              __Pyx_GIVEREF(__pyx_t_1);
+              PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2);
+              __Pyx_GIVEREF(__pyx_t_2);
               PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_4);
               __Pyx_GIVEREF(__pyx_t_4);
               __pyx_t_7 = 0;
-              __pyx_t_1 = 0;
+              __pyx_t_2 = 0;
               __pyx_t_4 = 0;
-              __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+              __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
               __Pyx_DECREF(__pyx_v_addns);
               __pyx_v_addns = __pyx_t_4;
               __pyx_t_4 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1047
+              /* "cvcf.pyx":1047
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns             # <<<<<<<<<<<<<<
@@ -21231,7 +20981,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
               __pyx_v_ref = __pyx_t_4;
               __pyx_t_4 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1048
+              /* "cvcf.pyx":1048
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns             # <<<<<<<<<<<<<<
@@ -21240,29 +20990,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
               __Pyx_INCREF(__pyx_int_0);
               __pyx_t_4 = __pyx_int_0;
-              if (likely(((PyObject *)__pyx_v_newalts) != Py_None)) {
-                __pyx_t_8 = 0; __pyx_t_10 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_10);
-              } else {
-                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-              }
+              __pyx_t_8 = 0; __pyx_t_10 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_10);
               for (;;) {
                 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
-                __pyx_t_2 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++;
+                __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++;
                 __Pyx_DECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_2;
-                __pyx_t_2 = 0;
+                __pyx_v_na = __pyx_t_1;
+                __pyx_t_1 = 0;
                 __Pyx_INCREF(__pyx_t_4);
                 __Pyx_DECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_4;
-                __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-                __Pyx_GOTREF(__pyx_t_2);
+                __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+                __Pyx_GOTREF(__pyx_t_1);
                 __Pyx_DECREF(__pyx_t_4);
-                __pyx_t_4 = __pyx_t_2;
-                __pyx_t_2 = 0;
-                __pyx_t_2 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-                __Pyx_GOTREF(__pyx_t_2);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                __pyx_t_4 = __pyx_t_1;
+                __pyx_t_1 = 0;
+                __pyx_t_1 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+                __Pyx_GOTREF(__pyx_t_1);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               }
               __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -21270,7 +21016,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
             }
             __pyx_L33:;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1049
+            /* "cvcf.pyx":1049
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l             # <<<<<<<<<<<<<<
@@ -21278,7 +21024,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                         s = a[1:]
  */
             __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_l); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
-            __pyx_t_4 = PySequence_GetSlice(__pyx_v_ref, __pyx_t_8, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
+            __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_8, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L25_error;}
             __Pyx_GOTREF(__pyx_t_4);
             __Pyx_DECREF(__pyx_v_a);
             __pyx_v_a = __pyx_t_4;
@@ -21290,12 +21036,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           goto __pyx_L32_try_end;
           __pyx_L25_error:;
           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1050
+          /* "cvcf.pyx":1050
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
  *                     except ValueError:             # <<<<<<<<<<<<<<
@@ -21305,25 +21051,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
           if (__pyx_t_11) {
             __Pyx_AddTraceback("cvcf.VCF.validate");
-            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
             __Pyx_GOTREF(__pyx_t_4);
             __Pyx_GOTREF(__pyx_t_10);
-            __Pyx_GOTREF(__pyx_t_2);
+            __Pyx_GOTREF(__pyx_t_1);
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1051
+            /* "cvcf.pyx":1051
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
  *                     except ValueError:
  *                         s = a[1:]             # <<<<<<<<<<<<<<
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  */
-            __pyx_t_1 = PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-            __Pyx_GOTREF(__pyx_t_1);
+            __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+            __Pyx_GOTREF(__pyx_t_2);
             __Pyx_DECREF(__pyx_v_s);
-            __pyx_v_s = __pyx_t_1;
-            __pyx_t_1 = 0;
+            __pyx_v_s = __pyx_t_2;
+            __pyx_t_2 = 0;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1052
+            /* "cvcf.pyx":1052
  *                     except ValueError:
  *                         s = a[1:]
  *                         if len(ref) < len(s):   # add Ns to reference if necessary             # <<<<<<<<<<<<<<
@@ -21335,15 +21081,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
             __pyx_t_3 = (__pyx_t_8 < __pyx_t_12);
             if (__pyx_t_3) {
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1053
+              /* "cvcf.pyx":1053
  *                         s = a[1:]
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)             # <<<<<<<<<<<<<<
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(str(record),self.V33_UNMATCHED_DELETION,
  */
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-              __Pyx_GOTREF(__pyx_t_1);
+              __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+              __Pyx_GOTREF(__pyx_t_2);
               __pyx_t_12 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
               __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
               __Pyx_GOTREF(__pyx_t_7);
@@ -21359,7 +21105,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
               __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
               __Pyx_GOTREF(__pyx_t_7);
               __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-              __Pyx_GOTREF(__pyx_t_15);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_15));
               __Pyx_INCREF(__pyx_v_chrom);
               PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom);
               __Pyx_GIVEREF(__pyx_v_chrom);
@@ -21372,15 +21118,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
               __pyx_t_13 = 0;
               __pyx_t_14 = 0;
               __pyx_t_7 = 0;
-              __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+              __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
               __Pyx_GOTREF(__pyx_t_7);
-              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
               __Pyx_DECREF(__pyx_v_addns);
               __pyx_v_addns = __pyx_t_7;
               __pyx_t_7 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1054
+              /* "cvcf.pyx":1054
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):             # <<<<<<<<<<<<<<
@@ -21390,56 +21136,56 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
               __pyx_t_7 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__endswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
               __Pyx_GOTREF(__pyx_t_7);
               __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-              __Pyx_GOTREF(__pyx_t_15);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_15));
               __Pyx_INCREF(__pyx_v_addns);
               PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_addns);
               __Pyx_GIVEREF(__pyx_v_addns);
-              __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-              __Pyx_GOTREF(__pyx_t_1);
+              __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+              __Pyx_GOTREF(__pyx_t_2);
               __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-              __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+              __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
               __pyx_t_16 = (!__pyx_t_3);
               if (__pyx_t_16) {
                 __pyx_t_12 = PyObject_Length(__pyx_v_addns); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
-                __pyx_t_15 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_GOTREF(__pyx_t_2);
+                __pyx_t_15 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(((PyObject *)__pyx_t_15));
-                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-                __pyx_t_1 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_15), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
+                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                __pyx_t_2 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_15), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_GOTREF(__pyx_t_2);
                 __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-                __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+                __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                 __pyx_t_17 = __pyx_t_3;
               } else {
                 __pyx_t_17 = __pyx_t_16;
               }
               if (__pyx_t_17) {
 
-                /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1055
+                /* "cvcf.pyx":1055
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(str(record),self.V33_UNMATCHED_DELETION,             # <<<<<<<<<<<<<<
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns
  */
-                __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
+                __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_GOTREF(__pyx_t_2);
                 __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_15);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_15));
                 __Pyx_INCREF(__pyx_v_record);
                 PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_record);
                 __Pyx_GIVEREF(__pyx_v_record);
-                __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(__pyx_t_7);
-                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-                __pyx_t_15 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_65); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+                __pyx_t_15 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_111); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(__pyx_t_15);
 
-                /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1056
+                /* "cvcf.pyx":1056
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(str(record),self.V33_UNMATCHED_DELETION,
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))             # <<<<<<<<<<<<<<
@@ -21457,7 +21203,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
                 __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(__pyx_t_13);
                 __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_19);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_19));
                 __Pyx_INCREF(__pyx_v_chrom);
                 PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_chrom);
                 __Pyx_GIVEREF(__pyx_v_chrom);
@@ -21470,23 +21216,23 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
                 __Pyx_GIVEREF(__pyx_t_13);
                 __pyx_t_18 = 0;
                 __pyx_t_13 = 0;
-                __pyx_t_13 = PyObject_Call(__pyx_t_14, __pyx_t_19, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __pyx_t_13 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(__pyx_t_13);
                 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
+                __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
                 __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_19);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_19));
                 __Pyx_INCREF(__pyx_v_a);
                 PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_a);
                 __Pyx_GIVEREF(__pyx_v_a);
                 PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_13);
                 __Pyx_GIVEREF(__pyx_t_13);
                 __pyx_t_13 = 0;
-                __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), __pyx_t_19); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_112), ((PyObject *)__pyx_t_19)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
+                __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
                 __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_19);
+                __Pyx_GOTREF(((PyObject *)__pyx_t_19));
                 PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_7);
                 __Pyx_GIVEREF(__pyx_t_7);
                 PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_15);
@@ -21496,16 +21242,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
                 __pyx_t_7 = 0;
                 __pyx_t_15 = 0;
                 __pyx_t_13 = 0;
-                __pyx_t_13 = PyObject_Call(__pyx_t_1, __pyx_t_19, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
                 __Pyx_GOTREF(__pyx_t_13);
-                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
+                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
                 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                 goto __pyx_L39;
               }
               __pyx_L39:;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1057
+              /* "cvcf.pyx":1057
  *                                 self.error(str(record),self.V33_UNMATCHED_DELETION,
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns             # <<<<<<<<<<<<<<
@@ -21518,7 +21264,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
               __pyx_v_ref = __pyx_t_13;
               __pyx_t_13 = 0;
 
-              /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1058
+              /* "cvcf.pyx":1058
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns             # <<<<<<<<<<<<<<
@@ -21527,29 +21273,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
               __Pyx_INCREF(__pyx_int_0);
               __pyx_t_13 = __pyx_int_0;
-              if (likely(((PyObject *)__pyx_v_newalts) != Py_None)) {
-                __pyx_t_12 = 0; __pyx_t_19 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_19);
-              } else {
-                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-              }
+              __pyx_t_12 = 0; __pyx_t_19 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_19);
               for (;;) {
                 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_19)) break;
-                __pyx_t_1 = PyList_GET_ITEM(__pyx_t_19, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++;
+                __pyx_t_2 = PyList_GET_ITEM(__pyx_t_19, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
                 __Pyx_DECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_1;
-                __pyx_t_1 = 0;
+                __pyx_v_na = __pyx_t_2;
+                __pyx_t_2 = 0;
                 __Pyx_INCREF(__pyx_t_13);
                 __Pyx_DECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_13;
-                __pyx_t_1 = PyNumber_Add(__pyx_t_13, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
+                __pyx_t_2 = PyNumber_Add(__pyx_t_13, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_GOTREF(__pyx_t_2);
                 __Pyx_DECREF(__pyx_t_13);
-                __pyx_t_13 = __pyx_t_1;
-                __pyx_t_1 = 0;
-                __pyx_t_1 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-                __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+                __pyx_t_13 = __pyx_t_2;
+                __pyx_t_2 = 0;
+                __pyx_t_2 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_GOTREF(__pyx_t_2);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
               }
               __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
               __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
@@ -21557,7 +21299,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
             }
             __pyx_L38:;
 
-            /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1059
+            /* "cvcf.pyx":1059
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[len(s):]        # new deletion, deleting from pos             # <<<<<<<<<<<<<<
@@ -21565,14 +21307,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                     self.error(str(record),self.V33_BAD_ALLELE)
  */
             __pyx_t_12 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
-            __pyx_t_13 = PySequence_GetSlice(__pyx_v_ref, __pyx_t_12, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
+            __pyx_t_13 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_12, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;}
             __Pyx_GOTREF(__pyx_t_13);
             __Pyx_DECREF(__pyx_v_a);
             __pyx_v_a = __pyx_t_13;
             __pyx_t_13 = 0;
             __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             goto __pyx_L26_exception_handled;
           }
           __pyx_L27_except_error:;
@@ -21592,42 +21334,42 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1061
+        /* "cvcf.pyx":1061
  *                         a = ref[len(s):]        # new deletion, deleting from pos
  *                 else:
  *                     self.error(str(record),self.V33_BAD_ALLELE)             # <<<<<<<<<<<<<<
  *                 newalts.append(a)
  *             alt = newalts
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
-        __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_13);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_13));
         PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4);
         __Pyx_GIVEREF(__pyx_t_4);
         PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10);
         __Pyx_GIVEREF(__pyx_t_10);
         __pyx_t_4 = 0;
         __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L24:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1062
+      /* "cvcf.pyx":1062
  *                 else:
  *                     self.error(str(record),self.V33_BAD_ALLELE)
  *                 newalts.append(a)             # <<<<<<<<<<<<<<
@@ -21637,11 +21379,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       if (unlikely(__pyx_v_newalts == Py_None)) {
         PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
-      __pyx_t_11 = PyList_Append(((PyObject *)__pyx_v_newalts), __pyx_v_a); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = PyList_Append(__pyx_v_newalts, __pyx_v_a); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1063
+    /* "cvcf.pyx":1063
  *                     self.error(str(record),self.V33_BAD_ALLELE)
  *                 newalts.append(a)
  *             alt = newalts             # <<<<<<<<<<<<<<
@@ -21652,7 +21394,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __Pyx_DECREF(((PyObject *)__pyx_v_alt));
     __pyx_v_alt = __pyx_v_newalts;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1065
+    /* "cvcf.pyx":1065
  *             alt = newalts
  *             # deletion alleles exist, add dummy 1st reference allele, and account for leading base
  *             if have_deletions:             # <<<<<<<<<<<<<<
@@ -21661,7 +21403,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
     if (__pyx_v_have_deletions) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1066
+      /* "cvcf.pyx":1066
  *             # deletion alleles exist, add dummy 1st reference allele, and account for leading base
  *             if have_deletions:
  *                 if pos == 0:             # <<<<<<<<<<<<<<
@@ -21674,7 +21416,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_17) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1068
+        /* "cvcf.pyx":1068
  *                 if pos == 0:
  *                     # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)             # <<<<<<<<<<<<<<
@@ -21692,16 +21434,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_2 = PyNumber_Add(__pyx_v_pos, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
         __Pyx_INCREF(__pyx_v_chrom);
         PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
@@ -21709,46 +21451,45 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __Pyx_GIVEREF(__pyx_t_13);
         PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_10);
         __Pyx_GIVEREF(__pyx_t_10);
-        PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1);
+        __Pyx_GIVEREF(__pyx_t_1);
         __pyx_t_13 = 0;
         __pyx_t_10 = 0;
-        __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = 0;
+        __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
         __Pyx_DECREF(__pyx_v_addn);
-        __pyx_v_addn = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_addn = __pyx_t_1;
+        __pyx_t_1 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1069
+        /* "cvcf.pyx":1069
  *                     # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
  *                     ref += addn             # <<<<<<<<<<<<<<
  *                     alt = [allele+addn for allele in alt]
  *                 else:
  */
-        __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_ref = __pyx_t_1;
+        __pyx_t_1 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1070
+        /* "cvcf.pyx":1070
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
  *                     ref += addn
  *                     alt = [allele+addn for allele in alt]             # <<<<<<<<<<<<<<
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  */
-        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-        if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-          __pyx_t_6 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_4);
-        } else {
-          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+        if (unlikely(__pyx_v_alt == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
+        __pyx_t_6 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_4);
         for (;;) {
           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
           __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
@@ -21757,33 +21498,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           __pyx_t_5 = 0;
           __pyx_t_5 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_5);
-          if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         }
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_2));
+        __Pyx_INCREF(((PyObject *)__pyx_t_1));
         __Pyx_DECREF(((PyObject *)__pyx_v_alt));
-        __pyx_v_alt = __pyx_t_2;
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_v_alt = __pyx_t_1;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         goto __pyx_L43;
       }
       /*else*/ {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1072
+        /* "cvcf.pyx":1072
  *                     alt = [allele+addn for allele in alt]
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)             # <<<<<<<<<<<<<<
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]
  */
-        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_4 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __Pyx_INCREF(__pyx_v_chrom);
         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
@@ -21796,15 +21537,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __Pyx_GIVEREF(__pyx_t_5);
         __pyx_t_4 = 0;
         __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_v_addn);
         __pyx_v_addn = __pyx_t_5;
         __pyx_t_5 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1073
+        /* "cvcf.pyx":1073
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  *                     ref = addn + ref             # <<<<<<<<<<<<<<
@@ -21817,7 +21558,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_v_ref = __pyx_t_5;
         __pyx_t_5 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1074
+        /* "cvcf.pyx":1074
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]             # <<<<<<<<<<<<<<
@@ -21826,21 +21567,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
         __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-        if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-          __pyx_t_6 = 0; __pyx_t_10 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_10);
-        } else {
-          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(__pyx_v_alt == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
+        __pyx_t_6 = 0; __pyx_t_10 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_10);
         for (;;) {
           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break;
-          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++;
+          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
           __Pyx_DECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_2;
-          __pyx_t_2 = 0;
-          __pyx_t_2 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_v_allele = __pyx_t_1;
+          __pyx_t_1 = 0;
+          __pyx_t_1 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_1);
+          if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         }
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_INCREF(((PyObject *)__pyx_t_5));
@@ -21848,7 +21588,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_v_alt = __pyx_t_5;
         __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1075
+        /* "cvcf.pyx":1075
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]
  *                     pos -= 1             # <<<<<<<<<<<<<<
@@ -21869,18 +21609,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   }
   /*else*/ {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1078
+    /* "cvcf.pyx":1078
  *         else:
  *             # format v4.0 -- just check for nucleotides
  *             for allele in alt:             # <<<<<<<<<<<<<<
  *                 if not alleleRegEx.match(allele):
  *                     self.error(str(record),self.V40_BAD_ALLELE,allele)
  */
-    if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-      __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-    } else {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_v_alt == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
+    __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
     for (;;) {
       if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
       __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++;
@@ -21888,7 +21627,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __pyx_v_allele = __pyx_t_10;
       __pyx_t_10 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1079
+      /* "cvcf.pyx":1079
  *             # format v4.0 -- just check for nucleotides
  *             for allele in alt:
  *                 if not alleleRegEx.match(allele):             # <<<<<<<<<<<<<<
@@ -21897,24 +21636,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
       __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__match); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_INCREF(__pyx_v_allele);
       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_allele);
       __Pyx_GIVEREF(__pyx_v_allele);
-      __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_16 = (!__pyx_t_17);
       if (__pyx_t_16) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1080
+        /* "cvcf.pyx":1080
  *             for allele in alt:
  *                 if not alleleRegEx.match(allele):
  *                     self.error(str(record),self.V40_BAD_ALLELE,allele)             # <<<<<<<<<<<<<<
@@ -21924,30 +21663,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
-        __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_13);
-        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_13));
+        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1);
+        __Pyx_GIVEREF(__pyx_t_1);
         PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10);
         __Pyx_GIVEREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_v_allele);
         PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_allele);
         __Pyx_GIVEREF(__pyx_v_allele);
-        __pyx_t_2 = 0;
+        __pyx_t_1 = 0;
         __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         goto __pyx_L50;
       }
@@ -21957,18 +21696,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   }
   __pyx_L20:;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1084
+  /* "cvcf.pyx":1084
  * 
  *         # check for leading nucleotide in indel calls
  *         for allele in alt:             # <<<<<<<<<<<<<<
  *             if len(allele) != len(ref):
  *                 if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE)
  */
-  if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-    __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-  } else {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__pyx_v_alt == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
   }
+  __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
   for (;;) {
     if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
     __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++;
@@ -21976,7 +21714,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_v_allele = __pyx_t_10;
     __pyx_t_10 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1085
+    /* "cvcf.pyx":1085
  *         # check for leading nucleotide in indel calls
  *         for allele in alt:
  *             if len(allele) != len(ref):             # <<<<<<<<<<<<<<
@@ -21988,7 +21726,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_t_16 = (__pyx_t_12 != __pyx_t_8);
     if (__pyx_t_16) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1086
+      /* "cvcf.pyx":1086
  *         for allele in alt:
  *             if len(allele) != len(ref):
  *                 if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE)             # <<<<<<<<<<<<<<
@@ -22001,33 +21739,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_13);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_13));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
-        __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
         __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_13);
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
         __Pyx_GIVEREF(__pyx_t_4);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_13);
+        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13);
         __Pyx_GIVEREF(__pyx_t_13);
         __pyx_t_4 = 0;
         __pyx_t_13 = 0;
-        __pyx_t_13 = PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_13);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
         goto __pyx_L54;
       }
       __pyx_L54:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1087
+      /* "cvcf.pyx":1087
  *             if len(allele) != len(ref):
  *                 if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE)
  *                 if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():             # <<<<<<<<<<<<<<
@@ -22036,41 +21774,41 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
       __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_13);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-      __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_13);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_RichCompare(__pyx_t_13, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_RichCompare(__pyx_t_13, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_16) {
         __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_13 = PyNumber_Add(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_13 = PyNumber_Add(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_13);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-        __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_13);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_t_17 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_13, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
         __pyx_t_3 = __pyx_t_17;
@@ -22079,7 +21817,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       }
       if (__pyx_t_3) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1088
+        /* "cvcf.pyx":1088
  *                 if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE)
  *                 if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
  *                     self.error(str(record),self.MISSING_INDEL_ALLELE_REF_BASE)             # <<<<<<<<<<<<<<
@@ -22088,29 +21826,29 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
         __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_13);
-        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_record);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_record);
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
-        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_67); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_113); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
         PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
         __Pyx_GIVEREF(__pyx_t_10);
-        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+        __Pyx_GIVEREF(__pyx_t_1);
         __pyx_t_10 = 0;
-        __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_13, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = 0;
+        __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L55;
       }
       __pyx_L55:;
@@ -22120,7 +21858,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   }
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1091
+  /* "cvcf.pyx":1091
  * 
  *         # trim trailing bases in alleles
  *         for i in range(1,min(len(ref),min(map(len,alt)))):             # <<<<<<<<<<<<<<
@@ -22128,70 +21866,70 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                 break
  */
   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(__pyx_builtin_len);
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_builtin_len);
   __Pyx_GIVEREF(__pyx_builtin_len);
   __Pyx_INCREF(((PyObject *)__pyx_v_alt));
   PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_alt));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_alt));
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_map, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
   __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_min, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
   __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_13 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
   if (__pyx_t_3) {
-    __Pyx_INCREF(__pyx_t_2);
-    __pyx_t_5 = __pyx_t_2;
+    __Pyx_INCREF(__pyx_t_1);
+    __pyx_t_5 = __pyx_t_1;
   } else {
     __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_13);
     __pyx_t_5 = __pyx_t_13;
     __pyx_t_13 = 0;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_INCREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
-    __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2);
+    __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1);
   } else {
-    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
   }
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   for (;;) {
-    if (likely(PyList_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
-    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
+    if (likely(PyList_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
     } else {
-      __pyx_t_5 = PyIter_Next(__pyx_t_2);
+      __pyx_t_5 = PyIter_Next(__pyx_t_1);
       if (!__pyx_t_5) {
         if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
@@ -22202,38 +21940,47 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_v_i = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1092
+    /* "cvcf.pyx":1092
  *         # trim trailing bases in alleles
  *         for i in range(1,min(len(ref),min(map(len,alt)))):
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():             # <<<<<<<<<<<<<<
  *                 break
  *             ref, alt = ref[:-1], [allele[:-1] for allele in alt]
  */
-    __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
+    { /* enter inner scope */
+      PyObject *__pyx_8genexpr1__pyx_v_allele;
+      __pyx_8genexpr1__pyx_v_allele = Py_None; __Pyx_INCREF(Py_None);
+      __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+      if (unlikely(__pyx_v_alt == Py_None)) {
+        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} 
+      }
       __pyx_t_8 = 0; __pyx_t_13 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_13);
-    } else {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    for (;;) {
-      if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_13)) break;
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
+      for (;;) {
+        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_13)) break;
+        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
+        __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele);
+        __pyx_8genexpr1__pyx_v_allele = __pyx_t_4;
+        __pyx_t_4 = 0;
+        __pyx_t_4 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_allele, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
+        __Pyx_GOTREF(__pyx_t_4);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+        __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
+        __Pyx_GOTREF(__pyx_t_4);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        if (unlikely(PySet_Add(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
+        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      }
+      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
       __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele);
-      __pyx_8genexpr1__pyx_v_allele = __pyx_t_4;
-      __pyx_t_4 = 0;
-      __pyx_t_4 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_allele, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_10 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      if (unlikely(PySet_Add(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    }
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+      goto __pyx_L64_exit_scope;
+      __pyx_L61_error:;
+      __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele);
+      goto __pyx_L1_error;
+      __pyx_L64_exit_scope:;
+    } /* exit inner scope */
     __pyx_t_8 = PySet_Size(((PyObject *)__pyx_t_5)); 
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __pyx_t_3 = (__pyx_t_8 > 1);
@@ -22269,7 +22016,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     }
     if (__pyx_t_17) {
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1093
+      /* "cvcf.pyx":1093
  *         for i in range(1,min(len(ref),min(map(len,alt)))):
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
  *                 break             # <<<<<<<<<<<<<<
@@ -22281,29 +22028,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     }
     __pyx_L58:;
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1094
+    /* "cvcf.pyx":1094
  *             if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
  *                 break
  *             ref, alt = ref[:-1], [allele[:-1] for allele in alt]             # <<<<<<<<<<<<<<
  * 
  *         # left-align alleles, if a reference is available
  */
-    __pyx_t_13 = PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_13);
     __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-      __pyx_t_8 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-    } else {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_v_alt == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
+    __pyx_t_8 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
     for (;;) {
       if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
       __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++;
       __Pyx_DECREF(__pyx_v_allele);
       __pyx_v_allele = __pyx_t_10;
       __pyx_t_10 = 0;
-      __pyx_t_10 = PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
       if (unlikely(PyList_Append(__pyx_t_4, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -22316,35 +22062,35 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
     __pyx_v_ref = __pyx_t_13;
     __pyx_t_13 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_v_alt));
-    __pyx_v_alt = ((PyObject *)__pyx_t_5);
+    __pyx_v_alt = ((PyObject*)__pyx_t_5);
     __pyx_t_5 = 0;
   }
   __pyx_L57_break:;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1097
+  /* "cvcf.pyx":1097
  * 
  *         # left-align alleles, if a reference is available
  *         if self._leftalign and self._reference:             # <<<<<<<<<<<<<<
  *             while left < pos:
  *                 movable = True
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_17) {
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_16 = __pyx_t_3;
   } else {
     __pyx_t_16 = __pyx_t_17;
   }
   if (__pyx_t_16) {
 
-    /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1098
+    /* "cvcf.pyx":1098
  *         # left-align alleles, if a reference is available
  *         if self._leftalign and self._reference:
  *             while left < pos:             # <<<<<<<<<<<<<<
@@ -22352,13 +22098,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                 for allele in alt:
  */
     while (1) {
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (!__pyx_t_16) break;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1099
+      /* "cvcf.pyx":1099
  *         if self._leftalign and self._reference:
  *             while left < pos:
  *                 movable = True             # <<<<<<<<<<<<<<
@@ -22367,26 +22113,25 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
       __pyx_v_movable = 1;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1100
+      /* "cvcf.pyx":1100
  *             while left < pos:
  *                 movable = True
  *                 for allele in alt:             # <<<<<<<<<<<<<<
  *                     if len(allele) > len(ref):
  *                         longest, shortest = allele, ref
  */
-      if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-        __pyx_t_6 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_2);
-      } else {
-        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__pyx_v_alt == Py_None)) {
+        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
+      __pyx_t_6 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_1);
       for (;;) {
-        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
+        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
+        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
         __Pyx_DECREF(__pyx_v_allele);
         __pyx_v_allele = __pyx_t_5;
         __pyx_t_5 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1101
+        /* "cvcf.pyx":1101
  *                 movable = True
  *                 for allele in alt:
  *                     if len(allele) > len(ref):             # <<<<<<<<<<<<<<
@@ -22398,7 +22143,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_16 = (__pyx_t_8 > __pyx_t_12);
         if (__pyx_t_16) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1102
+          /* "cvcf.pyx":1102
  *                 for allele in alt:
  *                     if len(allele) > len(ref):
  *                         longest, shortest = allele, ref             # <<<<<<<<<<<<<<
@@ -22415,11 +22160,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           __Pyx_DECREF(__pyx_v_shortest);
           __pyx_v_shortest = __pyx_t_13;
           __pyx_t_13 = 0;
-          goto __pyx_L68;
+          goto __pyx_L72;
         }
         /*else*/ {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1104
+          /* "cvcf.pyx":1104
  *                         longest, shortest = allele, ref
  *                     else:
  *                         longest, shortest = ref, allele             # <<<<<<<<<<<<<<
@@ -22437,9 +22182,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           __pyx_v_shortest = __pyx_t_5;
           __pyx_t_5 = 0;
         }
-        __pyx_L68:;
+        __pyx_L72:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1105
+        /* "cvcf.pyx":1105
  *                     else:
  *                         longest, shortest = ref, allele
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():             # <<<<<<<<<<<<<<
@@ -22451,7 +22196,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_16 = (__pyx_t_12 == __pyx_t_8);
         if (!__pyx_t_16) {
           __pyx_t_8 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_5 = PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_5);
           __pyx_t_13 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__upper); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_13);
@@ -22476,7 +22221,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         }
         if (__pyx_t_3) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1106
+          /* "cvcf.pyx":1106
  *                         longest, shortest = ref, allele
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False             # <<<<<<<<<<<<<<
@@ -22484,11 +22229,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                         movable = False
  */
           __pyx_v_movable = 0;
-          goto __pyx_L69;
+          goto __pyx_L73;
         }
-        __pyx_L69:;
+        __pyx_L73:;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1107
+        /* "cvcf.pyx":1107
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():             # <<<<<<<<<<<<<<
@@ -22521,7 +22266,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         if (__pyx_t_3) {
 
-          /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1108
+          /* "cvcf.pyx":1108
  *                         movable = False
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  *                         movable = False             # <<<<<<<<<<<<<<
@@ -22529,13 +22274,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  *                     break
  */
           __pyx_v_movable = 0;
-          goto __pyx_L70;
+          goto __pyx_L74;
         }
-        __pyx_L70:;
+        __pyx_L74:;
       }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1109
+      /* "cvcf.pyx":1109
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  *                         movable = False
  *                 if not movable:             # <<<<<<<<<<<<<<
@@ -22545,76 +22290,74 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       __pyx_t_3 = (!__pyx_v_movable);
       if (__pyx_t_3) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1110
+        /* "cvcf.pyx":1110
  *                         movable = False
  *                 if not movable:
  *                     break             # <<<<<<<<<<<<<<
  *                 ref = ref[:-1]
  *                 alt = [allele[:-1] for allele in alt]
  */
-        goto __pyx_L65_break;
-        goto __pyx_L71;
+        goto __pyx_L69_break;
+        goto __pyx_L75;
       }
-      __pyx_L71:;
+      __pyx_L75:;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1111
+      /* "cvcf.pyx":1111
  *                 if not movable:
  *                     break
  *                 ref = ref[:-1]             # <<<<<<<<<<<<<<
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  */
-      __pyx_t_2 = PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_ref = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1112
+      /* "cvcf.pyx":1112
  *                     break
  *                 ref = ref[:-1]
  *                 alt = [allele[:-1] for allele in alt]             # <<<<<<<<<<<<<<
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  *                     ref = faref_leftflank[pos-left-1] + ref
  */
-      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-        __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-      } else {
-        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      if (unlikely(__pyx_v_alt == Py_None)) {
+        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
+      __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
       for (;;) {
         if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
         __Pyx_DECREF(__pyx_v_allele);
         __pyx_v_allele = __pyx_t_4;
         __pyx_t_4 = 0;
-        __pyx_t_4 = PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       }
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_INCREF(((PyObject *)__pyx_t_2));
+      __Pyx_INCREF(((PyObject *)__pyx_t_1));
       __Pyx_DECREF(((PyObject *)__pyx_v_alt));
-      __pyx_v_alt = __pyx_t_2;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_v_alt = __pyx_t_1;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-      /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1113
+      /* "cvcf.pyx":1113
  *                 ref = ref[:-1]
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:             # <<<<<<<<<<<<<<
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
  */
-      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-        __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-      } else {
-        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      if (unlikely(__pyx_v_alt == Py_None)) {
+        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
       }
+      __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
       for (;;) {
         if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
@@ -22624,22 +22367,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
         __pyx_t_12 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       }
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+      __Pyx_INCREF(((PyObject *)__pyx_t_1));
+      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_INCREF(((PyObject *)__pyx_t_2));
-      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_min, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (!__pyx_t_3) {
@@ -22651,7 +22394,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
       }
       if (__pyx_t_17) {
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1114
+        /* "cvcf.pyx":1114
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  *                     ref = faref_leftflank[pos-left-1] + ref             # <<<<<<<<<<<<<<
@@ -22660,33 +22403,32 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
  */
         __pyx_t_5 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_2); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_v_ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_ref = __pyx_t_1;
+        __pyx_t_1 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1115
+        /* "cvcf.pyx":1115
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]             # <<<<<<<<<<<<<<
  *                     pos -= 1
  * 
  */
-        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-        if (likely(((PyObject *)__pyx_v_alt) != Py_None)) {
-          __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
-        } else {
-          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+        if (unlikely(__pyx_v_alt == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
         }
+        __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5);
         for (;;) {
           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
           __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
@@ -22704,35 +22446,35 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
           __pyx_t_13 = PyNumber_Add(__pyx_t_4, __pyx_v_allele); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_13);
           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-          if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_13))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_13))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
         }
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_2));
+        __Pyx_INCREF(((PyObject *)__pyx_t_1));
         __Pyx_DECREF(((PyObject *)__pyx_v_alt));
-        __pyx_v_alt = __pyx_t_2;
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_v_alt = __pyx_t_1;
+        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-        /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1116
+        /* "cvcf.pyx":1116
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
  *                     pos -= 1             # <<<<<<<<<<<<<<
  * 
  * __all__ = [
  */
-        __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_v_pos);
-        __pyx_v_pos = __pyx_t_2;
-        __pyx_t_2 = 0;
-        goto __pyx_L74;
+        __pyx_v_pos = __pyx_t_1;
+        __pyx_t_1 = 0;
+        goto __pyx_L78;
       }
-      __pyx_L74:;
+      __pyx_L78:;
     }
-    __pyx_L65_break:;
-    goto __pyx_L63;
+    __pyx_L69_break:;
+    goto __pyx_L67;
   }
-  __pyx_L63:;
+  __pyx_L67:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -22771,7 +22513,6 @@ static PyObject *__pyx_pf_4cvcf_3VCF_validate(PyObject *__pyx_self, PyObject *__
   __Pyx_DECREF(__pyx_v_allele);
   __Pyx_DECREF(__pyx_v_longest);
   __Pyx_DECREF(__pyx_v_shortest);
-  __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -22785,7 +22526,7 @@ static PyObject *__pyx_tp_new_4cvcf_VCFRecord(PyTypeObject *t, PyObject *a, PyOb
   p = ((struct __pyx_obj_4cvcf_VCFRecord *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_4cvcf_VCFRecord;
   p->vcf = Py_None; Py_INCREF(Py_None);
-  if (__pyx_pf_4cvcf_9VCFRecord___cinit__(o, a, k) < 0) {
+  if (__pyx_pf_4cvcf_9VCFRecord_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -22945,7 +22686,7 @@ static PyNumberMethods __pyx_tp_as_number_VCFRecord = {
 };
 
 static PySequenceMethods __pyx_tp_as_sequence_VCFRecord = {
-  __pyx_pf_4cvcf_9VCFRecord___len__, /*sq_length*/
+  __pyx_pf_4cvcf_9VCFRecord_2__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
   __pyx_sq_item_4cvcf_VCFRecord, /*sq_item*/
@@ -22958,8 +22699,8 @@ static PySequenceMethods __pyx_tp_as_sequence_VCFRecord = {
 };
 
 static PyMappingMethods __pyx_tp_as_mapping_VCFRecord = {
-  __pyx_pf_4cvcf_9VCFRecord___len__, /*mp_length*/
-  __pyx_pf_4cvcf_9VCFRecord___getitem__, /*mp_subscript*/
+  __pyx_pf_4cvcf_9VCFRecord_2__len__, /*mp_length*/
+  __pyx_pf_4cvcf_9VCFRecord_3__getitem__, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
@@ -22984,7 +22725,7 @@ static PyBufferProcs __pyx_tp_as_buffer_VCFRecord = {
   #endif
 };
 
-PyTypeObject __pyx_type_4cvcf_VCFRecord = {
+static PyTypeObject __pyx_type_4cvcf_VCFRecord = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("cvcf.VCFRecord"), /*tp_name*/
   sizeof(struct __pyx_obj_4cvcf_VCFRecord), /*tp_basicsize*/
@@ -23008,7 +22749,7 @@ PyTypeObject __pyx_type_4cvcf_VCFRecord = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_VCFRecord, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("vcf record.\n\n    initialized from data and vcf meta \n    "), /*tp_doc*/
   __pyx_tp_traverse_4cvcf_VCFRecord, /*tp_traverse*/
   __pyx_tp_clear_4cvcf_VCFRecord, /*tp_clear*/
@@ -23181,7 +22922,7 @@ static PyBufferProcs __pyx_tp_as_buffer_asVCFRecord = {
   #endif
 };
 
-PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
+static PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("cvcf.asVCFRecord"), /*tp_name*/
   sizeof(struct __pyx_obj_4cvcf_asVCFRecord), /*tp_basicsize*/
@@ -23200,12 +22941,12 @@ PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
   &__pyx_tp_as_sequence_asVCFRecord, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_asVCFRecord, /*tp_as_mapping*/
   0, /*tp_hash*/
-  __pyx_pf_4cvcf_11asVCFRecord___call__, /*tp_call*/
+  __pyx_pf_4cvcf_11asVCFRecord_1__call__, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_asVCFRecord, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("converts a :term:`tabix row` into a VCF record."), /*tp_doc*/
   __pyx_tp_traverse_4cvcf_asVCFRecord, /*tp_traverse*/
   __pyx_tp_clear_4cvcf_asVCFRecord, /*tp_clear*/
@@ -23238,8 +22979,6 @@ PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
 };
 
 static PyMethodDef __pyx_methods[] = {
-  {__Pyx_NAMESTR("get_sequence"), (PyCFunction)__pyx_pf_4cvcf_get_sequence, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("parse_regions"), (PyCFunction)__pyx_pf_4cvcf_parse_regions, METH_O, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
@@ -23259,124 +22998,107 @@ static struct PyModuleDef __pyx_moduledef = {
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
-  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
-  {&__pyx_kp_s_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 0, 1, 0},
-  {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0},
+  {&__pyx_n_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 1},
   {&__pyx_kp_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 0},
   {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0},
-  {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0},
-  {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0},
-  {&__pyx_kp_s_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 0, 1, 0},
-  {&__pyx_kp_u_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 1, 0, 0},
-  {&__pyx_kp_u_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 1, 0, 0},
-  {&__pyx_kp_u_109, __pyx_k_109, sizeof(__pyx_k_109), 0, 1, 0, 0},
-  {&__pyx_n_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 1},
-  {&__pyx_kp_u_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 1, 0, 0},
-  {&__pyx_kp_u_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 1, 0, 0},
-  {&__pyx_kp_u_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 1, 0, 0},
-  {&__pyx_kp_u_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 1, 0, 0},
-  {&__pyx_kp_u_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 1, 0, 0},
-  {&__pyx_kp_u_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 1, 0, 0},
-  {&__pyx_kp_u_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 1, 0, 0},
-  {&__pyx_kp_u_117, __pyx_k_117, sizeof(__pyx_k_117), 0, 1, 0, 0},
-  {&__pyx_kp_u_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 1, 0, 0},
-  {&__pyx_kp_u_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 1, 0, 0},
-  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
-  {&__pyx_kp_u_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 1, 0, 0},
-  {&__pyx_kp_u_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 1, 0, 0},
-  {&__pyx_kp_u_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 1, 0, 0},
-  {&__pyx_kp_u_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 1, 0, 0},
-  {&__pyx_kp_u_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 1, 0, 0},
+  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
+  {&__pyx_n_s_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 0, 1, 1},
+  {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0},
+  {&__pyx_n_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 1},
+  {&__pyx_kp_s_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 0, 1, 0},
+  {&__pyx_n_s_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 0, 1, 1},
+  {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0},
+  {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0},
+  {&__pyx_kp_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 0},
+  {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0},
+  {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0},
+  {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0},
+  {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0},
+  {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0},
+  {&__pyx_kp_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0},
+  {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0},
+  {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0},
+  {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0},
+  {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0},
+  {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0},
   {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
-  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
-  {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1},
-  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
+  {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0},
+  {&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0},
+  {&__pyx_kp_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 0},
+  {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0},
+  {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0},
+  {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0},
+  {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0},
+  {&__pyx_kp_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 0},
+  {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
+  {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0},
+  {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0},
+  {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0},
+  {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0},
+  {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0},
+  {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
+  {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0},
+  {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
+  {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0},
+  {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0},
+  {&__pyx_kp_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 0},
+  {&__pyx_kp_s_160, __pyx_k_160, sizeof(__pyx_k_160), 0, 0, 1, 0},
+  {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0},
+  {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0},
+  {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1},
   {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
   {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
   {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1},
-  {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1},
-  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
-  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
-  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
+  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
   {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
-  {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1},
   {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
-  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
-  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
-  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
+  {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1},
   {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
-  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
-  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
   {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
-  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
-  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
-  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
+  {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1},
+  {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1},
   {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
   {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
   {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
   {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
   {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
-  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
-  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
-  {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
-  {&__pyx_n_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 1},
-  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
-  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
-  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
-  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
-  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
   {&__pyx_n_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 1},
-  {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
-  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
-  {&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1},
+  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
   {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
   {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
-  {&__pyx_n_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 1},
-  {&__pyx_n_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 1},
-  {&__pyx_kp_b_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0, 0},
+  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
+  {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
   {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
-  {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
-  {&__pyx_n_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 1},
+  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
+  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
   {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
-  {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
-  {&__pyx_n_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 1},
   {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
-  {&__pyx_n_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 1},
-  {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
-  {&__pyx_n_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 1},
-  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
+  {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0},
   {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0},
   {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
   {&__pyx_kp_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 0},
   {&__pyx_kp_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 0},
-  {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
-  {&__pyx_kp_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 0},
   {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0},
   {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0},
   {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
-  {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0},
+  {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1},
   {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
   {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0},
   {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
   {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
-  {&__pyx_kp_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 0},
-  {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
   {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0},
-  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
-  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
+  {&__pyx_n_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 1},
   {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0},
   {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0},
-  {&__pyx_n_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 1},
-  {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0},
+  {&__pyx_kp_b_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 0, 0},
+  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
+  {&__pyx_n_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 1},
   {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0},
   {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0},
-  {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0},
-  {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0},
-  {&__pyx_kp_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 0},
-  {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0},
-  {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0},
-  {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0},
-  {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0},
+  {&__pyx_n_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 1},
+  {&__pyx_n_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 1},
+  {&__pyx_n_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 1},
+  {&__pyx_kp_b__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 0, 0},
   {&__pyx_kp_s__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 1, 0},
   {&__pyx_n_s__ACGTN, __pyx_k__ACGTN, sizeof(__pyx_k__ACGTN), 0, 0, 1, 1},
   {&__pyx_n_s__ALT, __pyx_k__ALT, sizeof(__pyx_k__ALT), 0, 0, 1, 1},
@@ -23418,6 +23140,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__NT_UNKNOWN, __pyx_k__NT_UNKNOWN, sizeof(__pyx_k__NT_UNKNOWN), 0, 0, 1, 1},
   {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
   {&__pyx_n_s__Number, __pyx_k__Number, sizeof(__pyx_k__Number), 0, 0, 1, 1},
+  {&__pyx_n_b__PASS, __pyx_k__PASS, sizeof(__pyx_k__PASS), 0, 0, 0, 1},
   {&__pyx_n_s__PASS, __pyx_k__PASS, sizeof(__pyx_k__PASS), 0, 0, 1, 1},
   {&__pyx_n_s__POS, __pyx_k__POS, sizeof(__pyx_k__POS), 0, 0, 1, 1},
   {&__pyx_n_s__POS_NOT_NUMERICAL, __pyx_k__POS_NOT_NUMERICAL, sizeof(__pyx_k__POS_NOT_NUMERICAL), 0, 0, 1, 1},
@@ -23470,6 +23193,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__alt, __pyx_k__alt, sizeof(__pyx_k__alt), 0, 0, 1, 1},
   {&__pyx_n_s__alt1, __pyx_k__alt1, sizeof(__pyx_k__alt1), 0, 0, 1, 1},
   {&__pyx_n_s__alt2, __pyx_k__alt2, sizeof(__pyx_k__alt2), 0, 0, 1, 1},
+  {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
   {&__pyx_n_s__bisect, __pyx_k__bisect, sizeof(__pyx_k__bisect), 0, 0, 1, 1},
   {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
   {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1},
@@ -23481,6 +23205,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__convertGT, __pyx_k__convertGT, sizeof(__pyx_k__convertGT), 0, 0, 1, 1},
   {&__pyx_n_s__convertGTback, __pyx_k__convertGTback, sizeof(__pyx_k__convertGTback), 0, 0, 1, 1},
   {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
+  {&__pyx_n_s__cvcf, __pyx_k__cvcf, sizeof(__pyx_k__cvcf), 0, 0, 1, 1},
   {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
   {&__pyx_n_s__datagenerator, __pyx_k__datagenerator, sizeof(__pyx_k__datagenerator), 0, 0, 1, 1},
   {&__pyx_n_s__deepcopy, __pyx_k__deepcopy, sizeof(__pyx_k__deepcopy), 0, 0, 1, 1},
@@ -23547,6 +23272,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__parse_formatdata, __pyx_k__parse_formatdata, sizeof(__pyx_k__parse_formatdata), 0, 0, 1, 1},
   {&__pyx_n_s__parse_header, __pyx_k__parse_header, sizeof(__pyx_k__parse_header), 0, 0, 1, 1},
   {&__pyx_n_s__parse_heading, __pyx_k__parse_heading, sizeof(__pyx_k__parse_heading), 0, 0, 1, 1},
+  {&__pyx_n_s__parse_regions, __pyx_k__parse_regions, sizeof(__pyx_k__parse_regions), 0, 0, 1, 1},
   {&__pyx_n_s__parser, __pyx_k__parser, sizeof(__pyx_k__parser), 0, 0, 1, 1},
   {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
   {&__pyx_n_s__pos1, __pyx_k__pos1, sizeof(__pyx_k__pos1), 0, 0, 1, 1},
@@ -23615,202 +23341,945 @@ static int __Pyx_InitCachedBuiltins(void) {
   return -1;
 }
 
-static int __Pyx_InitGlobals(void) {
-  #if PY_VERSION_HEX < 0x02040000
-  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #endif
-  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_21 = PyInt_FromLong(21); if (unlikely(!__pyx_int_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_22 = PyInt_FromLong(22); if (unlikely(!__pyx_int_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_23 = PyInt_FromLong(23); if (unlikely(!__pyx_int_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_25 = PyInt_FromLong(25); if (unlikely(!__pyx_int_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_26 = PyInt_FromLong(26); if (unlikely(!__pyx_int_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_27 = PyInt_FromLong(27); if (unlikely(!__pyx_int_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_28 = PyInt_FromLong(28); if (unlikely(!__pyx_int_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_29 = PyInt_FromLong(29); if (unlikely(!__pyx_int_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_30 = PyInt_FromLong(30); if (unlikely(!__pyx_int_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_33 = PyInt_FromLong(33); if (unlikely(!__pyx_int_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  __pyx_int_3000000000 = PyInt_FromString((char *)"3000000000", 0, 0); if (unlikely(!__pyx_int_3000000000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
+static int __Pyx_InitCachedConstants(void) {
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
 
-#if PY_MAJOR_VERSION < 3
-PyMODINIT_FUNC initcvcf(void); /*proto*/
-PyMODINIT_FUNC initcvcf(void)
-#else
-PyMODINIT_FUNC PyInit_cvcf(void); /*proto*/
-PyMODINIT_FUNC PyInit_cvcf(void)
-#endif
-{
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  #if CYTHON_REFNANNY
-  void* __pyx_refnanny = NULL;
-  __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");
-  }
-  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_cvcf(void)", __LINE__, __FILE__);
-  #endif
-  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #ifdef __pyx_binding_PyCFunctionType_USED
-  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #endif
-  /*--- Library function declarations ---*/
-  /*--- Threads initialization code ---*/
-  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
-  #ifdef WITH_THREAD /* Python build with threading support? */
-  PyEval_InitThreads();
-  #endif
-  #endif
-  /*--- Module creation code ---*/
-  #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
-  #else
-  __pyx_m = PyModule_Create(&__pyx_moduledef);
-  #endif
-  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  #if PY_MAJOR_VERSION < 3
-  Py_INCREF(__pyx_m);
-  #endif
-  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
-  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  /*--- Initialize various global constants etc. ---*/
-  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_module_is_main_cvcf) {
-    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
-  }
-  /*--- Builtin init code ---*/
-  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  /*--- Global init code ---*/
-  /*--- Function export code ---*/
-  /*--- Type init code ---*/
-  __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict, &__pyx_vtabptr_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_vtabptr_4cvcf_VCFRecord = &__pyx_vtable_4cvcf_VCFRecord;
-  __pyx_vtable_4cvcf_VCFRecord.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy;
-  #if PY_MAJOR_VERSION >= 3
-  __pyx_vtable_4cvcf_VCFRecord.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_4cvcf_9VCFRecord_update;
-  #else
-  *(void(**)(void))&__pyx_vtable_4cvcf_VCFRecord.__pyx_base.update = (void(*)(void))__pyx_f_4cvcf_9VCFRecord_update;
-  #endif
-  __pyx_type_4cvcf_VCFRecord.tp_base = __pyx_ptype_10TabProxies_TupleProxy;
-  if (PyType_Ready(&__pyx_type_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_4cvcf_VCFRecord.tp_dict, __pyx_vtabptr_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "VCFRecord", (PyObject *)&__pyx_type_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_4cvcf_VCFRecord = &__pyx_type_4cvcf_VCFRecord;
-  __pyx_ptype_6ctabix_Parser = __Pyx_ImportType("ctabix", "Parser", sizeof(struct __pyx_obj_6ctabix_Parser), 1); if (unlikely(!__pyx_ptype_6ctabix_Parser)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_type_4cvcf_asVCFRecord.tp_base = __pyx_ptype_6ctabix_Parser;
-  if (PyType_Ready(&__pyx_type_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "asVCFRecord", (PyObject *)&__pyx_type_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_4cvcf_asVCFRecord = &__pyx_type_4cvcf_asVCFRecord;
-  /*--- Type import code ---*/
-  __pyx_ptype_6ctabix_Tabixfile = __Pyx_ImportType("ctabix", "Tabixfile", sizeof(struct __pyx_obj_6ctabix_Tabixfile), 1); if (unlikely(!__pyx_ptype_6ctabix_Tabixfile)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict, &__pyx_vtabptr_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict, &__pyx_vtabptr_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict, &__pyx_vtabptr_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict, &__pyx_vtabptr_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  /*--- Function import code ---*/
-  /*--- Execution code ---*/
+  /* "cvcf.pyx":70
+ * def parse_regions( string ):
+ *     result = []
+ *     for r in string.split(','):             # <<<<<<<<<<<<<<
+ *         elts = r.split(':')
+ *         chrom, start, end = elts[0], 0, 3000000000
+ */
+  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":46
- * #
- * 
- * from collections import namedtuple, defaultdict             # <<<<<<<<<<<<<<
- * from operator import itemgetter
- * import sys, re, copy, bisect
+  /* "cvcf.pyx":71
+ *     result = []
+ *     for r in string.split(','):
+ *         elts = r.split(':')             # <<<<<<<<<<<<<<
+ *         chrom, start, end = elts[0], 0, 3000000000
+ *         if len(elts)==1: pass
  */
-  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__namedtuple));
-  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__namedtuple));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__namedtuple));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__defaultdict));
-  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__defaultdict));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__defaultdict));
-  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__defaultdict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":47
- * 
- * from collections import namedtuple, defaultdict
- * from operator import itemgetter             # <<<<<<<<<<<<<<
- * import sys, re, copy, bisect
+  /* "cvcf.pyx":76
+ *         elif len(elts)==2:
+ *             if len(elts[1])>0:
+ *                 ielts = elts[1].split('-')             # <<<<<<<<<<<<<<
+ *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
+ *                 try:    start, end = int(ielts[0])-1, int(ielts[1])
+ */
+  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
+
+  /* "cvcf.pyx":152
+ *             alt = self.fields[4]
+ *             if alt == ".": alt = []
+ *             else: alt = alt.upper().split(',')             # <<<<<<<<<<<<<<
+ *             return alt
  * 
  */
-  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__itemgetter));
-  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__itemgetter));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__itemgetter));
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__itemgetter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itemgetter, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":48
- * from collections import namedtuple, defaultdict
- * from operator import itemgetter
- * import sys, re, copy, bisect             # <<<<<<<<<<<<<<
+  /* "cvcf.pyx":168
+ *             # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
+ *             if f == b"." or f == b"PASS" or f == b"0": return []
+ *             else: return f.split(';')             # <<<<<<<<<<<<<<
  * 
- * cimport ctabix
+ *     property info:
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+
+  /* "cvcf.pyx":176
+ *             info = {}
+ *             if col != b".":
+ *                 for blurp in col.split(';'):             # <<<<<<<<<<<<<<
+ *                     elts = blurp.split('=')
+ *                     if len(elts) == 1: v = None
+ */
+  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+
+  /* "cvcf.pyx":177
+ *             if col != b".":
+ *                 for blurp in col.split(';'):
+ *                     elts = blurp.split('=')             # <<<<<<<<<<<<<<
+ *                     if len(elts) == 1: v = None
+ *                     elif len(elts) == 2: v = elts[1]
+ */
+  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
+
+  /* "cvcf.pyx":186
+ *     property format:
+ *          def __get__(self):
+ *              return self.fields[8].split(':')             # <<<<<<<<<<<<<<
+ * 
+ *     property samples:
+ */
+  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
+
+  /* "cvcf.pyx":195
+ * 
+ *         # parse sample columns
+ *         values = self.fields[self.vcf._sample2column[key]].split(':')             # <<<<<<<<<<<<<<
+ *         alt = self.alt
+ *         format = self.format
+ */
+  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+
+  /* "cvcf.pyx":308
+ *     def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):
+ *         # make error identifiers accessible by name
+ *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id             # <<<<<<<<<<<<<<
+ *         if _copy != None:
+ *             self._leftalign = _copy._leftalign
+ */
+  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
+
+  /* "cvcf.pyx":329
+ *     def error(self,line,error,opt=None):
+ *         if error in self._ignored_errors: return
+ *         errorlabel, errorstring = self._errors[error].split(':')             # <<<<<<<<<<<<<<
+ *         if opt: errorstring = errorstring % opt
+ *         errwarn = ["Error","Warning"][error in self._warn_errors]
+ */
+  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+
+  /* "cvcf.pyx":338
+ *     def parse_format(self,line,format,filter=False):
+ *         if self._version == 40:
+ *             if not format.startswith('<'):             # <<<<<<<<<<<<<<
+ *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
+ *                 format = "<"+format
+ */
+  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
+  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
+
+  /* "cvcf.pyx":341
+ *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
+ *                 format = "<"+format
+ *             if not format.endswith('>'):             # <<<<<<<<<<<<<<
+ *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
+ *                 format += ">"
+ */
+  __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
+
+  /* "cvcf.pyx":348
+ *         idx = 0
+ *         while len(format.strip())>0:
+ *             elts = format.strip().split(',')             # <<<<<<<<<<<<<<
+ *             first, rest = elts[0], ','.join(elts[1:])
+ *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):
+ */
+  __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+
+  /* "cvcf.pyx":350
+ *             elts = format.strip().split(',')
+ *             first, rest = elts[0], ','.join(elts[1:])
+ *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):             # <<<<<<<<<<<<<<
+ *                 if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
+ *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
+ */
+  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
+  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
+  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
+
+  /* "cvcf.pyx":354
+ *                 if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
+ *                 first = ["ID=","Number=","Type=","Description="][idx] + first
+ *             if first.startswith('ID='):            data['id'] = first.split('=')[1]             # <<<<<<<<<<<<<<
+ *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
+ *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
+ */
+  __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
+  PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_40));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
+  __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
+
+  /* "cvcf.pyx":355
+ *                 first = ["ID=","Number=","Type=","Description="][idx] + first
+ *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
+ *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]             # <<<<<<<<<<<<<<
+ *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
+ *             elif first.startswith('Description='):
+ */
+  __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_46));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
+  PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_41));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
+  __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
+
+  /* "cvcf.pyx":356
+ *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
+ *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
+ *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]             # <<<<<<<<<<<<<<
+ *             elif first.startswith('Description='):
+ *                 elts = format.split('"')
+ */
+  __pyx_k_tuple_48 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_48));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
+  PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_kp_s_42));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
+  __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
+
+  /* "cvcf.pyx":357
+ *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
+ *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
+ *             elif first.startswith('Description='):             # <<<<<<<<<<<<<<
+ *                 elts = format.split('"')
+ *                 if len(elts)<3:
+ */
+  __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
+  PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_43));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
+
+  /* "cvcf.pyx":358
+ *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
+ *             elif first.startswith('Description='):
+ *                 elts = format.split('"')             # <<<<<<<<<<<<<<
+ *                 if len(elts)<3:
+ *                     self.error(line,self.FORMAT_MISSING_QUOTES)
+ */
+  __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
+  PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+
+  /* "cvcf.pyx":361
+ *                 if len(elts)<3:
+ *                     self.error(line,self.FORMAT_MISSING_QUOTES)
+ *                     elts = first.split('=') + [rest]             # <<<<<<<<<<<<<<
+ *                 data['descr'] = elts[1]
+ *                 rest = '"'.join(elts[2:])
+ */
+  __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
+
+  /* "cvcf.pyx":364
+ *                 data['descr'] = elts[1]
+ *                 rest = '"'.join(elts[2:])
+ *                 if rest.startswith(','): rest = rest[1:]             # <<<<<<<<<<<<<<
+ *             else:
+ *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
+ */
+  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
+
+  /* "cvcf.pyx":474
+ *         # snip off trailing missing data
+ *         while len(output) > 1:
+ *             last = output[-1].replace(',','').replace('.','')             # <<<<<<<<<<<<<<
+ *             if len(last)>0: break
+ *             output = output[:-1]
+ */
+  __pyx_k_tuple_67 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, ((PyObject *)__pyx_kp_s_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
+  __pyx_k_tuple_68 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
+  PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_68, 1, ((PyObject *)__pyx_kp_s_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
+
+  /* "cvcf.pyx":490
+ * 
+ *     def parse_header( self, line ):
+ *         assert line.startswith('##')             # <<<<<<<<<<<<<<
+ *         elts = line[2:].split('=')
+ *         key = elts[0].strip()
+ */
+  __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_74));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_73));
+  PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_kp_s_73));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));
+
+  /* "cvcf.pyx":491
+ *     def parse_header( self, line ):
+ *         assert line.startswith('##')
+ *         elts = line[2:].split('=')             # <<<<<<<<<<<<<<
+ *         key = elts[0].strip()
+ *         value = '='.join(elts[1:]).strip()
+ */
+  __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
+
+  /* "cvcf.pyx":526
+ * 
+ *     def parse_heading( self, line ):
+ *         assert line.startswith('#')             # <<<<<<<<<<<<<<
+ *         assert not line.startswith('##')
+ *         headings = line[1:].split('\t')
+ */
+  __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_82));
+  PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_82));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
+
+  /* "cvcf.pyx":527
+ *     def parse_heading( self, line ):
+ *         assert line.startswith('#')
+ *         assert not line.startswith('##')             # <<<<<<<<<<<<<<
+ *         headings = line[1:].split('\t')
+ *         if len(headings)==1 and len(line[1:].split()) >= 9:
+ */
+  __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_84));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_73));
+  PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_73));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
+
+  /* "cvcf.pyx":528
+ *         assert line.startswith('#')
+ *         assert not line.startswith('##')
+ *         headings = line[1:].split('\t')             # <<<<<<<<<<<<<<
+ *         if len(headings)==1 and len(line[1:].split()) >= 9:
+ *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
+ */
+  __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_86));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_85));
+  PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_85));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
+
+  /* "cvcf.pyx":581
+ *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
+ *             return []
+ *         values = value.split(',')             # <<<<<<<<<<<<<<
+ *         # deal with trailing data in some early VCF files
+ *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
+ */
+  __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_94));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
+
+  /* "cvcf.pyx":583
+ *         values = value.split(',')
+ *         # deal with trailing data in some early VCF files
+ *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:             # <<<<<<<<<<<<<<
+ *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])
+ *             values[-1] = values[-1].split(';')[0]
+ */
+  __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));
+
+  /* "cvcf.pyx":585
+ *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
+ *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])
+ *             values[-1] = values[-1].split(';')[0]             # <<<<<<<<<<<<<<
+ *         if f.type == "Integer":
+ *             for idx,v in enumerate(values):
+ */
+  __pyx_k_tuple_96 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_96));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
+
+  /* "cvcf.pyx":623
+ * 
+ *     def parse_data( self, line, lineparse=False ):
+ *         cols = line.split('\t')             # <<<<<<<<<<<<<<
+ *         if len(cols) != len(self._samples)+9:
+ *             # gracefully deal with absent FORMAT column
+ */
+  __pyx_k_tuple_100 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_100));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_85));
+  PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_kp_s_85));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100));
+
+  /* "cvcf.pyx":668
+ *         # convert v3.3 to v4.0 alleles below
+ *         if cols[4] == ".": alt = []
+ *         else: alt = cols[4].upper().split(',')             # <<<<<<<<<<<<<<
+ * 
+ *         if cols[5] == ".": qual = -1
+ */
+  __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104));
+
+  /* "cvcf.pyx":677
+ *         # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
+ *         if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []
+ *         else: filter = cols[6].split(';')             # <<<<<<<<<<<<<<
+ * 
+ *         # dictionary of keys, and list of values
+ */
+  __pyx_k_tuple_105 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_105));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_105, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105));
+
+  /* "cvcf.pyx":682
+ *         info = {}
+ *         if cols[7] != ".":
+ *             for blurp in cols[7].split(';'):             # <<<<<<<<<<<<<<
+ *                 elts = blurp.split('=')
+ *                 if len(elts) == 1: v = None
+ */
+  __pyx_k_tuple_106 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_106));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));
+
+  /* "cvcf.pyx":683
+ *         if cols[7] != ".":
+ *             for blurp in cols[7].split(';'):
+ *                 elts = blurp.split('=')             # <<<<<<<<<<<<<<
+ *                 if len(elts) == 1: v = None
+ *                 elif len(elts) == 2: v = elts[1]
+ */
+  __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
+  PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));
+
+  /* "cvcf.pyx":691
+ *         # Gracefully deal with absent FORMAT column
+ *         if cols[8] == "": format = []
+ *         else: format = cols[8].split(':')             # <<<<<<<<<<<<<<
+ * 
+ *         # check: all filters are defined
+ */
+  __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));
+
+  /* "cvcf.pyx":708
+ *             for a in alt:
+ *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
+ *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference             # <<<<<<<<<<<<<<
+ *                 elif a.startswith('D'): # allow D<seq> and D<num>
+ *                     have_deletions = True
+ */
+  __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__I));
+  PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_n_s__I));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));
+
+  /* "cvcf.pyx":709
+ *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
+ *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
+ *                 elif a.startswith('D'): # allow D<seq> and D<num>             # <<<<<<<<<<<<<<
+ *                     have_deletions = True
+ *                     try:
+ */
+  __pyx_k_tuple_110 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_110));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
+  PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_n_s__D));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));
+
+  /* "cvcf.pyx":789
+ *         for sample in cols[9:]:
+ *             dict = {}
+ *             values = sample.split(':')             # <<<<<<<<<<<<<<
+ *             if len(values) > len(format):
+ *                 self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
+ */
+  __pyx_k_tuple_114 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_114));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_114, 0, ((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114));
+
+  /* "cvcf.pyx":855
+ *         for line in stream:
+ *             self._lineno += 1
+ *             if line.startswith('##'):             # <<<<<<<<<<<<<<
+ *                 self.parse_header( line.strip() )
+ *             elif line.startswith('#'):
+ */
+  __pyx_k_tuple_116 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_116));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_73));
+  PyTuple_SET_ITEM(__pyx_k_tuple_116, 0, ((PyObject *)__pyx_kp_s_73));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116));
+
+  /* "cvcf.pyx":857
+ *             if line.startswith('##'):
+ *                 self.parse_header( line.strip() )
+ *             elif line.startswith('#'):             # <<<<<<<<<<<<<<
+ *                 self.parse_heading( line.strip() )
+ *                 self.enter_default_format()
+ */
+  __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_82));
+  PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_82));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
+
+  /* "cvcf.pyx":921
+ * 
+ *     def setversion(self, version):
+ *         if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files")             # <<<<<<<<<<<<<<
+ *         self._version = version
+ * 
+ */
+  __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_120));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_119));
+  PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_119));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
+
+  /* "cvcf.pyx":999
+ *         '''
+ * 
+ *         raise NotImplementedError( "needs to be checked" )             # <<<<<<<<<<<<<<
+ * 
+ *         chrom, pos = record.chrom, record.pos
+ */
+  __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_122));
+  PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_122));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_122));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));
+
+  /* "cvcf.pyx":1040
+ *             for a in alt:
+ *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
+ *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference             # <<<<<<<<<<<<<<
+ *                 elif a.startswith('D'): # allow D<seq> and D<num>
+ *                     have_deletions = True
+ */
+  __pyx_k_tuple_124 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_124));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__I));
+  PyTuple_SET_ITEM(__pyx_k_tuple_124, 0, ((PyObject *)__pyx_n_s__I));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));
+
+  /* "cvcf.pyx":1041
+ *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
+ *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
+ *                 elif a.startswith('D'): # allow D<seq> and D<num>             # <<<<<<<<<<<<<<
+ *                     have_deletions = True
+ *                     try:
+ */
+  __pyx_k_tuple_125 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_125));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
+  PyTuple_SET_ITEM(__pyx_k_tuple_125, 0, ((PyObject *)__pyx_n_s__D));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125));
+
+  /* "cvcf.pyx":54
+ * import pysam
+ * 
+ * gtsRegEx = re.compile("[|/\\\\]")             # <<<<<<<<<<<<<<
+ * alleleRegEx = re.compile('^[ACGTN]+$')
+ * 
+ */
+  __pyx_k_tuple_127 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_127));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_126));
+  PyTuple_SET_ITEM(__pyx_k_tuple_127, 0, ((PyObject *)__pyx_kp_s_126));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127));
+
+  /* "cvcf.pyx":55
+ * 
+ * gtsRegEx = re.compile("[|/\\\\]")
+ * alleleRegEx = re.compile('^[ACGTN]+$')             # <<<<<<<<<<<<<<
+ * 
+ * # Utility function.  Uses 0-based coordinates
+ */
+  __pyx_k_tuple_129 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_129));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_128));
+  PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_128));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));
+
+  /* "cvcf.pyx":86
+ * 
+ * 
+ * FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue')             # <<<<<<<<<<<<<<
+ * 
+ * ###########################################################################################################
+ */
+  __pyx_k_tuple_131 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_131));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT));
+  PyTuple_SET_ITEM(__pyx_k_tuple_131, 0, ((PyObject *)__pyx_n_s__FORMAT));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_130));
+  PyTuple_SET_ITEM(__pyx_k_tuple_131, 1, ((PyObject *)__pyx_kp_s_130));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131));
+  __Pyx_RefNannyFinishContext();
+  return 0;
+  __pyx_L1_error:;
+  __Pyx_RefNannyFinishContext();
+  return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+  #if PY_VERSION_HEX < 0x02040000
+  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_21 = PyInt_FromLong(21); if (unlikely(!__pyx_int_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_22 = PyInt_FromLong(22); if (unlikely(!__pyx_int_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_23 = PyInt_FromLong(23); if (unlikely(!__pyx_int_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_25 = PyInt_FromLong(25); if (unlikely(!__pyx_int_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_26 = PyInt_FromLong(26); if (unlikely(!__pyx_int_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_27 = PyInt_FromLong(27); if (unlikely(!__pyx_int_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_28 = PyInt_FromLong(28); if (unlikely(!__pyx_int_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_29 = PyInt_FromLong(29); if (unlikely(!__pyx_int_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_30 = PyInt_FromLong(30); if (unlikely(!__pyx_int_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_33 = PyInt_FromLong(33); if (unlikely(!__pyx_int_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_3000000000 = PyInt_FromString((char *)"3000000000", 0, 0); if (unlikely(!__pyx_int_3000000000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initcvcf(void); /*proto*/
+PyMODINIT_FUNC initcvcf(void)
+#else
+PyMODINIT_FUNC PyInit_cvcf(void); /*proto*/
+PyMODINIT_FUNC PyInit_cvcf(void)
+#endif
+{
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  #if CYTHON_REFNANNY
+  void* __pyx_refnanny = NULL;
+  __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");
+  }
+  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_cvcf(void)", __LINE__, __FILE__);
+  #endif
+  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifdef __pyx_binding_PyCFunctionType_USED
+  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  /*--- Library function declarations ---*/
+  /*--- Threads initialization code ---*/
+  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+  #ifdef WITH_THREAD /* Python build with threading support? */
+  PyEval_InitThreads();
+  #endif
+  #endif
+  /*--- Module creation code ---*/
+  #if PY_MAJOR_VERSION < 3
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
+  #else
+  __pyx_m = PyModule_Create(&__pyx_moduledef);
+  #endif
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
+  #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  /*--- Initialize various global constants etc. ---*/
+  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_module_is_main_cvcf) {
+    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  }
+  /*--- Builtin init code ---*/
+  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Constants init code ---*/
+  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Global init code ---*/
+  /*--- Function export code ---*/
+  /*--- Type init code ---*/
+  __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_4cvcf_VCFRecord = &__pyx_vtable_4cvcf_VCFRecord;
+  __pyx_vtable_4cvcf_VCFRecord.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy;
+  __pyx_vtable_4cvcf_VCFRecord.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_4cvcf_9VCFRecord_update;
+  __pyx_type_4cvcf_VCFRecord.tp_base = __pyx_ptype_10TabProxies_TupleProxy;
+  if (PyType_Ready(&__pyx_type_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_4cvcf_VCFRecord.tp_dict, __pyx_vtabptr_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "VCFRecord", (PyObject *)&__pyx_type_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_4cvcf_VCFRecord = &__pyx_type_4cvcf_VCFRecord;
+  __pyx_ptype_6ctabix_Parser = __Pyx_ImportType("ctabix", "Parser", sizeof(struct __pyx_obj_6ctabix_Parser), 1); if (unlikely(!__pyx_ptype_6ctabix_Parser)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_type_4cvcf_asVCFRecord.tp_base = __pyx_ptype_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asVCFRecord", (PyObject *)&__pyx_type_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_4cvcf_asVCFRecord = &__pyx_type_4cvcf_asVCFRecord;
+  /*--- Type import code ---*/
+  __pyx_ptype_6ctabix_Tabixfile = __Pyx_ImportType("ctabix", "Tabixfile", sizeof(struct __pyx_obj_6ctabix_Tabixfile), 1); if (unlikely(!__pyx_ptype_6ctabix_Tabixfile)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Function import code ---*/
+  /*--- Execution code ---*/
+
+  /* "cvcf.pyx":46
+ * #
+ * 
+ * from collections import namedtuple, defaultdict             # <<<<<<<<<<<<<<
+ * from operator import itemgetter
+ * import sys, re, copy, bisect
+ */
+  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__namedtuple));
+  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__namedtuple));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__namedtuple));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__defaultdict));
+  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__defaultdict));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__defaultdict));
+  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__defaultdict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "cvcf.pyx":47
+ * 
+ * from collections import namedtuple, defaultdict
+ * from operator import itemgetter             # <<<<<<<<<<<<<<
+ * import sys, re, copy, bisect
+ * 
+ */
+  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__itemgetter));
+  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__itemgetter));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__itemgetter));
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__itemgetter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itemgetter, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":48
+ * from collections import namedtuple, defaultdict
+ * from operator import itemgetter
+ * import sys, re, copy, bisect             # <<<<<<<<<<<<<<
+ * 
+ * cimport ctabix
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -23824,7 +24293,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bisect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":52
+  /* "cvcf.pyx":52
  * cimport ctabix
  * cimport TabProxies
  * import pysam             # <<<<<<<<<<<<<<
@@ -23836,7 +24305,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pysam, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":54
+  /* "cvcf.pyx":54
  * import pysam
  * 
  * gtsRegEx = re.compile("[|/\\\\]")             # <<<<<<<<<<<<<<
@@ -23848,1261 +24317,966 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_73));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_73));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73));
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gtsRegEx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gtsRegEx, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":55
+  /* "cvcf.pyx":55
  * 
  * gtsRegEx = re.compile("[|/\\\\]")
  * alleleRegEx = re.compile('^[ACGTN]+$')             # <<<<<<<<<<<<<<
  * 
  * # Utility function.  Uses 0-based coordinates
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_74));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_74));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_74));
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__alleleRegEx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__alleleRegEx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":58
+ * 
+ * # Utility function.  Uses 0-based coordinates
+ * def get_sequence(chrom, start, end, fa):             # <<<<<<<<<<<<<<
+ *     # obtain sequence from .fa file, without truncation
+ *     if end<=start: return ""
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cvcf_get_sequence, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_sequence, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":68
+ * 
+ * # Utility function.  Parses a region string
+ * def parse_regions( string ):             # <<<<<<<<<<<<<<
+ *     result = []
+ *     for r in string.split(','):
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cvcf_1parse_regions, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__parse_regions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":86
+  /* "cvcf.pyx":86
  * 
  * 
  * FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue')             # <<<<<<<<<<<<<<
  * 
  * ###########################################################################################################
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__FORMAT));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_75));
-  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_s_75));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_75));
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FORMAT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FORMAT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":232
+  /* "cvcf.pyx":232
  *         return r
  * 
  * class VCF(object):             # <<<<<<<<<<<<<<
  * 
  *     # types
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(__pyx_builtin_object);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
-  __Pyx_GIVEREF(__pyx_builtin_object);
-  __pyx_t_2 = __Pyx_CreateClass(__pyx_t_3, ((PyObject *)__pyx_t_1), __pyx_n_s__VCF, "cvcf"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":235
+  /* "cvcf.pyx":235
  * 
  *     # types
  *     NT_UNKNOWN = 0             # <<<<<<<<<<<<<<
  *     NT_NUMBER = 1
  *     NT_ALLELES = 2
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__NT_UNKNOWN, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_UNKNOWN, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":236
+  /* "cvcf.pyx":236
  *     # types
  *     NT_UNKNOWN = 0
  *     NT_NUMBER = 1             # <<<<<<<<<<<<<<
  *     NT_ALLELES = 2
  *     NT_NR_ALLELES = 3
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__NT_NUMBER, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_NUMBER, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":237
+  /* "cvcf.pyx":237
  *     NT_UNKNOWN = 0
  *     NT_NUMBER = 1
  *     NT_ALLELES = 2             # <<<<<<<<<<<<<<
  *     NT_NR_ALLELES = 3
  *     NT_GENOTYPES = 4
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__NT_ALLELES, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_ALLELES, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":238
+  /* "cvcf.pyx":238
  *     NT_NUMBER = 1
  *     NT_ALLELES = 2
  *     NT_NR_ALLELES = 3             # <<<<<<<<<<<<<<
  *     NT_GENOTYPES = 4
  *     NT_PHASED_GENOTYPES = 5
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__NT_NR_ALLELES, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_NR_ALLELES, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":239
+  /* "cvcf.pyx":239
  *     NT_ALLELES = 2
  *     NT_NR_ALLELES = 3
  *     NT_GENOTYPES = 4             # <<<<<<<<<<<<<<
  *     NT_PHASED_GENOTYPES = 5
  * 
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__NT_GENOTYPES, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_GENOTYPES, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":240
+  /* "cvcf.pyx":240
  *     NT_NR_ALLELES = 3
  *     NT_GENOTYPES = 4
  *     NT_PHASED_GENOTYPES = 5             # <<<<<<<<<<<<<<
  * 
  *     _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier",
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__NT_PHASED_GENOTYPES, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_PHASED_GENOTYPES, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":242
+  /* "cvcf.pyx":242
  *     NT_PHASED_GENOTYPES = 5
  * 
  *     _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier",             # <<<<<<<<<<<<<<
  *                 1:"BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string",
  *                 2:"BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s",
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_0, ((PyObject *)__pyx_kp_s_76)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_1, ((PyObject *)__pyx_kp_s_77)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_2, ((PyObject *)__pyx_kp_s_78)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_3, ((PyObject *)__pyx_kp_s_79)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_4, ((PyObject *)__pyx_kp_s_80)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_5, ((PyObject *)__pyx_kp_s_81)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_6, ((PyObject *)__pyx_kp_s_82)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_7, ((PyObject *)__pyx_kp_s_83)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_8, ((PyObject *)__pyx_kp_s_84)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_9, ((PyObject *)__pyx_kp_s_85)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_10, ((PyObject *)__pyx_kp_s_86)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_11, ((PyObject *)__pyx_kp_s_87)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_12, ((PyObject *)__pyx_kp_s_88)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_13, ((PyObject *)__pyx_kp_s_89)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_14, ((PyObject *)__pyx_kp_s_90)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_15, ((PyObject *)__pyx_kp_s_91)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_16, ((PyObject *)__pyx_kp_s_92)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_17, ((PyObject *)__pyx_kp_s_93)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_18, ((PyObject *)__pyx_kp_s_94)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_19, ((PyObject *)__pyx_kp_s_95)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_20, ((PyObject *)__pyx_kp_s_96)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_21, ((PyObject *)__pyx_kp_s_97)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_22, ((PyObject *)__pyx_kp_s_98)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_23, ((PyObject *)__pyx_kp_s_99)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_24, ((PyObject *)__pyx_kp_s_100)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_25, ((PyObject *)__pyx_kp_s_101)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_26, ((PyObject *)__pyx_kp_s_102)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_27, ((PyObject *)__pyx_kp_s_103)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_28, ((PyObject *)__pyx_kp_s_104)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_29, ((PyObject *)__pyx_kp_s_105)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_3, __pyx_int_30, ((PyObject *)__pyx_kp_s_106)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___errors, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, ((PyObject *)__pyx_kp_s_132)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, ((PyObject *)__pyx_kp_s_133)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, ((PyObject *)__pyx_kp_s_134)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, ((PyObject *)__pyx_kp_s_135)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_kp_s_136)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, ((PyObject *)__pyx_kp_s_137)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, ((PyObject *)__pyx_kp_s_138)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, ((PyObject *)__pyx_kp_s_139)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, ((PyObject *)__pyx_kp_s_154)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, ((PyObject *)__pyx_kp_s_155)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, ((PyObject *)__pyx_kp_s_156)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, ((PyObject *)__pyx_kp_s_157)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, ((PyObject *)__pyx_kp_s_158)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, ((PyObject *)__pyx_kp_s_159)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, ((PyObject *)__pyx_kp_s_160)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, ((PyObject *)__pyx_kp_s_161)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, ((PyObject *)__pyx_kp_s_162)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___errors, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":276
+  /* "cvcf.pyx":276
  * 
  *     # tag-value pairs; tags are not unique; does not include fileformat, INFO, FILTER or FORMAT fields
  *     _header = []             # <<<<<<<<<<<<<<
  * 
  *     # version number; 33=v3.3; 40=v4.0
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___header, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___header, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":279
+  /* "cvcf.pyx":279
  * 
  *     # version number; 33=v3.3; 40=v4.0
  *     _version = 40             # <<<<<<<<<<<<<<
  * 
  *     # info, filter and format data
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___version, __pyx_int_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___version, __pyx_int_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":282
+  /* "cvcf.pyx":282
  * 
  *     # info, filter and format data
  *     _info = {}             # <<<<<<<<<<<<<<
  *     _filter = {}
  *     _format = {}
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___info, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___info, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":283
+  /* "cvcf.pyx":283
  *     # info, filter and format data
  *     _info = {}
  *     _filter = {}             # <<<<<<<<<<<<<<
  *     _format = {}
  * 
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___filter, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___filter, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":284
+  /* "cvcf.pyx":284
  *     _info = {}
  *     _filter = {}
  *     _format = {}             # <<<<<<<<<<<<<<
  * 
  *     # header; and required columns
  */
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___format, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___format, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":287
+  /* "cvcf.pyx":287
  * 
  *     # header; and required columns
  *     _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"]             # <<<<<<<<<<<<<<
  *     _samples = []
  * 
  */
-  __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__CHROM));
-  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__CHROM));
+  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__CHROM));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CHROM));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__POS));
-  PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__POS));
+  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__POS));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__POS));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
-  PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__ID));
+  PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__ID));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__REF));
-  PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__REF));
+  PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__REF));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__REF));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ALT));
-  PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__ALT));
+  PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__ALT));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ALT));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__QUAL));
-  PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_n_s__QUAL));
+  PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__QUAL));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__QUAL));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FILTER));
-  PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s__FILTER));
+  PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__FILTER));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FILTER));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__INFO));
-  PyList_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_n_s__INFO));
+  PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__INFO));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__INFO));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT));
-  PyList_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_n_s__FORMAT));
+  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__FORMAT));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT));
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___required, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___required, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":288
+  /* "cvcf.pyx":288
  *     # header; and required columns
  *     _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"]
  *     _samples = []             # <<<<<<<<<<<<<<
  * 
  *     # control behaviour
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___samples, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___samples, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":291
+  /* "cvcf.pyx":291
  * 
  *     # control behaviour
  *     _ignored_errors = set([11])   # ERROR_UNKNOWN_KEY             # <<<<<<<<<<<<<<
  *     _warn_errors = set([])
  *     _leftalign = False
  */
-  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_int_11);
-  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_11);
+  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_11);
   __Pyx_GIVEREF(__pyx_int_11);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___ignored_errors, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___ignored_errors, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":292
+  /* "cvcf.pyx":292
  *     # control behaviour
  *     _ignored_errors = set([11])   # ERROR_UNKNOWN_KEY
  *     _warn_errors = set([])             # <<<<<<<<<<<<<<
  *     _leftalign = False
  * 
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___warn_errors, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___warn_errors, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":293
+  /* "cvcf.pyx":293
  *     _ignored_errors = set([11])   # ERROR_UNKNOWN_KEY
  *     _warn_errors = set([])
  *     _leftalign = False             # <<<<<<<<<<<<<<
  * 
  *     # reference sequence
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___leftalign, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___leftalign, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":296
+  /* "cvcf.pyx":296
  * 
  *     # reference sequence
  *     _reference = None             # <<<<<<<<<<<<<<
  * 
  *     # regions to include; None includes everything
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___reference, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___reference, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":299
+  /* "cvcf.pyx":299
  * 
  *     # regions to include; None includes everything
  *     _regions = None             # <<<<<<<<<<<<<<
  * 
  *     # statefull stuff
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___regions, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___regions, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":302
+  /* "cvcf.pyx":302
  * 
  *     # statefull stuff
  *     _lineno = -1             # <<<<<<<<<<<<<<
  *     _line = None
  *     _lines = None
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___lineno, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___lineno, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":303
+  /* "cvcf.pyx":303
  *     # statefull stuff
  *     _lineno = -1
  *     _line = None             # <<<<<<<<<<<<<<
  *     _lines = None
  * 
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___line, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___line, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":304
+  /* "cvcf.pyx":304
  *     _lineno = -1
  *     _line = None
  *     _lines = None             # <<<<<<<<<<<<<<
  * 
  *     def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):
  */
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___lines, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___lines, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":306
+  /* "cvcf.pyx":306
  *     _lines = None
  * 
  *     def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):             # <<<<<<<<<<<<<<
  *         # make error identifiers accessible by name
  *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_13 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF___init__, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_22 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF___init__, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":327
+  /* "cvcf.pyx":327
  *         self._lines = lines
  * 
  *     def error(self,line,error,opt=None):             # <<<<<<<<<<<<<<
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_error, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__error, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_1error, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__error, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":336
+  /* "cvcf.pyx":336
  *         raise ValueError(errorstring)
  * 
  *     def parse_format(self,line,format,filter=False):             # <<<<<<<<<<<<<<
  *         if self._version == 40:
  *             if not format.startswith('<'):
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_15 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_parse_format, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__parse_format, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_26 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_2parse_format, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_format, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":398
+  /* "cvcf.pyx":398
  * 
  * 
  *     def format_format( self, fmt, filter=False ):             # <<<<<<<<<<<<<<
  *         values = [('ID',fmt.id)]
  *         if fmt.number != None and not filter:
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_32 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_format_format, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__format_format, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_60 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_3format_format, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__format_format, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":418
+  /* "cvcf.pyx":418
  *         return format
  * 
  *     def get_expected(self, format, formatdict, alt):             # <<<<<<<<<<<<<<
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_get_expected, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__get_expected, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_4get_expected, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__get_expected, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":429
+  /* "cvcf.pyx":429
  * 
  * 
  *     def _add_definition(self, formatdict, key, data, line ):             # <<<<<<<<<<<<<<
  *         if key in formatdict: return
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF__add_definition, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___add_definition, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_5_add_definition, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___add_definition, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":446
+  /* "cvcf.pyx":446
  * 
  *     # todo: trim trailing missing values
  *     def format_formatdata( self, data, format, key=True, value=True, separator=":" ):             # <<<<<<<<<<<<<<
  *         output, sdata = [], []
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_36 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_37 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_format_formatdata, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__format_formatdata, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_64 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_65 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_6format_formatdata, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__format_formatdata, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":480
+  /* "cvcf.pyx":480
  * 
  * 
  *     def enter_default_format(self):             # <<<<<<<<<<<<<<
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_enter_default_format, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s_69, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_7enter_default_format, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_118, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":489
+  /* "cvcf.pyx":489
  *                 self._format[f.id] = f
  * 
  *     def parse_header( self, line ):             # <<<<<<<<<<<<<<
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_parse_header, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__parse_header, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_8parse_header, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":518
+  /* "cvcf.pyx":518
  * 
  * 
  *     def write_header( self, stream ):             # <<<<<<<<<<<<<<
  *         stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))
  *         for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_write_header, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__write_header, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_9write_header, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":525
+  /* "cvcf.pyx":525
  * 
  * 
  *     def parse_heading( self, line ):             # <<<<<<<<<<<<<<
  *         assert line.startswith('#')
  *         assert not line.startswith('##')
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_parse_heading, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__parse_heading, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_10parse_heading, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_heading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":553
+  /* "cvcf.pyx":553
  *         self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] )
  * 
  *     def write_heading( self, stream ):             # <<<<<<<<<<<<<<
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")
  * 
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_write_heading, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__write_heading, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_11write_heading, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_heading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":556
+  /* "cvcf.pyx":556
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")
  * 
  *     def convertGT(self, GTstring):             # <<<<<<<<<<<<<<
  *         if GTstring == ".": return ["."]
  *         try:
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_convertGT, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__convertGT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_12convertGT, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__convertGT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":569
+  /* "cvcf.pyx":569
  * 
  * 
  *     def convertGTback(self, GTdata):             # <<<<<<<<<<<<<<
  *         return ''.join(map(str,GTdata))
  * 
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_convertGTback, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__convertGTback, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_13convertGTback, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__convertGTback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":572
+  /* "cvcf.pyx":572
  *         return ''.join(map(str,GTdata))
  * 
  *     def parse_formatdata( self, key, value, formatdict, line ):             # <<<<<<<<<<<<<<
  *         # To do: check that the right number of values is present
  *         f = formatdict.get(key,None)
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_parse_formatdata, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__parse_formatdata, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_14parse_formatdata, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_formatdata, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":615
+  /* "cvcf.pyx":615
  * 
  * 
  *     def inregion(self, chrom, pos):             # <<<<<<<<<<<<<<
  *         if not self._regions: return True
  *         for r in self._regions:
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_inregion, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__inregion, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_15inregion, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__inregion, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":622
+  /* "cvcf.pyx":622
  * 
  * 
  *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
  *         cols = line.split('\t')
  *         if len(cols) != len(self._samples)+9:
  */
-  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_k_61 = __pyx_t_3;
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_parse_data, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__parse_data, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_99 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_16parse_data, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":822
+  /* "cvcf.pyx":822
  * 
  * 
  *     def write_data(self, stream, data):             # <<<<<<<<<<<<<<
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
  *         for k in required:
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_write_data, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__write_data, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_17write_data, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":851
+  /* "cvcf.pyx":851
  *         stream.write( "\t".join(output) + "\n" )
  * 
  *     def _parse_header(self, stream):             # <<<<<<<<<<<<<<
  *         self._lineno = 0
  *         for line in stream:
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF__parse_header, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___parse_header, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_18_parse_header, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___parse_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":864
+  /* "cvcf.pyx":864
  *         return line
  * 
  *     def _parse(self, line, stream):             # <<<<<<<<<<<<<<
  *         if len(line.strip()) > 0:
  *             d = self.parse_data( line.strip() )
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF__parse, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s___parse, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_19_parse, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___parse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":880
+  /* "cvcf.pyx":880
  *     ######################################################################################################
  * 
  *     def getsamples(self):             # <<<<<<<<<<<<<<
  *         """ List of samples in VCF file """
  *         return self._samples
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_getsamples, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__getsamples, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_20getsamples, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getsamples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":884
+  /* "cvcf.pyx":884
  *         return self._samples
  * 
  *     def setsamples(self,samples):             # <<<<<<<<<<<<<<
  *         """ List of samples in VCF file """
  *         self._samples = samples
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setsamples, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setsamples, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_21setsamples, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setsamples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":888
+  /* "cvcf.pyx":888
  *         self._samples = samples
  * 
  *     def getheader(self):             # <<<<<<<<<<<<<<
  *         """ List of header key-value pairs (strings) """
  *         return self._header
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_getheader, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__getheader, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_22getheader, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":892
+  /* "cvcf.pyx":892
  *         return self._header
  * 
  *     def setheader(self,header):             # <<<<<<<<<<<<<<
  *         """ List of header key-value pairs (strings) """
  *         self._header = header
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setheader, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setheader, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_23setheader, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":896
+  /* "cvcf.pyx":896
  *         self._header = header
  * 
  *     def getinfo(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         return self._info
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_getinfo, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__getinfo, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_24getinfo, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getinfo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":900
+  /* "cvcf.pyx":900
  *         return self._info
  * 
  *     def setinfo(self,info):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         self._info = info
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setinfo, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setinfo, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_25setinfo, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setinfo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":904
+  /* "cvcf.pyx":904
  *         self._info = info
  * 
  *     def getformat(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         return self._format
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_getformat, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__getformat, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_26getformat, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getformat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":908
+  /* "cvcf.pyx":908
  *         return self._format
  * 
  *     def setformat(self,format):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         self._format = format
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setformat, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setformat, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_27setformat, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setformat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":912
+  /* "cvcf.pyx":912
  *         self._format = format
  * 
  *     def getfilter(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         return self._filter
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_getfilter, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__getfilter, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_28getfilter, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getfilter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":916
+  /* "cvcf.pyx":916
  *         return self._filter
  * 
  *     def setfilter(self,filter):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         self._filter = filter
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setfilter, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setfilter, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_29setfilter, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setfilter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":920
+  /* "cvcf.pyx":920
  *         self._filter = filter
  * 
  *     def setversion(self, version):             # <<<<<<<<<<<<<<
  *         if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files")
  *         self._version = version
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setversion, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setversion, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_30setversion, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setversion, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":924
+  /* "cvcf.pyx":924
  *         self._version = version
  * 
  *     def setregions(self, regions):             # <<<<<<<<<<<<<<
  *         self._regions = regions
  * 
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setregions, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setregions, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_31setregions, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setregions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":927
+  /* "cvcf.pyx":927
  *         self._regions = regions
  * 
  *     def setreference(self, ref):             # <<<<<<<<<<<<<<
  *         """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """
  *         self._reference = ref
  */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_setreference, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__setreference, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_32setreference, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setreference, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":931
+  /* "cvcf.pyx":931
  *         self._reference = ref
  * 
  *     def ignoreerror(self, errorstring):             # <<<<<<<<<<<<<<
  *         try:             self._ignored_errors.add(self.__dict__[errorstring])
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_ignoreerror, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__ignoreerror, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":935
- *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
- * 
- *     def warnerror(self, errorstring):             # <<<<<<<<<<<<<<
- *         try:             self._warn_errors.add(self.__dict__[errorstring])
- *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
- */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_warnerror, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__warnerror, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":939
- *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
- * 
- *     def parse(self, stream):             # <<<<<<<<<<<<<<
- *         """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
- *         last_line = self._parse_header(stream)
- */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_parse, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__parse, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":946
- *         return self._parse(last_line, stream)
- * 
- *     def write(self, stream, datagenerator):             # <<<<<<<<<<<<<<
- *         """ Writes a VCF file to a stream, using a data generator (or list) """
- *         self.write_header(stream)
- */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_write, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__write, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":952
- *         for data in datagenerator: self.write_data(stream,data)
- * 
- *     def writeheader(self, stream):             # <<<<<<<<<<<<<<
- *         """ Writes a VCF header """
- *         self.write_header(stream)
- */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_writeheader, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__writeheader, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":957
- *         self.write_heading(stream)
- * 
- *     def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2):             # <<<<<<<<<<<<<<
- *         """ Utility function: compares two calls for equality """
- *         # a variant should always be assigned to a unique position, one base before
- */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_compare_calls, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__compare_calls, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":979
- * ###########################################################################################################
- * 
- *     def connect( self, filename ):             # <<<<<<<<<<<<<<
- *         '''connect to tabix file.'''
- *         self.tabixfile = pysam.Tabixfile( filename )
- */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_connect, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__connect, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":984
- *         self._parse_header(self.tabixfile.header)
- * 
- *     def fetch(self,             # <<<<<<<<<<<<<<
- *               reference = None,
- *               start = None,
- */
-  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_fetch, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyMethod_New(__pyx_t_3, 0, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__fetch, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":993
- *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )
- * 
- *     def validate( self, record ):             # <<<<<<<<<<<<<<
- *         '''validate vcf record.
- * 
- */
-  __pyx_t_4 = PyCFunction_New(&__pyx_mdef_4cvcf_3VCF_validate, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyMethod_New(__pyx_t_4, 0, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__validate, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VCF, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1118
- *                     pos -= 1
- * 
- * __all__ = [             # <<<<<<<<<<<<<<
- *     "VCF", "VCFRecord", ]
- * 
- */
-  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__VCF));
-  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__VCF));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VCF));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__VCFRecord));
-  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__VCFRecord));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VCFRecord));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-
-  /* "/ifs/devel/pysam/pysam/pysam/cvcf.pyx":1
- * #             # <<<<<<<<<<<<<<
- * # Code to read, write and edit VCF files
- * #
- */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__getsamples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_107), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setsamples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_108), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__getheader); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_109), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setheader); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_110), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__getinfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_111), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setinfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_112), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__getformat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_113), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setformat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_114), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__getfilter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_115), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setfilter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_116), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setreference); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_117), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__parse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_118), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_119), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__writeheader); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_120), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__compare_calls); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_121), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__connect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_122), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fetch); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_123), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__validate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_33ignoreerror, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__ignoreerror, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":935
+ *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
+ * 
+ *     def warnerror(self, errorstring):             # <<<<<<<<<<<<<<
+ *         try:             self._warn_errors.add(self.__dict__[errorstring])
+ *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_34warnerror, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__warnerror, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":939
+ *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
+ * 
+ *     def parse(self, stream):             # <<<<<<<<<<<<<<
+ *         """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
+ *         last_line = self._parse_header(stream)
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_35parse, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":946
+ *         return self._parse(last_line, stream)
+ * 
+ *     def write(self, stream, datagenerator):             # <<<<<<<<<<<<<<
+ *         """ Writes a VCF file to a stream, using a data generator (or list) """
+ *         self.write_header(stream)
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_36write, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":952
+ *         for data in datagenerator: self.write_data(stream,data)
+ * 
+ *     def writeheader(self, stream):             # <<<<<<<<<<<<<<
+ *         """ Writes a VCF header """
+ *         self.write_header(stream)
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_37writeheader, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__writeheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":957
+ *         self.write_heading(stream)
+ * 
+ *     def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2):             # <<<<<<<<<<<<<<
+ *         """ Utility function: compares two calls for equality """
+ *         # a variant should always be assigned to a unique position, one base before
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_38compare_calls, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__compare_calls, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":979
+ * ###########################################################################################################
+ * 
+ *     def connect( self, filename ):             # <<<<<<<<<<<<<<
+ *         '''connect to tabix file.'''
+ *         self.tabixfile = pysam.Tabixfile( filename )
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_39connect, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__connect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":984
+ *         self._parse_header(self.tabixfile.header)
+ * 
+ *     def fetch(self,             # <<<<<<<<<<<<<<
+ *               reference = None,
+ *               start = None,
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_40fetch, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__fetch, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":993
+ *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )
+ * 
+ *     def validate( self, record ):             # <<<<<<<<<<<<<<
+ *         '''validate vcf record.
+ * 
+ */
+  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_41validate, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__validate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "cvcf.pyx":232
+ *         return r
+ * 
+ * class VCF(object):             # <<<<<<<<<<<<<<
+ * 
+ *     # types
+ */
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_builtin_object);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
+  __Pyx_GIVEREF(__pyx_builtin_object);
+  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__VCF, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_124), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VCF, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+
+  /* "cvcf.pyx":1118
+ *                     pos -= 1
+ * 
+ * __all__ = [             # <<<<<<<<<<<<<<
+ *     "VCF", "VCFRecord", ]
+ * 
+ */
+  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__VCF));
+  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__VCF));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VCF));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__VCFRecord));
+  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__VCFRecord));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VCFRecord));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+
+  /* "cvcf.pyx":1
+ * #             # <<<<<<<<<<<<<<
+ * # Code to read, write and edit VCF files
+ * #
+ */
+  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "pysam/ctabix.pxd":2
+  /* "ctabix.pxd":2
  * 
  * cdef extern from "string.h":             # <<<<<<<<<<<<<<
  *   ctypedef int size_t
@@ -25113,7 +25287,6 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
   if (__pyx_m) {
     __Pyx_AddTraceback("init cvcf");
     Py_DECREF(__pyx_m); __pyx_m = 0;
@@ -25139,19 +25312,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     return result;
 }
 
-static void __Pyx_RaiseDoubleKeywordsError(
-    const char* func_name,
-    PyObject* kw_name)
-{
-    PyErr_Format(PyExc_TypeError,
-        #if PY_MAJOR_VERSION >= 3
-        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
-        #else
-        "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AS_STRING(kw_name));
-        #endif
-}
-
 static void __Pyx_RaiseArgtupleInvalid(
     const char* func_name,
     int exact,
@@ -25182,6 +25342,19 @@ static void __Pyx_RaiseArgtupleInvalid(
         func_name, more_or_less, num_expected, number, num_found);
 }
 
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name,
+    PyObject* kw_name)
+{
+    PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION >= 3
+        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+        #else
+        "%s() got multiple values for keyword argument '%s'", func_name,
+        PyString_AS_STRING(kw_name));
+        #endif
+}
+
 static int __Pyx_ParseOptionalKeywords(
     PyObject *kwds,
     PyObject **argnames[],
@@ -25262,51 +25435,188 @@ bad:
 }
 
 
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
-    PyObject *local_type, *local_value, *local_tb;
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-    local_type = tstate->curexc_type;
-    local_value = tstate->curexc_value;
-    local_tb = tstate->curexc_traceback;
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
-    if (unlikely(tstate->curexc_type))
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+    PyObject *local_type, *local_value, *local_tb;
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+    local_type = tstate->curexc_type;
+    local_value = tstate->curexc_value;
+    local_tb = tstate->curexc_traceback;
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+    if (unlikely(tstate->curexc_type))
+        goto bad;
+    #if PY_MAJOR_VERSION >= 3
+    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+        goto bad;
+    #endif
+    *type = local_type;
+    *value = local_value;
+    *tb = local_tb;
+    Py_INCREF(local_type);
+    Py_INCREF(local_value);
+    Py_INCREF(local_tb);
+    tmp_type = tstate->exc_type;
+    tmp_value = tstate->exc_value;
+    tmp_tb = tstate->exc_traceback;
+    tstate->exc_type = local_type;
+    tstate->exc_value = local_value;
+    tstate->exc_traceback = local_tb;
+    /* Make sure tstate is in a consistent state when we XDECREF
+       these objects (XDECREF may run arbitrary code). */
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+    return 0;
+bad:
+    *type = 0;
+    *value = 0;
+    *tb = 0;
+    Py_XDECREF(local_type);
+    Py_XDECREF(local_value);
+    Py_XDECREF(local_tb);
+    return -1;
+}
+
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+
+    tmp_type = tstate->curexc_type;
+    tmp_value = tstate->curexc_value;
+    tmp_tb = tstate->curexc_traceback;
+    tstate->curexc_type = type;
+    tstate->curexc_value = value;
+    tstate->curexc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+}
+
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->curexc_type;
+    *value = tstate->curexc_value;
+    *tb = tstate->curexc_traceback;
+
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+}
+
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    Py_XINCREF(type);
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    /* Next, replace a missing value with None */
+    if (value == NULL) {
+        value = Py_None;
+        Py_INCREF(value);
+    }
+    #if PY_VERSION_HEX < 0x02050000
+    if (!PyClass_Check(type))
+    #else
+    if (!PyType_Check(type))
+    #endif
+    {
+        /* Raising an instance.  The value should be a dummy. */
+        if (value != Py_None) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto raise_error;
+        }
+        /* Normalize to raise <class>, <instance> */
+        Py_DECREF(value);
+        value = type;
+        #if PY_VERSION_HEX < 0x02050000
+            if (PyInstance_Check(type)) {
+                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+                Py_INCREF(type);
+            }
+            else {
+                type = 0;
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception must be an old-style class or instance");
+                goto raise_error;
+            }
+        #else
+            type = (PyObject*) Py_TYPE(type);
+            Py_INCREF(type);
+            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception class must be a subclass of BaseException");
+                goto raise_error;
+            }
+        #endif
+    }
+
+    __Pyx_ErrRestore(type, value, tb);
+    return;
+raise_error:
+    Py_XDECREF(value);
+    Py_XDECREF(type);
+    Py_XDECREF(tb);
+    return;
+}
+
+#else /* Python 3+ */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    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 PY_MAJOR_VERSION >= 3
-    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+    }
+    if (value == Py_None)
+        value = 0;
+
+    if (PyExceptionInstance_Check(type)) {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto bad;
+        }
+        value = type;
+        type = (PyObject*) Py_TYPE(value);
+    } else if (!PyExceptionClass_Check(type)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: exception class must be a subclass of BaseException");
         goto bad;
-    #endif
-    *type = local_type;
-    *value = local_value;
-    *tb = local_tb;
-    Py_INCREF(local_type);
-    Py_INCREF(local_value);
-    Py_INCREF(local_tb);
-    tmp_type = tstate->exc_type;
-    tmp_value = tstate->exc_value;
-    tmp_tb = tstate->exc_traceback;
-    tstate->exc_type = local_type;
-    tstate->exc_value = local_value;
-    tstate->exc_traceback = local_tb;
-    /* Make sure tstate is in a consistent state when we XDECREF
-       these objects (XDECREF may run arbitrary code). */
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-    return 0;
+    }
+
+    PyErr_SetObject(type, value);
+
+    if (tb) {
+        PyThreadState *tstate = PyThreadState_GET();
+        PyObject* tmp_tb = tstate->curexc_traceback;
+        if (tb != tmp_tb) {
+            Py_INCREF(tb);
+            tstate->curexc_traceback = tb;
+            Py_XDECREF(tmp_tb);
+        }
+    }
+
 bad:
-    *type = 0;
-    *value = 0;
-    *tb = 0;
-    Py_XDECREF(local_type);
-    Py_XDECREF(local_value);
-    Py_XDECREF(local_tb);
-    return -1;
+    return;
 }
-
+#endif
 
 static double __Pyx__PyObject_AsDouble(PyObject* obj) {
     PyObject* float_value;
@@ -25446,167 +25756,91 @@ bad:
     return module;
 }
 
-static PyObject *__Pyx_CreateClass(
-    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
-{
-    PyObject *py_modname;
-    PyObject *result = 0;
-
-    #if PY_MAJOR_VERSION < 3
-    py_modname = PyString_FromString(modname);
-    #else
-    py_modname = PyUnicode_FromString(modname);
-    #endif
-    if (!py_modname)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
-        goto bad;
-    #if PY_MAJOR_VERSION < 3
-    result = PyClass_New(bases, dict, name);
-    #else
-    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
-    #endif
-bad:
-    Py_XDECREF(py_modname);
-    return result;
-}
-
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-
-    tmp_type = tstate->curexc_type;
-    tmp_value = tstate->curexc_value;
-    tmp_tb = tstate->curexc_traceback;
-    tstate->curexc_type = type;
-    tstate->curexc_value = value;
-    tstate->curexc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
+    PyObject *metaclass;
+    /* Default metaclass */
+#if PY_MAJOR_VERSION < 3
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = PyObject_GetAttrString(base, "__class__");
+        if (!metaclass) {
+            PyErr_Clear();
+            metaclass = (PyObject*) Py_TYPE(base);
+        }
+    } else {
+        metaclass = (PyObject *) &PyClass_Type;
+    }
+#else
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = (PyObject*) Py_TYPE(base);
+    } else {
+        metaclass = (PyObject *) &PyType_Type;
+    }
+#endif
+    Py_INCREF(metaclass);
+    return metaclass;
 }
 
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->curexc_type;
-    *value = tstate->curexc_value;
-    *tb = tstate->curexc_traceback;
-
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-}
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *modname) {
+    PyObject *result;
+    PyObject *metaclass;
 
+    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
+        return NULL;
 
-#if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    Py_XINCREF(type);
-    Py_XINCREF(value);
-    Py_XINCREF(tb);
-    /* First, check the traceback argument, replacing None with NULL. */
-    if (tb == Py_None) {
-        Py_DECREF(tb);
-        tb = 0;
-    }
-    else if (tb != NULL && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto raise_error;
-    }
-    /* Next, replace a missing value with None */
-    if (value == NULL) {
-        value = Py_None;
-        Py_INCREF(value);
-    }
-    #if PY_VERSION_HEX < 0x02050000
-    if (!PyClass_Check(type))
-    #else
-    if (!PyType_Check(type))
-    #endif
-    {
-        /* Raising an instance.  The value should be a dummy. */
-        if (value != Py_None) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto raise_error;
-        }
-        /* Normalize to raise <class>, <instance> */
-        Py_DECREF(value);
-        value = type;
-        #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
-            Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
-        #endif
+    /* Python2 __metaclass__ */
+    metaclass = PyDict_GetItemString(dict, "__metaclass__");
+    if (metaclass) {
+        Py_INCREF(metaclass);
+    } else {
+        metaclass = __Pyx_FindPy2Metaclass(bases);
     }
-
-    __Pyx_ErrRestore(type, value, tb);
-    return;
-raise_error:
-    Py_XDECREF(value);
-    Py_XDECREF(type);
-    Py_XDECREF(tb);
-    return;
+    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
+    Py_DECREF(metaclass);
+    return result;
 }
 
-#else /* Python 3+ */
 
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
-    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;
+static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
+       __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
+    if (op == NULL)
+        return NULL;
+       op->func.m_ml = ml;
+       Py_XINCREF(self);
+       op->func.m_self = self;
+       Py_XINCREF(module);
+       op->func.m_module = module;
+       PyObject_GC_Track(op);
+       return (PyObject *)op;
+}
 
-    if (PyExceptionInstance_Check(type)) {
-        if (value) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto bad;
-        }
-        value = type;
-        type = (PyObject*) Py_TYPE(value);
-    } else if (!PyExceptionClass_Check(type)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: exception class must be a subclass of BaseException");
-        goto bad;
-    }
+static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
+       PyObject_GC_UnTrack(m);
+       Py_XDECREF(m->func.m_self);
+       Py_XDECREF(m->func.m_module);
+    PyObject_GC_Del(m);
+}
 
-    PyErr_SetObject(type, value);
+static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
+       if (obj == Py_None)
+               obj = NULL;
+       return PyMethod_New(func, obj, type);
+}
 
-    if (tb) {
-        PyThreadState *tstate = PyThreadState_GET();
-        PyObject* tmp_tb = tstate->curexc_traceback;
-        if (tb != tmp_tb) {
-            Py_INCREF(tb);
-            tstate->curexc_traceback = tb;
-            Py_XDECREF(tmp_tb);
-        }
+static int __pyx_binding_PyCFunctionType_init(void) {
+    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
+    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
+    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
+    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
+    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
+        return -1;
     }
+    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
+    return 0;
 
-bad:
-    return;
 }
-#endif
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
@@ -26061,13 +26295,13 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     if (!result)
         goto bad;
     if (!PyType_Check(result)) {
-        PyErr_Format(PyExc_TypeError, 
+        PyErr_Format(PyExc_TypeError,
             "%s.%s is not a type object",
             module_name, class_name);
         goto bad;
     }
     if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
-        PyOS_snprintf(warning, sizeof(warning), 
+        PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
         #if PY_VERSION_HEX < 0x02050000
@@ -26077,7 +26311,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         #endif
     }
     else if (((PyTypeObject *)result)->tp_basicsize != size) {
-        PyErr_Format(PyExc_ValueError, 
+        PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
         goto bad;
@@ -26112,22 +26346,23 @@ bad:
 }
 #endif
 
-static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) {
+static void* __Pyx_GetVtable(PyObject *dict) {
+    void* ptr;
     PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
     if (!ob)
         goto bad;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    *(void **)vtabptr = PyCapsule_GetPointer(ob, 0);
+    ptr = PyCapsule_GetPointer(ob, 0);
 #else
-    *(void **)vtabptr = PyCObject_AsVoidPtr(ob);
+    ptr = PyCObject_AsVoidPtr(ob);
 #endif
-    if (!*(void **)vtabptr)
-        goto bad;
+    if (!ptr && !PyErr_Occurred())
+        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
     Py_DECREF(ob);
-    return 0;
+    return ptr;
 bad:
     Py_XDECREF(ob);
-    return -1;
+    return NULL;
 }
 
 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
index c9d4543eea72bd3aa193dfff3c7c0f9f5edfac91..e0456901cf493b0f78e4e3c8f93478bab0a02383 100644 (file)
@@ -27,7 +27,9 @@ FILE * pysam_set_stderr( FILE * f )
 // taken from bam_index.c
 // The order of the following declarations is important.
 // #######################################################
+#define BAM_MAX_BIN 37450 // =(8^6-1)/7+1
 
+// initialize hashes
 typedef struct
 {
   uint64_t u, v;
@@ -35,6 +37,8 @@ typedef struct
 
 #define pair64_lt(a,b) ((a).u < (b).u)
 
+KSORT_INIT(myoff, pair64_t, pair64_lt);
+
 typedef struct {
        uint32_t m, n;
        pair64_t *list;
@@ -45,14 +49,16 @@ typedef struct {
        uint64_t *offset;
 } bam_lidx_t;
 
-KSORT_INIT(my_off, pair64_t, pair64_lt);
-KHASH_MAP_INIT_INT(my_i, bam_binlist_t);
+
+// initialize hashes ('i' and 's' are idenditifiers)
+KHASH_MAP_INIT_INT(i, bam_binlist_t);
 KHASH_MAP_INIT_STR(s, int)
 
 struct __bam_index_t
 {
   int32_t n;
-  khash_t(my_i) **index;
+  uint64_t n_no_coor; // unmapped reads without coordinate
+  khash_t(i) **index;
   bam_lidx_t *index2;
 };
 
@@ -77,7 +83,7 @@ struct __bam_plbuf_t {
        bam_pileup1_t *pu;
        int flag_mask;
 };
-
+  
 static mempool_t *mp_init()
 {
        mempool_t *mp;
@@ -187,50 +193,88 @@ typedef struct __bmc_aux_t {
        errmod_t *em;
 } bmc_aux_t;
 
-uint32_t pysam_glf_depth( glf1_t * g )
+// Return number of mapped reads on tid.
+// If tid < 0, return mapped reads without a coordinate (0)
+uint32_t pysam_get_mapped( const bam_index_t *idx, const int tid )
 {
-  return g->depth;
-}
-
 
-void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c )
-{
-  int x = 0;
-  fprintf(stderr,
-         "glf: ref_base=%i, max_mapQ=%i, min_lk=%i, depth=%i",
-         g->ref_base,
-         g->max_mapQ,
-         g->min_lk,
-         g->depth );
-
-  for (x = 0; x < 10; ++x) 
-    fprintf(stderr, ", lk%x=%i, ", x, g->lk[x]);
-
-  fprintf(stderr,
-         "maqcns: het_rate=%f, theta=%f, n_hap=%i, cap_mapQ=%i, errmod=%i, min_baseQ=%i, eta=%f, q_r=%f, aux_max=%i",
-         c->het_rate,
-         c->theta,
-         c->n_hap,
-         c->cap_mapQ,
-         c->errmod,
-         c->min_baseQ,
-         c->eta,
-         c->q_r,
-         c->aux->max);
-  
-  for (x = 0; x < c->aux->max; ++x)
+  if (tid >= 0)
     {
-      fprintf(stderr, ", info-%i=%i ", x, c->aux->info[x]);
-      if (c->aux->info[x] == 0) break;
+      khint_t k;
+      khash_t(i) *h = idx->index[tid];
+      k = kh_get(i, h, BAM_MAX_BIN);
+
+      if (k != kh_end(h))
+       return kh_val(h, k).list[1].u;
+      else
+       return 0;
     }
-  
-  for (x = 0; x < c->aux->max; ++x)
+
+  return 0;
+}
+
+uint32_t pysam_get_unmapped( const bam_index_t *idx, const int tid )
+{
+
+  if (tid >= 0)
     {
-      fprintf(stderr, ", info16-%i=%i ", x, c->aux->info16[x]);
-      if (c->aux->info16[x] == 0) break;
+      khint_t k;
+      khash_t(i) *h = idx->index[tid];
+      k = kh_get(i, h, BAM_MAX_BIN);
+
+      if (k != kh_end(h))
+       return kh_val(h, k).list[1].v;
+      else
+       return 0;
     }
+
+  return idx->n_no_coor;
 }
 
+/* uint32_t pysam_glf_depth( glf1_t * g ) */
+/* { */
+/*   return g->depth; */
+/* } */
+
+
+/* void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c ) */
+/* { */
+/*   int x = 0; */
+/*   fprintf(stderr, */
+/*       "glf: ref_base=%i, max_mapQ=%i, min_lk=%i, depth=%i", */
+/*       g->ref_base, */
+/*       g->max_mapQ, */
+/*       g->min_lk, */
+/*       g->depth ); */
+
+/*   for (x = 0; x < 10; ++x)  */
+/*     fprintf(stderr, ", lk%x=%i, ", x, g->lk[x]); */
+
+/*   fprintf(stderr, */
+/*       "maqcns: het_rate=%f, theta=%f, n_hap=%i, cap_mapQ=%i, errmod=%i, min_baseQ=%i, eta=%f, q_r=%f, aux_max=%i", */
+/*       c->het_rate, */
+/*       c->theta, */
+/*       c->n_hap, */
+/*       c->cap_mapQ, */
+/*       c->errmod, */
+/*       c->min_baseQ, */
+/*       c->eta, */
+/*       c->q_r, */
+/*       c->aux->max); */
+  
+/*   for (x = 0; x < c->aux->max; ++x) */
+/*     { */
+/*       fprintf(stderr, ", info-%i=%i ", x, c->aux->info[x]); */
+/*       if (c->aux->info[x] == 0) break; */
+/*     } */
+  
+/*   for (x = 0; x < c->aux->max; ++x) */
+/*     { */
+/*       fprintf(stderr, ", info16-%i=%i ", x, c->aux->info16[x]); */
+/*       if (c->aux->info16[x] == 0) break; */
+/*     } */
+/* } */
+
 
   
 
@@ -238,18 +282,26 @@ void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c )
 // command line within python.
 // taken from the main function in bamtk.c
 // added code to reset getopt
-extern int main_samview(int argc, char *argv[]);
-extern int main_import(int argc, char *argv[]);
-extern int bam_pileup(int argc, char *argv[]);
-extern int bam_merge(int argc, char *argv[]);
-extern int bam_sort(int argc, char *argv[]);
-extern int bam_index(int argc, char *argv[]);
-extern int faidx_main(int argc, char *argv[]);
-extern int bam_mating(int argc, char *argv[]);
-extern int bam_rmdup(int argc, char *argv[]);
-extern int glf3_view_main(int argc, char *argv[]);
-extern int bam_flagstat(int argc, char *argv[]);
-extern int bam_fillmd(int argc, char *argv[]);
+int bam_taf2baf(int argc, char *argv[]);
+int bam_mpileup(int argc, char *argv[]);
+int bam_merge(int argc, char *argv[]);
+int bam_index(int argc, char *argv[]);
+int bam_sort(int argc, char *argv[]);
+int bam_tview_main(int argc, char *argv[]);
+int bam_mating(int argc, char *argv[]);
+int bam_rmdup(int argc, char *argv[]);
+int bam_flagstat(int argc, char *argv[]);
+int bam_fillmd(int argc, char *argv[]);
+int bam_idxstats(int argc, char *argv[]);
+int main_samview(int argc, char *argv[]);
+int main_import(int argc, char *argv[]);
+int main_reheader(int argc, char *argv[]);
+int main_cut_target(int argc, char *argv[]);
+int main_phase(int argc, char *argv[]);
+int main_cat(int argc, char *argv[]);
+int main_depth(int argc, char *argv[]);
+int main_bam2fq(int argc, char *argv[]);
+int faidx_main(int argc, char *argv[]);
 
 int pysam_dispatch(int argc, char *argv[] )
 {
@@ -262,25 +314,31 @@ int pysam_dispatch(int argc, char *argv[] )
 #endif
 #endif
   
-  // reset getop
+  // reset getopt
   optind = 1;
 
   if (argc < 2) return 1;
 
   if (strcmp(argv[1], "view") == 0) return main_samview(argc-1, argv+1);
   else if (strcmp(argv[1], "import") == 0) return main_import(argc-1, argv+1);
-  else if (strcmp(argv[1], "pileup") == 0) return bam_pileup(argc-1, argv+1);
+  else if (strcmp(argv[1], "mpileup") == 0) return bam_mpileup(argc-1, argv+1);
   else if (strcmp(argv[1], "merge") == 0) return bam_merge(argc-1, argv+1);
   else if (strcmp(argv[1], "sort") == 0) return bam_sort(argc-1, argv+1);
-  else if (strcmp(argv[1], "index") == 0) return bam_index(argc-1, argv+1); 
+  else if (strcmp(argv[1], "index") == 0) return bam_index(argc-1, argv+1);
   else if (strcmp(argv[1], "faidx") == 0) return faidx_main(argc-1, argv+1);
+  else if (strcmp(argv[1], "idxstats") == 0) return bam_idxstats(argc-1, argv+1);
   else if (strcmp(argv[1], "fixmate") == 0) return bam_mating(argc-1, argv+1);
   else if (strcmp(argv[1], "rmdup") == 0) return bam_rmdup(argc-1, argv+1);
-  else if (strcmp(argv[1], "glfview") == 0) return glf3_view_main(argc-1, argv+1);
   else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1);
   else if (strcmp(argv[1], "calmd") == 0) return bam_fillmd(argc-1, argv+1);
   else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1);
-
+  else if (strcmp(argv[1], "reheader") == 0) return main_reheader(argc-1, argv+1);
+  else if (strcmp(argv[1], "cat") == 0) return main_cat(argc-1, argv+1);
+  else if (strcmp(argv[1], "targetcut") == 0) return main_cut_target(argc-1, argv+1);
+  else if (strcmp(argv[1], "phase") == 0) return main_phase(argc-1, argv+1);
+  else if (strcmp(argv[1], "depth") == 0) return main_depth(argc-1, argv+1);
+  else if (strcmp(argv[1], "bam2fq") == 0) return main_bam2fq(argc-1, argv+1);
+  
 #if _CURSES_LIB != 0
   else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1);
 #endif
index 89e381bbd8fee3762d56a1d7dad14b9c44f6b8a2..c6184eb756cca0241dc06449b829f4198ebef02a 100644 (file)
@@ -48,12 +48,18 @@ extern unsigned char bam_nt16_table[256];
 // translate a reference string *s* to a tid
 int pysam_reference2tid( bam_header_t *header, const char * s );
 
+// return number of mapped reads for tid
+uint32_t pysam_get_mapped( const bam_index_t *idx, const int tid );
+
+// return number of unmapped reads for tid
+uint32_t pysam_get_unmapped( const bam_index_t *idx, const int tid );
+
 // debugging functions
-#include "glf.h"
-uint32_t pysam_glf_depth( glf1_t * g);
+/* #include "glf.h" */
+/* uint32_t pysam_glf_depth( glf1_t * g); */
 
-#include "bam_maqcns.h"
-void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c );
+/* #include "bam_maqcns.h" */
+/* void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c ); */
 
 
 #endif
index 34937f454fc74fddbb2e45de4b851ebac731a3d1..c0ce4ad44e13a632f96e4c72a2ee7a5b3a951776 100644 (file)
@@ -1,7 +1,7 @@
 # pysam versioning information
 
-__version__ = "0.5"
+__version__ = "0.6"
 
-__samtools_version__ = "0.1.16"
+__samtools_version__ = "0.1.18"
 
 __tabix_version__ = "0.2.5"
index 28cdbd74b0d751246c6726f5f88a1499eb87a30f..ad263395de51eb3b38d56ffdcd9041a8dac1864e 100644 (file)
@@ -34,7 +34,7 @@ int32_t bam_cigar2qlen(const bam1_core_t *c, const uint32_t *cigar)
        int32_t l = 0;
        for (k = 0; k < c->n_cigar; ++k) {
                int op = cigar[k] & BAM_CIGAR_MASK;
-               if (op == BAM_CMATCH || op == BAM_CINS || op == BAM_CSOFT_CLIP)
+               if (op == BAM_CMATCH || op == BAM_CINS || op == BAM_CSOFT_CLIP || op == BAM_CEQUAL || op == BAM_CDIFF)
                        l += cigar[k] >> BAM_CIGAR_SHIFT;
        }
        return l;
@@ -270,7 +270,7 @@ char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of)
        else {
                for (i = 0; i < c->n_cigar; ++i) {
                        kputw(bam1_cigar(b)[i]>>BAM_CIGAR_SHIFT, &str);
-                       kputc("MIDNSHP"[bam1_cigar(b)[i]&BAM_CIGAR_MASK], &str);
+                       kputc("MIDNSHP=X"[bam1_cigar(b)[i]&BAM_CIGAR_MASK], &str);
                }
        }
        kputc('\t', &str);
index e7360bb8ef2fc2ff245a716ccfaf22d827ed3f96..346c750c8c807c44ea32804eeb1bb93411d0b71a 100644 (file)
@@ -40,7 +40,7 @@
   @copyright Genome Research Ltd.
  */
 
-#define BAM_VERSION "0.1.16 (r963:234)"
+#define BAM_VERSION "0.1.18 (r982:295)"
 
 #include <stdint.h>
 #include <stdlib.h>
@@ -134,20 +134,25 @@ typedef struct {
 /*
   CIGAR operations.
  */
-/*! @abstract CIGAR: match */
+/*! @abstract CIGAR: M = match or mismatch*/
 #define BAM_CMATCH      0
-/*! @abstract CIGAR: insertion to the reference */
+/*! @abstract CIGAR: I = insertion to the reference */
 #define BAM_CINS        1
-/*! @abstract CIGAR: deletion from the reference */
+/*! @abstract CIGAR: D = deletion from the reference */
 #define BAM_CDEL        2
-/*! @abstract CIGAR: skip on the reference (e.g. spliced alignment) */
+/*! @abstract CIGAR: N = skip on the reference (e.g. spliced alignment) */
 #define BAM_CREF_SKIP   3
-/*! @abstract CIGAR: clip on the read with clipped sequence present in qseq */
+/*! @abstract CIGAR: S = clip on the read with clipped sequence
+  present in qseq */
 #define BAM_CSOFT_CLIP  4
-/*! @abstract CIGAR: clip on the read with clipped sequence trimmed off */
+/*! @abstract CIGAR: H = clip on the read with clipped sequence trimmed off */
 #define BAM_CHARD_CLIP  5
-/*! @abstract CIGAR: padding */
+/*! @abstract CIGAR: P = padding */
 #define BAM_CPAD        6
+/*! @abstract CIGAR: equals = match */
+#define BAM_CEQUAL        7
+/*! @abstract CIGAR: X = mismatch */
+#define BAM_CDIFF        8
 
 /*! @typedef
   @abstract Structure for core alignment information.
index 06f85998d432012ac9baa56fa2f8ded3ae68ec5e..ece837ae71089cb2640d5401143a449d5eae5fed 100644 (file)
@@ -41,6 +41,7 @@ void bcf_call_destroy(bcf_callaux_t *bca)
  * negative if we are looking at an indel. */
 int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r)
 {
+    static int *var_pos = NULL, nvar_pos = 0;
        int i, n, ref4, is_indel, ori_depth = 0;
        memset(r, 0, sizeof(bcf_callret1_t));
        if (ref_base >= 0) {
@@ -96,9 +97,92 @@ int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t
        r->depth = n; r->ori_depth = ori_depth;
        // glfgen
        errmod_cal(bca->e, n, 5, bca->bases, r->p);
+
+    // Calculate the Variant Distance Bias (make it optional?)
+    if ( nvar_pos < _n ) {
+        nvar_pos = _n;
+        var_pos = realloc(var_pos,sizeof(int)*nvar_pos);
+    }
+    int alt_dp=0, read_len=0;
+    for (i=0; i<_n; i++) {
+        const bam_pileup1_t *p = pl + i;
+        if ( bam1_seqi(bam1_seq(p->b),p->qpos) == ref_base ) 
+            continue;
+
+        var_pos[alt_dp] = p->qpos;
+        if ( (bam1_cigar(p->b)[0]&BAM_CIGAR_MASK)==4 )
+            var_pos[alt_dp] -= bam1_cigar(p->b)[0]>>BAM_CIGAR_SHIFT;
+
+        alt_dp++;
+        read_len += p->b->core.l_qseq;
+    }
+    float mvd=0;
+    int j;
+    n=0;
+    for (i=0; i<alt_dp; i++) {
+        for (j=0; j<i; j++) {
+            mvd += abs(var_pos[i] - var_pos[j]);
+            n++;
+        }
+    }
+    r->mvd[0] = n ? mvd/n : 0;
+    r->mvd[1] = alt_dp;
+    r->mvd[2] = alt_dp ? read_len/alt_dp : 0;
+
        return r->depth;
 }
 
+
+void calc_vdb(int n, const bcf_callret1_t *calls, bcf_call_t *call)
+{
+    // Variant distance bias. Samples merged by means of DP-weighted average.
+
+    float weight=0, tot_prob=0;
+
+    int i;
+    for (i=0; i<n; i++)
+    {
+        int mvd      = calls[i].mvd[0];
+        int dp       = calls[i].mvd[1];
+        int read_len = calls[i].mvd[2];
+
+        if ( dp<2 ) continue;
+
+        float prob = 0;
+        if ( dp==2 )
+        {
+            // Exact formula
+            prob = (mvd==0) ? 1.0/read_len : (read_len-mvd)*2.0/read_len/read_len;
+        }
+        else if ( dp==3 )
+        {
+            // Sin, quite accurate approximation
+            float mu = read_len/2.9;
+            prob = mvd>2*mu ? 0 : sin(mvd*3.14/2/mu) / (4*mu/3.14);
+        }
+        else
+        {
+            // Scaled gaussian curve, crude approximation, but behaves well. Using fixed depth for bigger depths.
+            if ( dp>5 )
+                dp = 5;
+            float sigma2 = (read_len/1.9/(dp+1)) * (read_len/1.9/(dp+1));
+            float norm   = 1.125*sqrt(2*3.14*sigma2);
+            float mu     = read_len/2.9;
+            if ( mvd < mu )
+                prob = exp(-(mvd-mu)*(mvd-mu)/2/sigma2)/norm;
+            else
+                prob = exp(-(mvd-mu)*(mvd-mu)/3.125/sigma2)/norm;
+        }
+
+        //fprintf(pysamerr,"dp=%d mvd=%d read_len=%d -> prob=%f\n", dp,mvd,read_len,prob);
+        tot_prob += prob*dp;
+        weight += dp;
+    }
+    tot_prob = weight ? tot_prob/weight : 1; 
+    //fprintf(pysamerr,"prob=%f\n", tot_prob);
+    call->vdb = tot_prob;
+}
+
 int bcf_call_combine(int n, const bcf_callret1_t *calls, int ref_base /*4-bit*/, bcf_call_t *call)
 {
        int ref4, i, j, qsum[4];
@@ -172,6 +256,9 @@ int bcf_call_combine(int n, const bcf_callret1_t *calls, int ref_base /*4-bit*/,
                call->ori_depth += calls[i].ori_depth;
                for (j = 0; j < 16; ++j) call->anno[j] += calls[i].anno[j];
        }
+
+    calc_vdb(n, calls, call);
+
        return 0;
 }
 
@@ -225,6 +312,10 @@ int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bc
                if (i) kputc(',', &s);
                kputw(bc->anno[i], &s);
        }
+    if ( bc->vdb!=1 )
+    {
+        ksprintf(&s, ";VDB=%.4f", bc->vdb);
+    }
        kputc('\0', &s);
        // FMT
        kputs("PL", &s);
@@ -238,7 +329,7 @@ int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bc
        memcpy(b->gi[0].data, bc->PL, b->gi[0].len * bc->n);
        if (bcr) {
                uint16_t *dp = (uint16_t*)b->gi[1].data;
-               uint8_t *sp = is_SP? b->gi[2].data : 0;
+               int32_t *sp = is_SP? b->gi[2].data : 0;
                for (i = 0; i < bc->n; ++i) {
                        bcf_callret1_t *p = bcr + i;
                        dp[i] = p->depth < 0xffff? p->depth : 0xffff;
index 958567241936a4c54feae501c725ad77a6e3f1be..4af080c4753b2070192bec5e04e16174ca5bb5f8 100644 (file)
@@ -26,6 +26,7 @@ typedef struct {
        int depth, ori_depth, qsum[4];
        int anno[16];
        float p[25];
+    int mvd[3]; // mean variant distance, number of variant reads, average read length
 } bcf_callret1_t;
 
 typedef struct {
@@ -33,6 +34,7 @@ typedef struct {
        int n, n_alleles, shift, ori_ref, unseen;
        int anno[16], depth, ori_depth;
        uint8_t *PL;
+    float vdb; // variant distance bias
 } bcf_call_t;
 
 #ifdef __cplusplus
index b72864845374b07be7d9c0fb1ffb3ecd4c91b7cb..cf86ca3e39f6aad8c222ed8048fcc56f78fff62c 100644 (file)
@@ -5,12 +5,14 @@
 #include <string.h>
 #include "bam.h"
 #include "bam2bcf.h"
-#include "ksort.h"
 #include "kaln.h"
 #include "kprobaln.h"
 #include "khash.h"
 KHASH_SET_INIT_STR(rg)
 
+#include "ksort.h"
+KSORT_INIT_GENERIC(uint32_t)
+
 #define MINUS_CONST 0x10000000
 #define INDEL_WINDOW_SIZE 50
 
@@ -66,7 +68,7 @@ static int tpos2qpos(const bam1_core_t *c, const uint32_t *cigar, int32_t tpos,
        for (k = 0; k < c->n_cigar; ++k) {
                int op = cigar[k] & BAM_CIGAR_MASK;
                int l = cigar[k] >> BAM_CIGAR_SHIFT;
-               if (op == BAM_CMATCH) {
+               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                        if (c->pos > tpos) return y;
                        if (x + l > tpos) {
                                *_tpos = tpos;
@@ -112,7 +114,6 @@ static inline int est_indelreg(int pos, const char *ref, int l, char *ins4)
 int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref,
                                          const void *rghash)
 {
-       extern void ks_introsort_uint32_t(int, uint32_t*);
        int i, s, j, k, t, n_types, *types, max_rd_len, left, right, max_ins, *score1, *score2, max_ref2;
        int N, K, l_run, ref_type, n_alt;
        char *inscns = 0, *ref2, *query, **ref_sample;
@@ -169,6 +170,12 @@ int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_calla
                if (n_types == 1 || (double)n_alt / n_tot < bca->min_frac || n_alt < bca->min_support) { // then skip
                        free(aux); return -1;
                }
+               if (n_types >= 64) {
+                       free(aux);
+                       if (bam_verbose >= 2) 
+                               fprintf(pysamerr, "[%s] excessive INDEL alleles at position %d. Skip the position.\n", __func__, pos + 1);
+                       return -1;
+               }
                types = (int*)calloc(n_types, sizeof(int));
                t = 0;
                types[t++] = aux[0] - MINUS_CONST; 
@@ -179,7 +186,6 @@ int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_calla
                for (t = 0; t < n_types; ++t)
                        if (types[t] == 0) break;
                ref_type = t; // the index of the reference type (0)
-               assert(n_types < 64);
        }
        { // calculate left and right boundary
                left = pos > INDEL_WINDOW_SIZE? pos - INDEL_WINDOW_SIZE : 0;
@@ -218,7 +224,7 @@ int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_calla
                                for (k = 0; k < b->core.n_cigar; ++k) {
                                        int op = cigar[k]&0xf;
                                        int j, l = cigar[k]>>4;
-                                       if (op == BAM_CMATCH) {
+                                       if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                                                for (j = 0; j < l; ++j)
                                                        if (x + j >= left && x + j < right)
                                                                cns[x+j-left] += (bam1_seqi(seq, y+j) == ref0[x+j-left])? 1 : 0x10000;
index a1c1890e26eb85ebb2f3b53bb554aa64119a4652..14209cd831d0268150e5e6a62052ae264e9a3939 100644 (file)
@@ -61,6 +61,23 @@ int bam_aux_del(bam1_t *b, uint8_t *s)
        return 0;
 }
 
+int bam_aux_drop_other(bam1_t *b, uint8_t *s)
+{
+       if (s) {
+               uint8_t *p, *aux;
+               aux = bam1_aux(b);
+               p = s - 2;
+               __skip_tag(s);
+               memmove(aux, p, s - p);
+               b->data_len -= b->l_aux - (s - p);
+               b->l_aux = s - p;
+       } else {
+               b->data_len -= b->l_aux;
+               b->l_aux = 0;
+       }
+       return 0;
+}
+
 void bam_init_header_hash(bam_header_t *header)
 {
        if (header->hash == 0) {
@@ -89,47 +106,56 @@ int32_t bam_get_tid(const bam_header_t *header, const char *seq_name)
        return k == kh_end(h)? -1 : kh_value(h, k);
 }
 
-int bam_parse_region(bam_header_t *header, const char *str, int *ref_id, int *begin, int *end)
+int bam_parse_region(bam_header_t *header, const char *str, int *ref_id, int *beg, int *end)
 {
-       char *s, *p;
-       int i, l, k;
+       char *s;
+       int i, l, k, name_end;
        khiter_t iter;
        khash_t(s) *h;
 
        bam_init_header_hash(header);
        h = (khash_t(s)*)header->hash;
 
-       l = strlen(str);
-       p = s = (char*)malloc(l+1);
-       /* squeeze out "," */
-       for (i = k = 0; i != l; ++i)
-               if (str[i] != ',' && !isspace(str[i])) s[k++] = str[i];
-       s[k] = 0;
-       for (i = 0; i != k; ++i) if (s[i] == ':') break;
-       s[i] = 0;
-       iter = kh_get(s, h, s); /* get the ref_id */
-       if (iter == kh_end(h)) { // name not found
-               *ref_id = -1; free(s);
-               return -1;
-       }
-       *ref_id = kh_value(h, iter);
-       if (i == k) { /* dump the whole sequence */
-               *begin = 0; *end = 1<<29; free(s);
-               return 0;
-       }
-       for (p = s + i + 1; i != k; ++i) if (s[i] == '-') break;
-       *begin = atoi(p);
-       if (i < k) {
-               p = s + i + 1;
-               *end = atoi(p);
-       } else *end = 1<<29;
-       if (*begin > 0) --*begin;
+       *ref_id = *beg = *end = -1;
+       name_end = l = strlen(str);
+       s = (char*)malloc(l+1);
+       // remove space
+       for (i = k = 0; i < l; ++i)
+               if (!isspace(str[i])) s[k++] = str[i];
+       s[k] = 0; l = k;
+       // determine the sequence name
+       for (i = l - 1; i >= 0; --i) if (s[i] == ':') break; // look for colon from the end
+       if (i >= 0) name_end = i;
+       if (name_end < l) { // check if this is really the end
+               int n_hyphen = 0;
+               for (i = name_end + 1; i < l; ++i) {
+                       if (s[i] == '-') ++n_hyphen;
+                       else if (!isdigit(s[i]) && s[i] != ',') break;
+               }
+               if (i < l || n_hyphen > 1) name_end = l; // malformated region string; then take str as the name
+               s[name_end] = 0;
+               iter = kh_get(s, h, s);
+               if (iter == kh_end(h)) { // cannot find the sequence name
+                       iter = kh_get(s, h, str); // try str as the name
+                       if (iter == kh_end(h)) {
+                               if (bam_verbose >= 2) fprintf(pysamerr, "[%s] fail to determine the sequence name.\n", __func__);
+                               free(s); return -1;
+                       } else s[name_end] = ':', name_end = l;
+               }
+       } else iter = kh_get(s, h, str);
+       *ref_id = kh_val(h, iter);
+       // parse the interval
+       if (name_end < l) {
+               for (i = k = name_end + 1; i < l; ++i)
+                       if (s[i] != ',') s[k++] = s[i];
+               s[k] = 0;
+               *beg = atoi(s + name_end + 1);
+               for (i = name_end + 1; i != k; ++i) if (s[i] == '-') break;
+               *end = i < k? atoi(s + i + 1) : 1<<29;
+               if (*beg > 0) --*beg;
+       } else *beg = 0, *end = 1<<29;
        free(s);
-       if (*begin > *end) {
-               fprintf(pysamerr, "[bam_parse_region] invalid region.\n");
-               return -1;
-       }
-       return 0;
+       return *beg <= *end? 0 : -1;
 }
 
 int32_t bam_aux2i(const uint8_t *s)
index da25f036504eb75f2617ea0d837f3f3df73c796d..36a8024c286a71b7b0bfc3eeecb91645b97befb1 100644 (file)
@@ -16,7 +16,7 @@
 #include "kseq.h"
 #include "khash.h"
 
-KSTREAM_INIT(gzFile, gzread, 8192)
+KSTREAM_INIT(gzFile, gzread, 16384)
 KHASH_MAP_INIT_STR(ref, uint64_t)
 
 void bam_init_header_hash(bam_header_t *header);
@@ -294,20 +294,22 @@ int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b)
                z += str->l + 1;
                if (str->s[0] != '*') {
                        for (s = str->s; *s; ++s) {
-                               if (isalpha(*s)) ++c->n_cigar;
+                               if ((isalpha(*s)) || (*s=='=')) ++c->n_cigar;
                                else if (!isdigit(*s)) parse_error(fp->n_lines, "invalid CIGAR character");
                        }
                        b->data = alloc_data(b, doff + c->n_cigar * 4);
                        for (i = 0, s = str->s; i != c->n_cigar; ++i) {
                                x = strtol(s, &t, 10);
                                op = toupper(*t);
-                               if (op == 'M' || op == '=' || op == 'X') op = BAM_CMATCH;
+                               if (op == 'M') op = BAM_CMATCH;
                                else if (op == 'I') op = BAM_CINS;
                                else if (op == 'D') op = BAM_CDEL;
                                else if (op == 'N') op = BAM_CREF_SKIP;
                                else if (op == 'S') op = BAM_CSOFT_CLIP;
                                else if (op == 'H') op = BAM_CHARD_CLIP;
                                else if (op == 'P') op = BAM_CPAD;
+                               else if (op == '=') op = BAM_CEQUAL;
+                               else if (op == 'X') op = BAM_CDIFF;
                                else parse_error(fp->n_lines, "invalid CIGAR operation");
                                s = t + 1;
                                bam1_cigar(b)[i] = x << BAM_CIGAR_SHIFT | op;
@@ -339,8 +341,11 @@ int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b)
                z += str->l + 1;
                if (strcmp(str->s, "*")) {
                        c->l_qseq = strlen(str->s);
-                       if (c->n_cigar && c->l_qseq != (int32_t)bam_cigar2qlen(c, bam1_cigar(b)))
-                               parse_error(fp->n_lines, "CIGAR and sequence length are inconsistent");
+                       if (c->n_cigar && c->l_qseq != (int32_t)bam_cigar2qlen(c, bam1_cigar(b))) {
+                         fprintf(pysamerr, "Line %ld, sequence length %i vs %i from CIGAR\n",
+                                 (long)fp->n_lines, c->l_qseq, (int32_t)bam_cigar2qlen(c, bam1_cigar(b)));
+                         parse_error(fp->n_lines, "CIGAR and sequence length are inconsistent");
+                       }
                        p = (uint8_t*)alloc_data(b, doff + c->l_qseq + (c->l_qseq+1)/2) + doff;
                        memset(p, 0, (c->l_qseq+1)/2);
                        for (i = 0; i < c->l_qseq; ++i)
@@ -447,7 +452,7 @@ int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b)
                                else if (str->s[5] == 'S') while (p < str->s + str->l) ((uint16_t*)s)[k++] = (uint16_t)strtol(p, &p, 0), ++p;
                                else if (str->s[5] == 'i') while (p < str->s + str->l) ((int32_t*)s)[k++]  = (int32_t)strtol(p, &p, 0),  ++p;
                                else if (str->s[5] == 'I') while (p < str->s + str->l) ((uint32_t*)s)[k++] = (uint32_t)strtol(p, &p, 0), ++p;
-                               else if (str->s[5] == 'f') while (p < str->s + str->l) ((float*)s)[k++]    = (float)strtof(p, &p),       ++p;
+                               else if (str->s[5] == 'f') while (p < str->s + str->l) ((float*)s)[k++]    = (float)strtod(p, &p),       ++p;
                                else parse_error(fp->n_lines, "unrecognized array type");
                                s += Bsize * n; doff += size;
                        } else parse_error(fp->n_lines, "unrecognized type");
index e6c90bdc2d23cb47466e3ed103f820fa92a11356..6ae2ac36dc018ed906318b8861f6f5e7e15fcb6d 100644 (file)
@@ -174,19 +174,23 @@ bam_index_t *bam_index_core(bamFile fp)
 
        save_bin = save_tid = last_tid = last_bin = 0xffffffffu;
        save_off = last_off = bam_tell(fp); last_coor = 0xffffffffu;
-    n_mapped = n_unmapped = n_no_coor = off_end = 0;
+       n_mapped = n_unmapped = n_no_coor = off_end = 0;
        off_beg = off_end = bam_tell(fp);
        while ((ret = bam_read1(fp, b)) >= 0) {
                if (c->tid < 0) ++n_no_coor;
-               if (last_tid != c->tid) { // change of chromosomes
+               if (last_tid < c->tid || (last_tid >= 0 && c->tid < 0)) { // change of chromosomes
                        last_tid = c->tid;
                        last_bin = 0xffffffffu;
-               } else if (last_coor > c->pos) {
+               } else if ((uint32_t)last_tid > (uint32_t)c->tid) {
+                       fprintf(pysamerr, "[bam_index_core] the alignment is not sorted (%s): %d-th chr > %d-th chr\n",
+                                       bam1_qname(b), last_tid+1, c->tid+1);
+                       return NULL;
+               } else if ((int32_t)c->tid >= 0 && last_coor > c->pos) {
                        fprintf(pysamerr, "[bam_index_core] the alignment is not sorted (%s): %u > %u in %d-th chr\n",
                                        bam1_qname(b), last_coor, c->pos, c->tid+1);
-                       exit(1);
+                       return NULL;
                }
-               if (c->tid >= 0) insert_offset2(&idx->index2[b->core.tid], b, last_off);
+               if (c->tid >= 0 && !(c->flag & BAM_FUNMAP)) insert_offset2(&idx->index2[b->core.tid], b, last_off);
                if (c->bin != last_bin) { // then possibly write the binning index
                        if (save_bin != 0xffffffffu) // save_bin==0xffffffffu only happens to the first record
                                insert_offset(idx->index[save_tid], save_bin, save_off, last_off);
@@ -205,7 +209,7 @@ bam_index_t *bam_index_core(bamFile fp)
                if (bam_tell(fp) <= last_off) {
                        fprintf(pysamerr, "[bam_index_core] bug in BGZF/RAZF: %llx < %llx\n",
                                        (unsigned long long)bam_tell(fp), (unsigned long long)last_off);
-                       exit(1);
+                       return NULL;
                }
                if (c->flag & BAM_FUNMAP) ++n_unmapped;
                else ++n_mapped;
@@ -224,7 +228,7 @@ bam_index_t *bam_index_core(bamFile fp)
                        ++n_no_coor;
                        if (c->tid >= 0 && n_no_coor) {
                                fprintf(pysamerr, "[bam_index_core] the alignment is not sorted: reads without coordinates prior to reads with coordinates.\n");
-                               exit(1);
+                               return NULL;
                        }
                }
        }
@@ -475,6 +479,10 @@ int bam_index_build2(const char *fn, const char *_fnidx)
        }
        idx = bam_index_core(fp);
        bam_close(fp);
+       if(idx == 0) {
+               fprintf(pysamerr, "[bam_index_build2] fail to index the BAM file.\n");
+               return -1;
+       }
        if (_fnidx == 0) {
                fnidx = (char*)calloc(strlen(fn) + 5, 1);
                strcpy(fnidx, fn); strcat(fnidx, ".bai");
diff --git a/samtools/bam_maqcns.c.pysam.c b/samtools/bam_maqcns.c.pysam.c
deleted file mode 100644 (file)
index 513a251..0000000
+++ /dev/null
@@ -1,628 +0,0 @@
-#include "pysam.h"
-
-#include <math.h>
-#include <assert.h>
-#include "bam.h"
-#include "bam_maqcns.h"
-#include "ksort.h"
-#include "errmod.h"
-#include "kaln.h"
-KSORT_INIT_GENERIC(uint32_t)
-
-#define INDEL_WINDOW_SIZE 50
-#define INDEL_EXT_DEP 0.9
-
-typedef struct __bmc_aux_t {
-       int max;
-       uint32_t *info;
-       uint16_t *info16;
-       errmod_t *em;
-} bmc_aux_t;
-
-typedef struct {
-       float esum[4], fsum[4];
-       uint32_t c[4];
-} glf_call_aux_t;
-
-/*
-  P(<b1,b2>) = \theta \sum_{i=1}^{N-1} 1/i
-  P(D|<b1,b2>) = \sum_{k=1}^{N-1} p_k 1/2 [(k/N)^n_2(1-k/N)^n_1 + (k/N)^n1(1-k/N)^n_2]
-  p_k = 1/k / \sum_{i=1}^{N-1} 1/i
- */
-static void cal_het(bam_maqcns_t *aa)
-{
-       int k, n1, n2;
-       double sum_harmo; // harmonic sum
-       double poly_rate;
-
-       free(aa->lhet);
-       aa->lhet = (double*)calloc(256 * 256, sizeof(double));
-       sum_harmo = 0.0;
-       for (k = 1; k <= aa->n_hap - 1; ++k)
-               sum_harmo += 1.0 / k;
-       for (n1 = 0; n1 < 256; ++n1) {
-               for (n2 = 0; n2 < 256; ++n2) {
-                       long double sum = 0.0;
-                       double lC = aa->errmod == BAM_ERRMOD_SOAP? 0 : lgamma(n1+n2+1) - lgamma(n1+1) - lgamma(n2+1);
-                       for (k = 1; k <= aa->n_hap - 1; ++k) {
-                               double pk = 1.0 / k / sum_harmo;
-                               double log1 = log((double)k/aa->n_hap);
-                               double log2 = log(1.0 - (double)k/aa->n_hap);
-                               sum += pk * 0.5 * (expl(log1*n2) * expl(log2*n1) + expl(log1*n1) * expl(log2*n2));
-                       }
-                       aa->lhet[n1<<8|n2] = lC + logl(sum);
-               }
-       }
-       poly_rate = aa->het_rate * sum_harmo;
-       aa->q_r = -4.343 * log(2.0 * poly_rate / (1.0 - poly_rate));
-}
-
-/** initialize the helper structure */
-static void cal_coef(bam_maqcns_t *aa)
-{
-       int k, n, q;
-       long double sum_a[257], b[256], q_c[256], tmp[256], fk2[256];
-       double *lC;
-
-       if (aa->errmod == BAM_ERRMOD_MAQ2) return; // no need to do the following
-       // aa->lhet will be allocated and initialized 
-       free(aa->fk); free(aa->coef);
-       aa->coef = 0;
-       aa->fk = (double*)calloc(256, sizeof(double));
-       aa->fk[0] = fk2[0] = 1.0;
-       for (n = 1; n != 256; ++n) {
-               aa->fk[n] = pow(aa->theta, n) * (1.0 - aa->eta) + aa->eta;
-               fk2[n] = aa->fk[n>>1]; // this is an approximation, assuming reads equally likely come from both strands
-       }
-       if (aa->errmod == BAM_ERRMOD_SOAP) return;
-       aa->coef = (double*)calloc(256*256*64, sizeof(double));
-       lC = (double*)calloc(256 * 256, sizeof(double));
-       for (n = 1; n != 256; ++n)
-               for (k = 1; k <= n; ++k)
-                       lC[n<<8|k] = lgamma(n+1) - lgamma(k+1) - lgamma(n-k+1);
-       for (q = 1; q != 64; ++q) {
-               double e = pow(10.0, -q/10.0);
-               double le = log(e);
-               double le1 = log(1.0-e);
-               for (n = 1; n != 256; ++n) {
-                       double *coef = aa->coef + (q<<16|n<<8);
-                       sum_a[n+1] = 0.0;
-                       for (k = n; k >= 0; --k) { // a_k = \sum_{i=k}^n C^n_k \epsilon^k (1-\epsilon)^{n-k}
-                               sum_a[k] = sum_a[k+1] + expl(lC[n<<8|k] + k*le + (n-k)*le1);
-                               b[k] = sum_a[k+1] / sum_a[k];
-                               if (b[k] > 0.99) b[k] = 0.99;
-                       }
-                       for (k = 0; k != n; ++k) // log(\bar\beta_{nk}(\bar\epsilon)^{f_k})
-                               q_c[k] = -4.343 * fk2[k] * logl(b[k] / e);
-                       for (k = 1; k != n; ++k) q_c[k] += q_c[k-1]; // \prod_{i=0}^k c_i
-                       for (k = 0; k <= n; ++k) { // powl() in 64-bit mode seems broken on my Mac OS X 10.4.9
-                               tmp[k] = -4.343 * logl(1.0 - expl(fk2[k] * logl(b[k])));
-                               coef[k] = (k? q_c[k-1] : 0) + tmp[k]; // this is the final c_{nk}
-                       }
-               }
-       }
-       free(lC);
-}
-
-bam_maqcns_t *bam_maqcns_init()
-{
-       bam_maqcns_t *bm;
-       bm = (bam_maqcns_t*)calloc(1, sizeof(bam_maqcns_t));
-       bm->aux = (bmc_aux_t*)calloc(1, sizeof(bmc_aux_t));
-       bm->het_rate = 0.001;
-       bm->theta = 0.83f;
-       bm->n_hap = 2;
-       bm->eta = 0.03;
-       bm->cap_mapQ = 60;
-       bm->min_baseQ = 13;
-       return bm;
-}
-
-void bam_maqcns_prepare(bam_maqcns_t *bm)
-{
-       if (bm->errmod == BAM_ERRMOD_MAQ2) bm->aux->em = errmod_init(1. - bm->theta);
-       cal_coef(bm); cal_het(bm);
-}
-
-void bam_maqcns_destroy(bam_maqcns_t *bm)
-{
-       if (bm == 0) return;
-       free(bm->lhet); free(bm->fk); free(bm->coef); free(bm->aux->info); free(bm->aux->info16);
-       if (bm->aux->em) errmod_destroy(bm->aux->em);
-       free(bm->aux); free(bm);
-}
-
-glf1_t *bam_maqcns_glfgen(int _n, const bam_pileup1_t *pl, uint8_t ref_base, bam_maqcns_t *bm)
-{
-       glf_call_aux_t *b = 0;
-       int i, j, k, w[8], c, n;
-       glf1_t *g = (glf1_t*)calloc(1, sizeof(glf1_t));
-       float p[16], min_p = 1e30;
-       uint64_t rms;
-
-       g->ref_base = ref_base;
-       if (_n == 0) return g;
-
-       // construct aux array
-       if (bm->aux->max < _n) {
-               bm->aux->max = _n;
-               kroundup32(bm->aux->max);
-               bm->aux->info = (uint32_t*)realloc(bm->aux->info, 4 * bm->aux->max);
-               bm->aux->info16 = (uint16_t*)realloc(bm->aux->info16, 2 * bm->aux->max);
-       }
-       for (i = n = 0, rms = 0; i < _n; ++i) {
-               const bam_pileup1_t *p = pl + i;
-               uint32_t q, x = 0, qq;
-               uint16_t y = 0;
-               if (p->is_del || p->is_refskip || (p->b->core.flag&BAM_FUNMAP)) continue;
-               q = (uint32_t)bam1_qual(p->b)[p->qpos];
-               if (q < bm->min_baseQ) continue;
-               x |= (uint32_t)bam1_strand(p->b) << 18 | q << 8 | p->b->core.qual;
-               y |= bam1_strand(p->b)<<4;
-               if (p->b->core.qual < q) q = p->b->core.qual;
-               c = p->b->core.qual < bm->cap_mapQ? p->b->core.qual : bm->cap_mapQ;
-               rms += c * c;
-               x |= q << 24;
-               y |= q << 5;
-               qq = bam1_seqi(bam1_seq(p->b), p->qpos);
-               q = bam_nt16_nt4_table[qq? qq : ref_base];
-               if (!p->is_del && !p->is_refskip && q < 4) x |= 1 << 21 | q << 16, y |= q;
-               bm->aux->info16[n] = y;
-               bm->aux->info[n++] = x;
-       }
-       rms = (uint8_t)(sqrt((double)rms / n) + .499);
-       if (bm->errmod == BAM_ERRMOD_MAQ2) {
-               errmod_cal(bm->aux->em, n, 4, bm->aux->info16, p);
-               goto goto_glf;
-       }
-       ks_introsort(uint32_t, n, bm->aux->info);
-       // generate esum and fsum
-       b = (glf_call_aux_t*)calloc(1, sizeof(glf_call_aux_t));
-       for (k = 0; k != 8; ++k) w[k] = 0;
-       for (j = n - 1; j >= 0; --j) { // calculate esum and fsum
-               uint32_t info = bm->aux->info[j];
-               if (info>>24 < 4 && (info>>8&0x3f) != 0) info = 4<<24 | (info&0xffffff);
-               k = info>>16&7;
-               if (info>>24 > 0) {
-                       b->esum[k&3] += bm->fk[w[k]] * (info>>24);
-                       b->fsum[k&3] += bm->fk[w[k]];
-                       if (w[k] < 0xff) ++w[k];
-                       ++b->c[k&3];
-               }
-       }
-       // rescale ->c[]
-       for (j = c = 0; j != 4; ++j) c += b->c[j];
-       if (c > 255) {
-               for (j = 0; j != 4; ++j) b->c[j] = (int)(254.0 * b->c[j] / c + 0.5);
-               for (j = c = 0; j != 4; ++j) c += b->c[j];
-       }
-       if (bm->errmod == BAM_ERRMOD_MAQ) {
-               // generate likelihood
-               for (j = 0; j != 4; ++j) {
-                       // homozygous
-                       float tmp1, tmp3;
-                       int tmp2, bar_e;
-                       for (k = 0, tmp1 = tmp3 = 0.0, tmp2 = 0; k != 4; ++k) {
-                               if (j == k) continue;
-                               tmp1 += b->esum[k]; tmp2 += b->c[k]; tmp3 += b->fsum[k];
-                       }
-                       if (tmp2) {
-                               bar_e = (int)(tmp1 / tmp3 + 0.5);
-                               if (bar_e < 4) bar_e = 4; // should not happen
-                               if (bar_e > 63) bar_e = 63;
-                               p[j<<2|j] = tmp1 + bm->coef[bar_e<<16|c<<8|tmp2];
-                       } else p[j<<2|j] = 0.0; // all the bases are j
-                       // heterozygous
-                       for (k = j + 1; k < 4; ++k) {
-                               for (i = 0, tmp2 = 0, tmp1 = tmp3 = 0.0; i != 4; ++i) {
-                                       if (i == j || i == k) continue;
-                                       tmp1 += b->esum[i]; tmp2 += b->c[i]; tmp3 += b->fsum[i];
-                               }
-                               if (tmp2) {
-                                       bar_e = (int)(tmp1 / tmp3 + 0.5);
-                                       if (bar_e < 4) bar_e = 4;
-                                       if (bar_e > 63) bar_e = 63;
-                                       p[j<<2|k] = p[k<<2|j] = -4.343 * bm->lhet[b->c[j]<<8|b->c[k]] + tmp1 + bm->coef[bar_e<<16|c<<8|tmp2];
-                               } else p[j<<2|k] = p[k<<2|j] = -4.343 * bm->lhet[b->c[j]<<8|b->c[k]]; // all the bases are either j or k
-                       }
-                       //
-                       for (k = 0; k != 4; ++k)
-                               if (p[j<<2|k] < 0.0) p[j<<2|k] = 0.0;
-               }
-
-               { // fix p[k<<2|k]
-                       float max1, max2, min1, min2;
-                       int max_k, min_k;
-                       max_k = min_k = -1;
-                       max1 = max2 = -1.0; min1 = min2 = 1e30;
-                       for (k = 0; k < 4; ++k) {
-                               if (b->esum[k] > max1) {
-                                       max2 = max1; max1 = b->esum[k]; max_k = k;
-                               } else if (b->esum[k] > max2) max2 = b->esum[k];
-                       }
-                       for (k = 0; k < 4; ++k) {
-                               if (p[k<<2|k] < min1) {
-                                       min2 = min1; min1 = p[k<<2|k]; min_k = k;
-                               } else if (p[k<<2|k] < min2) min2 = p[k<<2|k];
-                       }
-                       if (max1 > max2 && (min_k != max_k || min1 + 1.0 > min2))
-                               p[max_k<<2|max_k] = min1 > 1.0? min1 - 1.0 : 0.0;
-               }
-       } else if (bm->errmod == BAM_ERRMOD_SOAP) { // apply the SOAP model
-               // generate likelihood
-               for (j = 0; j != 4; ++j) {
-                       float tmp;
-                       // homozygous
-                       for (k = 0, tmp = 0.0; k != 4; ++k)
-                               if (j != k) tmp += b->esum[k];
-                       p[j<<2|j] = tmp;
-                       // heterozygous
-                       for (k = j + 1; k < 4; ++k) {
-                               for (i = 0, tmp = 0.0; i != 4; ++i)
-                                       if (i != j && i != k) tmp += b->esum[i];
-                               p[j<<2|k] = p[k<<2|j] = -4.343 * bm->lhet[b->c[j]<<8|b->c[k]] + tmp;
-                       }
-               }
-       }
-
-goto_glf:
-       // convert necessary information to glf1_t
-       g->ref_base = ref_base; g->max_mapQ = rms;
-       g->depth = n > 16777215? 16777215 : n;
-       for (j = 0; j != 4; ++j)
-               for (k = j; k < 4; ++k)
-                       if (p[j<<2|k] < min_p) min_p = p[j<<2|k];
-       g->min_lk = min_p > 255.0? 255 : (int)(min_p + 0.5);
-       for (j = c = 0; j != 4; ++j)
-               for (k = j; k < 4; ++k)
-                       g->lk[c++] = p[j<<2|k]-min_p > 255.0? 255 : (int)(p[j<<2|k]-min_p + 0.5);
-
-       free(b);
-       return g;
-}
-
-uint32_t glf2cns(const glf1_t *g, int q_r)
-{
-       int i, j, k, p[10], ref4;
-       uint32_t x = 0;
-       ref4 = bam_nt16_nt4_table[g->ref_base];
-       for (i = k = 0; i < 4; ++i)
-               for (j = i; j < 4; ++j) {
-                       int prior = (i == ref4 && j == ref4? 0 : i == ref4 || j == ref4? q_r : q_r + 3);
-                       p[k] = (g->lk[k] + prior)<<4 | i<<2 | j;
-                       ++k;
-               }
-       for (i = 1; i < 10; ++i) // insertion sort
-               for (j = i; j > 0 && p[j] < p[j-1]; --j)
-                       k = p[j], p[j] = p[j-1], p[j-1] = k;
-       x = (1u<<(p[0]&3) | 1u<<(p[0]>>2&3)) << 28; // the best genotype
-       x |= (uint32_t)g->max_mapQ << 16; // rms mapQ
-       x |= ((p[1]>>4) - (p[0]>>4) < 256? (p[1]>>4) - (p[0]>>4) : 255) << 8; // consensus Q
-       for (k = 0; k < 10; ++k)
-               if ((p[k]&0xf) == (ref4<<2|ref4)) break;
-       if (k == 10) k = 9;
-       x |= (p[k]>>4) - (p[0]>>4) < 256? (p[k]>>4) - (p[0]>>4) : 255; // snp Q
-       return x;
-}
-
-uint32_t bam_maqcns_call(int n, const bam_pileup1_t *pl, bam_maqcns_t *bm)
-{
-       glf1_t *g;
-       uint32_t x;
-       if (n) {
-               g = bam_maqcns_glfgen(n, pl, 0xf, bm);
-               x = g->depth == 0? (0xfU<<28 | 0xfU<<24) : glf2cns(g, (int)(bm->q_r + 0.5));
-               free(g);
-       } else x = 0xfU<<28 | 0xfU<<24;
-       return x;
-}
-
-/************** *****************/
-
-bam_maqindel_opt_t *bam_maqindel_opt_init()
-{
-       bam_maqindel_opt_t *mi = (bam_maqindel_opt_t*)calloc(1, sizeof(bam_maqindel_opt_t));
-       mi->q_indel = 40;
-       mi->r_indel = 0.00015;
-       mi->r_snp = 0.001;
-       //
-       mi->mm_penalty = 3;
-       mi->indel_err = 4;
-       mi->ambi_thres = 10;
-       return mi;
-}
-
-void bam_maqindel_ret_destroy(bam_maqindel_ret_t *mir)
-{
-       if (mir == 0) return;
-       free(mir->s[0]); free(mir->s[1]); free(mir);
-}
-
-int bam_tpos2qpos(const bam1_core_t *c, const uint32_t *cigar, int32_t tpos, int is_left, int32_t *_tpos)
-{
-       int k, x = c->pos, y = 0, last_y = 0;
-       *_tpos = c->pos;
-       for (k = 0; k < c->n_cigar; ++k) {
-               int op = cigar[k] & BAM_CIGAR_MASK;
-               int l = cigar[k] >> BAM_CIGAR_SHIFT;
-               if (op == BAM_CMATCH) {
-                       if (c->pos > tpos) return y;
-                       if (x + l > tpos) {
-                               *_tpos = tpos;
-                               return y + (tpos - x);
-                       }
-                       x += l; y += l;
-                       last_y = y;
-               } else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l;
-               else if (op == BAM_CDEL || op == BAM_CREF_SKIP) {
-                       if (x + l > tpos) {
-                               *_tpos = is_left? x : x + l;
-                               return y;
-                       }
-                       x += l;
-               }
-       }
-       *_tpos = x;
-       return last_y;
-}
-
-#define MINUS_CONST 0x10000000
-
-bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, const bam_pileup1_t *pl, const char *ref,
-                                                                int _n_types, int *_types)
-{
-       int i, j, n_types, *types, left, right, max_rd_len = 0;
-       bam_maqindel_ret_t *ret = 0;
-       // if there is no proposed indel, check if there is an indel from the alignment
-       if (_n_types == 0) {
-               for (i = 0; i < n; ++i) {
-                       const bam_pileup1_t *p = pl + i;
-                       if (!(p->b->core.flag&BAM_FUNMAP) && p->indel != 0) break;
-               }
-               if (i == n) return 0; // no indel
-       }
-       { // calculate how many types of indels are available (set n_types and types)
-               int m;
-               uint32_t *aux;
-               aux = (uint32_t*)calloc(n + _n_types + 1, 4);
-               m = 0;
-               aux[m++] = MINUS_CONST; // zero indel is always a type
-               for (i = 0; i < n; ++i) {
-                       const bam_pileup1_t *p = pl + i;
-                       if (!(p->b->core.flag&BAM_FUNMAP) && p->indel != 0)
-                               aux[m++] = MINUS_CONST + p->indel;
-                       j = bam_cigar2qlen(&p->b->core, bam1_cigar(p->b));
-                       if (j > max_rd_len) max_rd_len = j;
-               }
-               if (_n_types) // then also add this to aux[]
-                       for (i = 0; i < _n_types; ++i)
-                               if (_types[i]) aux[m++] = MINUS_CONST + _types[i];
-               ks_introsort(uint32_t, m, aux);
-               // squeeze out identical types
-               for (i = 1, n_types = 1; i < m; ++i)
-                       if (aux[i] != aux[i-1]) ++n_types;
-               types = (int*)calloc(n_types, sizeof(int));
-               j = 0;
-               types[j++] = aux[0] - MINUS_CONST; 
-               for (i = 1; i < m; ++i) {
-                       if (aux[i] != aux[i-1])
-                               types[j++] = aux[i] - MINUS_CONST;
-               }
-               free(aux);
-       }
-       { // calculate left and right boundary
-               left = pos > INDEL_WINDOW_SIZE? pos - INDEL_WINDOW_SIZE : 0;
-               right = pos + INDEL_WINDOW_SIZE;
-               if (types[0] < 0) right -= types[0];
-               // in case the alignments stand out the reference
-               for (i = pos; i < right; ++i)
-                       if (ref[i] == 0) break;
-               right = i;
-       }
-       { // the core part
-               char *ref2, *rs, *inscns = 0;
-               int qr_snp, k, l, *score, *pscore, max_ins = types[n_types-1];
-               qr_snp = (int)(-4.343 * log(mi->r_snp) + .499);
-               if (max_ins > 0) { // get the consensus of inserted sequences
-                       int *inscns_aux = (int*)calloc(4 * n_types * max_ins, sizeof(int));
-                       // count occurrences
-                       for (i = 0; i < n_types; ++i) {
-                               if (types[i] <= 0) continue; // not insertion
-                               for (j = 0; j < n; ++j) {
-                                       const bam_pileup1_t *p = pl + j;
-                                       if (!(p->b->core.flag&BAM_FUNMAP) && p->indel == types[i]) {
-                                               for (k = 1; k <= p->indel; ++k) {
-                                                       int c = bam_nt16_nt4_table[bam1_seqi(bam1_seq(p->b), p->qpos + k)];
-                                                       if (c < 4) ++inscns_aux[i*max_ins*4 + (k-1)*4 + c];
-                                               }
-                                       }
-                               }
-                       }
-                       // construct the consensus of inserted sequence
-                       inscns = (char*)calloc(n_types * max_ins, sizeof(char));
-                       for (i = 0; i < n_types; ++i) {
-                               for (j = 0; j < types[i]; ++j) {
-                                       int max = 0, max_k = -1, *ia = inscns_aux + i*max_ins*4 + j*4;
-                                       for (k = 0; k < 4; ++k) {
-                                               if (ia[k] > max) {
-                                                       max = ia[k];
-                                                       max_k = k;
-                                               }
-                                       }
-                                       inscns[i*max_ins + j] = max? 1<<max_k : 15;
-                               }
-                       }
-                       free(inscns_aux);
-               }
-               // calculate score
-               ref2 = (char*)calloc(right - left + types[n_types-1] + 2, 1);
-               rs   = (char*)calloc(right - left + max_rd_len + types[n_types-1] + 2, 1);
-               score = (int*)calloc(n_types * n, sizeof(int));
-               pscore = (int*)calloc(n_types * n, sizeof(int));
-               for (i = 0; i < n_types; ++i) {
-                       ka_param_t ap = ka_param_blast;
-                       ap.band_width = 2 * types[n_types - 1] + 2;
-                       ap.gap_end_ext = 0;
-                       // write ref2
-                       for (k = 0, j = left; j <= pos; ++j)
-                               ref2[k++] = bam_nt16_nt4_table[bam_nt16_table[(int)ref[j]]];
-                       if (types[i] <= 0) j += -types[i];
-                       else for (l = 0; l < types[i]; ++l)
-                                        ref2[k++] = bam_nt16_nt4_table[(int)inscns[i*max_ins + l]];
-                       if (types[0] < 0) { // mask deleted sequences
-                               int jj, tmp = types[i] >= 0? -types[0] : -types[0] + types[i];
-                               for (jj = 0; jj < tmp && j < right && ref[j]; ++jj, ++j)
-                                       ref2[k++] = 4;
-                       }
-                       for (; j < right && ref[j]; ++j)
-                               ref2[k++] = bam_nt16_nt4_table[bam_nt16_table[(int)ref[j]]];
-                       if (j < right) right = j;
-                       // calculate score for each read
-                       for (j = 0; j < n; ++j) {
-                               const bam_pileup1_t *p = pl + j;
-                               int qbeg, qend, tbeg, tend;
-                               if (p->b->core.flag & BAM_FUNMAP) continue;
-                               qbeg = bam_tpos2qpos(&p->b->core, bam1_cigar(p->b), left,  0, &tbeg);
-                               qend = bam_tpos2qpos(&p->b->core, bam1_cigar(p->b), right, 1, &tend);
-                               assert(tbeg >= left);
-                               for (l = qbeg; l < qend; ++l)
-                                       rs[l - qbeg] = bam_nt16_nt4_table[bam1_seqi(bam1_seq(p->b), l)];
-                               {
-                                       int x, y, n_acigar, ps;
-                                       uint32_t *acigar;
-                                       ps = 0;
-                                       if (tend - tbeg + types[i] <= 0) {
-                                               score[i*n+j] = -(1<<20);
-                                               pscore[i*n+j] = 1<<20;
-                                               continue;
-                                       }
-                                       acigar = ka_global_core((uint8_t*)ref2 + tbeg - left, tend - tbeg + types[i], (uint8_t*)rs, qend - qbeg, &ap, &score[i*n+j], &n_acigar);
-                                       x = tbeg - left; y = 0;
-                                       for (l = 0; l < n_acigar; ++l) {
-                                               int op = acigar[l]&0xf;
-                                               int len = acigar[l]>>4;
-                                               if (op == BAM_CMATCH) {
-                                                       int k;
-                                                       for (k = 0; k < len; ++k)
-                                                               if (ref2[x+k] != rs[y+k] && ref2[x+k] < 4)
-                                                                       ps += bam1_qual(p->b)[y+k] < qr_snp? bam1_qual(p->b)[y+k] : qr_snp;
-                                                       x += len; y += len;
-                                               } else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) {
-                                                       if (op == BAM_CINS && l > 0 && l < n_acigar - 1) ps += mi->q_indel * len;
-                                                       y += len;
-                                               } else if (op == BAM_CDEL) {
-                                                       if (l > 0 && l < n_acigar - 1) ps += mi->q_indel * len;
-                                                       x += len;
-                                               }
-                                       }
-                                       pscore[i*n+j] = ps;
-                                       /*if (1) { // for debugging only
-                                               fprintf(pysamerr, "id=%d, pos=%d, type=%d, j=%d, score=%d, psore=%d, %d, %d, %d, %d, %d, ",
-                                                               j, pos+1, types[i], j, score[i*n+j], pscore[i*n+j], tbeg, tend, qbeg, qend, mi->q_indel);
-                                               for (l = 0; l < n_acigar; ++l) fprintf(pysamerr, "%d%c", acigar[l]>>4, "MIDS"[acigar[l]&0xf]);
-                                               fprintf(pysamerr, "\n");
-                                               for (l = 0; l < tend - tbeg + types[i]; ++l) fputc("ACGTN"[ref2[l+tbeg-left]], pysamerr);
-                                               fputc('\n', pysamerr);
-                                               for (l = 0; l < qend - qbeg; ++l) fputc("ACGTN"[rs[l]], pysamerr);
-                                               fputc('\n', pysamerr);
-                                               }*/
-                                       free(acigar);
-                               }
-                       }
-               }
-               { // get final result
-                       int *sum, max1, max2, max1_i, max2_i;
-                       // pick up the best two score
-                       sum = (int*)calloc(n_types, sizeof(int));
-                       for (i = 0; i < n_types; ++i)
-                               for (j = 0; j < n; ++j)
-                                       sum[i] += -pscore[i*n+j];
-                       max1 = max2 = -0x7fffffff; max1_i = max2_i = -1;
-                       for (i = 0; i < n_types; ++i) {
-                               if (sum[i] > max1) {
-                                       max2 = max1; max2_i = max1_i; max1 = sum[i]; max1_i = i;
-                               } else if (sum[i] > max2) {
-                                       max2 = sum[i]; max2_i = i;
-                               }
-                       }
-                       free(sum);
-                       // write ret
-                       ret = (bam_maqindel_ret_t*)calloc(1, sizeof(bam_maqindel_ret_t));
-                       ret->indel1 = types[max1_i]; ret->indel2 = types[max2_i];
-                       ret->s[0] = (char*)calloc(abs(ret->indel1) + 2, 1);
-                       ret->s[1] = (char*)calloc(abs(ret->indel2) + 2, 1);
-                       // write indel sequence
-                       if (ret->indel1 > 0) {
-                               ret->s[0][0] = '+';
-                               for (k = 0; k < ret->indel1; ++k)
-                                       ret->s[0][k+1] = bam_nt16_rev_table[(int)inscns[max1_i*max_ins + k]];
-                       } else if (ret->indel1 < 0) {
-                               ret->s[0][0] = '-';
-                               for (k = 0; k < -ret->indel1 && ref[pos + k + 1]; ++k)
-                                       ret->s[0][k+1] = ref[pos + k + 1];
-                       } else ret->s[0][0] = '*';
-                       if (ret->indel2 > 0) {
-                               ret->s[1][0] = '+';
-                               for (k = 0; k < ret->indel2; ++k)
-                                       ret->s[1][k+1] = bam_nt16_rev_table[(int)inscns[max2_i*max_ins + k]];
-                       } else if (ret->indel2 < 0) {
-                               ret->s[1][0] = '-';
-                               for (k = 0; k < -ret->indel2 && ref[pos + k + 1]; ++k)
-                                       ret->s[1][k+1] = ref[pos + k + 1];
-                       } else ret->s[1][0] = '*';
-                       // write count
-                       for (i = 0; i < n; ++i) {
-                               const bam_pileup1_t *p = pl + i;
-                               if (p->indel == ret->indel1) ++ret->cnt1;
-                               else if (p->indel == ret->indel2) ++ret->cnt2;
-                               else ++ret->cnt_anti;
-                       }
-                       { // write gl[]
-                               int tmp, seq_err = 0;
-                               double x = 1.0;
-                               tmp = max1_i - max2_i;
-                               if (tmp < 0) tmp = -tmp;
-                               for (j = 0; j < tmp + 1; ++j) x *= INDEL_EXT_DEP;
-                               seq_err = mi->q_indel * (1.0 - x) / (1.0 - INDEL_EXT_DEP);
-                               ret->gl[0] = ret->gl[1] = 0;
-                               for (j = 0; j < n; ++j) {
-                                       int s1 = pscore[max1_i*n + j], s2 = pscore[max2_i*n + j];
-                                       //fprintf(pysamerr, "id=%d, %d, %d, %d, %d, %d\n", j, pl[j].b->core.pos+1, types[max1_i], types[max2_i], s1, s2);
-                                       if (s1 > s2) ret->gl[0] += s1 - s2 < seq_err? s1 - s2 : seq_err;
-                                       else ret->gl[1] += s2 - s1 < seq_err? s2 - s1 : seq_err;
-                               }
-                       }
-                       // write cnt_ref and cnt_ambi
-                       if (max1_i != 0 && max2_i != 0) {
-                               for (j = 0; j < n; ++j) {
-                                       int diff1 = score[j] - score[max1_i * n + j];
-                                       int diff2 = score[j] - score[max2_i * n + j];
-                                       if (diff1 > 0 && diff2 > 0) ++ret->cnt_ref;
-                                       else if (diff1 == 0 || diff2 == 0) ++ret->cnt_ambi;
-                               }
-                       }
-               }
-               free(score); free(pscore); free(ref2); free(rs); free(inscns);
-       }
-       { // call genotype
-               int q[3], qr_indel = (int)(-4.343 * log(mi->r_indel) + 0.5);
-               int min1, min2, min1_i;
-               q[0] = ret->gl[0] + (ret->s[0][0] != '*'? 0 : 0) * qr_indel;
-               q[1] = ret->gl[1] + (ret->s[1][0] != '*'? 0 : 0) * qr_indel;
-               q[2] = n * 3 + (ret->s[0][0] == '*' || ret->s[1][0] == '*'? 1 : 1) * qr_indel;
-               min1 = min2 = 0x7fffffff; min1_i = -1;
-               for (i = 0; i < 3; ++i) {
-                       if (q[i] < min1) {
-                               min2 = min1; min1 = q[i]; min1_i = i;
-                       } else if (q[i] < min2) min2 = q[i];
-               }
-               ret->gt = min1_i;
-               ret->q_cns = min2 - min1;
-               // set q_ref
-               if (ret->gt < 2) ret->q_ref = (ret->s[ret->gt][0] == '*')? 0 : q[1-ret->gt] - q[ret->gt] - qr_indel - 3;
-               else ret->q_ref = (ret->s[0][0] == '*')? q[0] - q[2] : q[1] - q[2];
-               if (ret->q_ref < 0) ret->q_ref = 0;
-       }
-       free(types);
-       return ret;
-}
diff --git a/samtools/bam_maqcns.h b/samtools/bam_maqcns.h
deleted file mode 100644 (file)
index 291ae53..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef BAM_MAQCNS_H
-#define BAM_MAQCNS_H
-
-#include "glf.h"
-
-#define BAM_ERRMOD_MAQ2 0
-#define BAM_ERRMOD_MAQ  1
-#define BAM_ERRMOD_SOAP 2
-
-struct __bmc_aux_t;
-
-typedef struct {
-       float het_rate, theta;
-       int n_hap, cap_mapQ, errmod, min_baseQ;
-
-       float eta, q_r;
-       double *fk, *coef;
-       double *lhet;
-       struct __bmc_aux_t *aux;
-} bam_maqcns_t;
-
-typedef struct {
-       int q_indel; // indel sequencing error, phred scaled
-       float r_indel; // indel prior
-       float r_snp; // snp prior
-       // hidden parameters, unchangeable from command line
-       int mm_penalty, indel_err, ambi_thres;
-} bam_maqindel_opt_t;
-
-typedef struct {
-       int indel1, indel2;
-       int cnt1, cnt2, cnt_anti;
-       int cnt_ref, cnt_ambi;
-       char *s[2];
-       //
-       int gt, gl[2];
-       int q_cns, q_ref;
-} bam_maqindel_ret_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-       bam_maqcns_t *bam_maqcns_init();
-       void bam_maqcns_prepare(bam_maqcns_t *bm);
-       void bam_maqcns_destroy(bam_maqcns_t *bm);
-       glf1_t *bam_maqcns_glfgen(int n, const bam_pileup1_t *pl, uint8_t ref_base, bam_maqcns_t *bm);
-       uint32_t bam_maqcns_call(int n, const bam_pileup1_t *pl, bam_maqcns_t *bm);
-       // return: cns<<28 | cns2<<24 | mapQ<<16 | cnsQ<<8 | cnsQ2
-       uint32_t glf2cns(const glf1_t *g, int q_r);
-
-       bam_maqindel_opt_t *bam_maqindel_opt_init();
-       bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, const bam_pileup1_t *pl, const char *ref,
-                                                                        int _n_types, int *_types);
-       void bam_maqindel_ret_destroy(bam_maqindel_ret_t*);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
index c6568b770200f4744b4255fc0fc14451c51a001a..50ecaf17cf4aac80a35d46bec11a7d08b987e216 100644 (file)
 #include "kaln.h"
 #include "kprobaln.h"
 
+#define USE_EQUAL 1
+#define DROP_TAG  2
+#define BIN_QUAL  4
+#define UPDATE_NM 8
+#define UPDATE_MD 16
+#define HASH_QNM  32
+
 char bam_nt16_nt4_table[] = { 4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4 };
 
-void bam_fillmd1_core(bam1_t *b, char *ref, int is_equal, int max_nm)
+int bam_aux_drop_other(bam1_t *b, uint8_t *s);
+
+void bam_fillmd1_core(bam1_t *b, char *ref, int flag, int max_nm)
 {
        uint8_t *seq = bam1_seq(b);
        uint32_t *cigar = bam1_cigar(b);
        bam1_core_t *c = &b->core;
        int i, x, y, u = 0;
        kstring_t *str;
-       uint8_t *old_md, *old_nm;
        int32_t old_nm_i = -1, nm = 0;
 
        str = (kstring_t*)calloc(1, sizeof(kstring_t));
        for (i = y = 0, x = c->pos; i < c->n_cigar; ++i) {
                int j, l = cigar[i]>>4, op = cigar[i]&0xf;
-               if (op == BAM_CMATCH) {
+               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                        for (j = 0; j < l; ++j) {
                                int z = y + j;
                                int c1 = bam1_seqi(seq, z), c2 = bam_nt16_table[(int)ref[x+j]];
                                if (ref[x+j] == 0) break; // out of boundary
                                if ((c1 == c2 && c1 != 15 && c2 != 15) || c1 == 0) { // a match
-                                       if (is_equal) seq[z/2] &= (z&1)? 0xf0 : 0x0f;
+                                       if (flag&USE_EQUAL) seq[z/2] &= (z&1)? 0xf0 : 0x0f;
                                        ++u;
                                } else {
-                                       ksprintf(str, "%d", u);
-                                       kputc(ref[x+j], str);
+                                       kputw(u, str); kputc(ref[x+j], str);
                                        u = 0; ++nm;
                                }
                        }
                        if (j < l) break;
                        x += l; y += l;
                } else if (op == BAM_CDEL) {
-                       ksprintf(str, "%d", u);
-                       kputc('^', str);
+                       kputw(u, str); kputc('^', str);
                        for (j = 0; j < l; ++j) {
                                if (ref[x+j] == 0) break;
                                kputc(ref[x+j], str);
@@ -59,12 +65,12 @@ void bam_fillmd1_core(bam1_t *b, char *ref, int is_equal, int max_nm)
                        x += l;
                }
        }
-       ksprintf(str, "%d", u);
+       kputw(u, str);
        // apply max_nm
        if (max_nm > 0 && nm >= max_nm) {
                for (i = y = 0, x = c->pos; i < c->n_cigar; ++i) {
                        int j, l = cigar[i]>>4, op = cigar[i]&0xf;
-                       if (op == BAM_CMATCH) {
+                       if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                                for (j = 0; j < l; ++j) {
                                        int z = y + j;
                                        int c1 = bam1_seqi(seq, z), c2 = bam_nt16_table[(int)ref[x+j]];
@@ -81,38 +87,54 @@ void bam_fillmd1_core(bam1_t *b, char *ref, int is_equal, int max_nm)
                }
        }
        // update NM
-       old_nm = bam_aux_get(b, "NM");
-       if (c->flag & BAM_FUNMAP) return;
-       if (old_nm) old_nm_i = bam_aux2i(old_nm);
-       if (!old_nm) bam_aux_append(b, "NM", 'i', 4, (uint8_t*)&nm);
-       else if (nm != old_nm_i) {
-               fprintf(pysamerr, "[bam_fillmd1] different NM for read '%s': %d -> %d\n", bam1_qname(b), old_nm_i, nm);
-               bam_aux_del(b, old_nm);
-               bam_aux_append(b, "NM", 'i', 4, (uint8_t*)&nm);
+       if (flag & UPDATE_NM) {
+               uint8_t *old_nm = bam_aux_get(b, "NM");
+               if (c->flag & BAM_FUNMAP) return;
+               if (old_nm) old_nm_i = bam_aux2i(old_nm);
+               if (!old_nm) bam_aux_append(b, "NM", 'i', 4, (uint8_t*)&nm);
+               else if (nm != old_nm_i) {
+                       fprintf(pysamerr, "[bam_fillmd1] different NM for read '%s': %d -> %d\n", bam1_qname(b), old_nm_i, nm);
+                       bam_aux_del(b, old_nm);
+                       bam_aux_append(b, "NM", 'i', 4, (uint8_t*)&nm);
+               }
        }
        // update MD
-       old_md = bam_aux_get(b, "MD");
-       if (!old_md) bam_aux_append(b, "MD", 'Z', str->l + 1, (uint8_t*)str->s);
-       else {
-               int is_diff = 0;
-               if (strlen((char*)old_md+1) == str->l) {
-                       for (i = 0; i < str->l; ++i)
-                               if (toupper(old_md[i+1]) != toupper(str->s[i]))
-                                       break;
-                       if (i < str->l) is_diff = 1;
-               } else is_diff = 1;
-               if (is_diff) {
-                       fprintf(pysamerr, "[bam_fillmd1] different MD for read '%s': '%s' -> '%s'\n", bam1_qname(b), old_md+1, str->s);
-                       bam_aux_del(b, old_md);
-                       bam_aux_append(b, "MD", 'Z', str->l + 1, (uint8_t*)str->s);
+       if (flag & UPDATE_MD) {
+               uint8_t *old_md = bam_aux_get(b, "MD");
+               if (c->flag & BAM_FUNMAP) return;
+               if (!old_md) bam_aux_append(b, "MD", 'Z', str->l + 1, (uint8_t*)str->s);
+               else {
+                       int is_diff = 0;
+                       if (strlen((char*)old_md+1) == str->l) {
+                               for (i = 0; i < str->l; ++i)
+                                       if (toupper(old_md[i+1]) != toupper(str->s[i]))
+                                               break;
+                               if (i < str->l) is_diff = 1;
+                       } else is_diff = 1;
+                       if (is_diff) {
+                               fprintf(pysamerr, "[bam_fillmd1] different MD for read '%s': '%s' -> '%s'\n", bam1_qname(b), old_md+1, str->s);
+                               bam_aux_del(b, old_md);
+                               bam_aux_append(b, "MD", 'Z', str->l + 1, (uint8_t*)str->s);
+                       }
                }
        }
+       // drop all tags but RG
+       if (flag&DROP_TAG) {
+               uint8_t *q = bam_aux_get(b, "RG");
+               bam_aux_drop_other(b, q);
+       }
+       // reduce the resolution of base quality
+       if (flag&BIN_QUAL) {
+               uint8_t *qual = bam1_qual(b);
+               for (i = 0; i < b->core.l_qseq; ++i)
+                       if (qual[i] >= 3) qual[i] = qual[i]/10*10 + 7;
+       }
        free(str->s); free(str);
 }
 
-void bam_fillmd1(bam1_t *b, char *ref, int is_equal)
+void bam_fillmd1(bam1_t *b, char *ref, int flag)
 {
-       bam_fillmd1_core(b, ref, is_equal, 0);
+       bam_fillmd1_core(b, ref, flag, 0);
 }
 
 int bam_cap_mapQ(bam1_t *b, char *ref, int thres)
@@ -126,7 +148,7 @@ int bam_cap_mapQ(bam1_t *b, char *ref, int thres)
        mm = q = len = clip_l = clip_q = 0;
        for (i = y = 0, x = c->pos; i < c->n_cigar; ++i) {
                int j, l = cigar[i]>>4, op = cigar[i]&0xf;
-               if (op == BAM_CMATCH) {
+               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                        for (j = 0; j < l; ++j) {
                                int z = y + j;
                                int c1 = bam1_seqi(seq, z), c2 = bam_nt16_table[(int)ref[x+j]];
@@ -199,7 +221,7 @@ int bam_prob_realn_core(bam1_t *b, const char *ref, int flag)
        for (k = 0; k < c->n_cigar; ++k) {
                int op, l;
                op = cigar[k]&0xf; l = cigar[k]>>4;
-               if (op == BAM_CMATCH) {
+               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                        if (yb < 0) yb = y;
                        if (xb < 0) xb = x;
                        ye = y + l; xe = x + l;
@@ -235,7 +257,7 @@ int bam_prob_realn_core(bam1_t *b, const char *ref, int flag)
                if (!extend_baq) { // in this block, bq[] is capped by base quality qual[]
                        for (k = 0, x = c->pos, y = 0; k < c->n_cigar; ++k) {
                                int op = cigar[k]&0xf, l = cigar[k]>>4;
-                               if (op == BAM_CMATCH) {
+                               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                                        for (i = y; i < y + l; ++i) {
                                                if ((state[i]&3) != 0 || state[i]>>2 != x - xb + (i - y)) bq[i] = 0;
                                                else bq[i] = bq[i] < q[i]? bq[i] : q[i];
@@ -250,7 +272,7 @@ int bam_prob_realn_core(bam1_t *b, const char *ref, int flag)
                        left = calloc(c->l_qseq, 1); rght = calloc(c->l_qseq, 1);
                        for (k = 0, x = c->pos, y = 0; k < c->n_cigar; ++k) {
                                int op = cigar[k]&0xf, l = cigar[k]>>4;
-                               if (op == BAM_CMATCH) {
+                               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                                        for (i = y; i < y + l; ++i)
                                                bq[i] = ((state[i]&3) != 0 || state[i]>>2 != x - xb + (i - y))? 0 : q[i];
                                        for (left[y] = bq[y], i = y + 1; i < y + l; ++i)
@@ -282,19 +304,24 @@ int bam_prob_realn(bam1_t *b, const char *ref)
 
 int bam_fillmd(int argc, char *argv[])
 {
-       int c, is_equal, tid = -2, ret, len, is_bam_out, is_sam_in, is_uncompressed, max_nm, is_realn, capQ, baq_flag;
+       int c, flt_flag, tid = -2, ret, len, is_bam_out, is_sam_in, is_uncompressed, max_nm, is_realn, capQ, baq_flag;
        samfile_t *fp, *fpout = 0;
        faidx_t *fai;
        char *ref = 0, mode_w[8], mode_r[8];
        bam1_t *b;
 
-       is_equal = is_bam_out = is_sam_in = is_uncompressed = is_realn = max_nm = capQ = baq_flag = 0;
+       flt_flag = UPDATE_NM | UPDATE_MD;
+       is_bam_out = is_sam_in = is_uncompressed = is_realn = max_nm = capQ = baq_flag = 0;
        mode_w[0] = mode_r[0] = 0;
        strcpy(mode_r, "r"); strcpy(mode_w, "w");
-       while ((c = getopt(argc, argv, "EreubSC:n:A")) >= 0) {
+       while ((c = getopt(argc, argv, "EqreuNhbSC:n:Ad")) >= 0) {
                switch (c) {
                case 'r': is_realn = 1; break;
-               case 'e': is_equal = 1; break;
+               case 'e': flt_flag |= USE_EQUAL; break;
+               case 'd': flt_flag |= DROP_TAG; break;
+               case 'q': flt_flag |= BIN_QUAL; break;
+               case 'h': flt_flag |= HASH_QNM; break;
+               case 'N': flt_flag &= ~(UPDATE_MD|UPDATE_NM); break;
                case 'b': is_bam_out = 1; break;
                case 'u': is_uncompressed = is_bam_out = 1; break;
                case 'S': is_sam_in = 1; break;
@@ -346,7 +373,7 @@ int bam_fillmd(int argc, char *argv[])
                                int q = bam_cap_mapQ(b, ref, capQ);
                                if (b->core.qual > q) b->core.qual = q;
                        }
-                       if (ref) bam_fillmd1_core(b, ref, is_equal, max_nm);
+                       if (ref) bam_fillmd1_core(b, ref, flt_flag, max_nm);
                }
                samwrite(fpout, b);
        }
index 59e54c06ad77434947311a94bd0cd9b5b44b6b52..cca29d2e075120e9ebf3b4170d82b2f5929cac55 100644 (file)
@@ -80,12 +80,12 @@ static inline int resolve_cigar2(bam_pileup1_t *p, uint32_t pos, cstate_t *s)
        if (s->k == -1) { // never processed
                is_head = 1;
                if (c->n_cigar == 1) { // just one operation, save a loop
-                       if (_cop(cigar[0]) == BAM_CMATCH) s->k = 0, s->x = c->pos, s->y = 0;
+                 if (_cop(cigar[0]) == BAM_CMATCH || _cop(cigar[0]) == BAM_CEQUAL || _cop(cigar[0]) == BAM_CDIFF) s->k = 0, s->x = c->pos, s->y = 0;
                } else { // find the first match or deletion
                        for (k = 0, s->x = c->pos, s->y = 0; k < c->n_cigar; ++k) {
                                int op = _cop(cigar[k]);
                                int l = _cln(cigar[k]);
-                               if (op == BAM_CMATCH || op == BAM_CDEL) break;
+                               if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CEQUAL || op == BAM_CDIFF) break;
                                else if (op == BAM_CREF_SKIP) s->x += l;
                                else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) s->y += l;
                        }
@@ -97,16 +97,16 @@ static inline int resolve_cigar2(bam_pileup1_t *p, uint32_t pos, cstate_t *s)
                if (pos - s->x >= l) { // jump to the next operation
                        assert(s->k < c->n_cigar); // otherwise a bug: this function should not be called in this case
                        op = _cop(cigar[s->k+1]);
-                       if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP) { // jump to the next without a loop
-                               if (_cop(cigar[s->k]) == BAM_CMATCH) s->y += l;
+                       if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP || op == BAM_CEQUAL || op == BAM_CDIFF) { // jump to the next without a loop
+                         if (_cop(cigar[s->k]) == BAM_CMATCH|| _cop(cigar[s->k]) == BAM_CEQUAL || _cop(cigar[s->k]) == BAM_CDIFF) s->y += l;
                                s->x += l;
                                ++s->k;
-                       } else { // find the next M/D/N
-                               if (_cop(cigar[s->k]) == BAM_CMATCH) s->y += l;
+                       } else { // find the next M/D/N/=/X
+                         if (_cop(cigar[s->k]) == BAM_CMATCH|| _cop(cigar[s->k]) == BAM_CEQUAL || _cop(cigar[s->k]) == BAM_CDIFF) s->y += l;
                                s->x += l;
                                for (k = s->k + 1; k < c->n_cigar; ++k) {
                                        op = _cop(cigar[k]), l = _cln(cigar[k]);
-                                       if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP) break;
+                                       if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP || op == BAM_CEQUAL || op == BAM_CDIFF) break;
                                        else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) s->y += l;
                                }
                                s->k = k;
@@ -128,12 +128,12 @@ static inline int resolve_cigar2(bam_pileup1_t *p, uint32_t pos, cstate_t *s)
                                for (k = s->k + 2; k < c->n_cigar; ++k) {
                                        op2 = _cop(cigar[k]); l2 = _cln(cigar[k]);
                                        if (op2 == BAM_CINS) l3 += l2;
-                                       else if (op2 == BAM_CDEL || op2 == BAM_CMATCH || op2 == BAM_CREF_SKIP) break;
+                                       else if (op2 == BAM_CDEL || op2 == BAM_CMATCH || op2 == BAM_CREF_SKIP || op2 == BAM_CEQUAL || op2 == BAM_CDIFF) break;
                                }
                                if (l3 > 0) p->indel = l3;
                        }
                }
-               if (op == BAM_CMATCH) {
+               if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
                        p->qpos = s->y + (pos - s->x);
                } else if (op == BAM_CDEL || op == BAM_CREF_SKIP) {
                        p->is_del = 1; p->qpos = s->y; // FIXME: distinguish D and N!!!!!
index 93b729db2388b9ef14ba093c2eef7b31dee52663..473d409633dd80836c0ffccedb00c31fa1246e16 100644 (file)
@@ -8,93 +8,8 @@
 #include <errno.h>
 #include "sam.h"
 #include "faidx.h"
-#include "bam_maqcns.h"
-#include "khash.h"
-#include "glf.h"
 #include "kstring.h"
 
-typedef int *indel_list_t;
-KHASH_MAP_INIT_INT64(64, indel_list_t)
-
-#define BAM_PLF_SIMPLE     0x01
-#define BAM_PLF_CNS        0x02
-#define BAM_PLF_INDEL_ONLY 0x04
-#define BAM_PLF_GLF        0x08
-#define BAM_PLF_VAR_ONLY   0x10
-#define BAM_PLF_2ND        0x20
-#define BAM_PLF_RANBASE    0x40
-#define BAM_PLF_1STBASE    0x80
-#define BAM_PLF_ALLBASE    0x100
-#define BAM_PLF_READPOS    0x200
-#define BAM_PLF_NOBAQ      0x400
-
-typedef struct {
-       bam_header_t *h;
-       bam_maqcns_t *c;
-       bam_maqindel_opt_t *ido;
-       faidx_t *fai;
-       khash_t(64) *hash;
-       uint32_t format;
-       int tid, len, last_pos;
-       int mask;
-       int capQ_thres, min_baseQ;
-    int max_depth;  // for indel calling, ignore reads with the depth too high. 0 for unlimited
-       char *ref;
-       glfFile fp_glf; // for glf output only
-} pu_data_t;
-
-char **__bam_get_lines(const char *fn, int *_n);
-void bam_init_header_hash(bam_header_t *header);
-int32_t bam_get_tid(const bam_header_t *header, const char *seq_name);
-
-static khash_t(64) *load_pos(const char *fn, bam_header_t *h)
-{
-       char **list;
-       int i, j, n, *fields, max_fields;
-       khash_t(64) *hash;
-       bam_init_header_hash(h);
-       list = __bam_get_lines(fn, &n);
-       hash = kh_init(64);
-       max_fields = 0; fields = 0;
-       for (i = 0; i < n; ++i) {
-               char *str = list[i];
-               int chr, n_fields, ret;
-               khint_t k;
-               uint64_t x;
-               n_fields = ksplit_core(str, 0, &max_fields, &fields);
-               if (n_fields < 2) continue;
-               chr = bam_get_tid(h, str + fields[0]);
-               if (chr < 0) {
-                       fprintf(pysamerr, "[load_pos] unknown reference sequence name: %s\n", str + fields[0]);
-                       continue;
-               }
-               x = (uint64_t)chr << 32 | (atoi(str + fields[1]) - 1);
-               k = kh_put(64, hash, x, &ret);
-               if (ret == 0) {
-                       fprintf(pysamerr, "[load_pos] position %s:%s has been loaded.\n", str+fields[0], str+fields[1]);
-                       continue;
-               }
-               kh_val(hash, k) = 0;
-               if (n_fields > 2) {
-                       // count
-                       for (j = 2; j < n_fields; ++j) {
-                               char *s = str + fields[j];
-                               if ((*s != '+' && *s != '-') || !isdigit(s[1])) break;
-                       }
-                       if (j > 2) { // update kh_val()
-                               int *q, y, z;
-                               q = kh_val(hash, k) = (int*)calloc(j - 1, sizeof(int));
-                               q[0] = j - 2; z = j; y = 1;
-                               for (j = 2; j < z; ++j)
-                                       q[y++] = atoi(str + fields[j]);
-                       }
-               }
-               free(str);
-       }
-       free(list); free(fields);
-       return hash;
-}
-
 static inline int printw(int c, FILE *fp)
 {
        char buf[16];
@@ -110,75 +25,6 @@ static inline int printw(int c, FILE *fp)
        return 0;
 }
 
-// an analogy to pileup_func() below
-static int glt3_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pu, void *data)
-{
-       pu_data_t *d = (pu_data_t*)data;
-       bam_maqindel_ret_t *r = 0;
-       int rb, *proposed_indels = 0;
-       glf1_t *g;
-       glf3_t *g3;
-
-       if (d->fai == 0) {
-               fprintf(pysamerr, "[glt3_func] reference sequence is required for generating GLT. Abort!\n");
-               exit(1);
-       }
-       if (d->hash) { // only output a list of sites
-               khint_t k = kh_get(64, d->hash, (uint64_t)tid<<32|pos);
-               if (k == kh_end(d->hash)) return 0;
-               proposed_indels = kh_val(d->hash, k);
-       }
-       g3 = glf3_init1();
-       if (d->fai && (int)tid != d->tid) {
-               if (d->ref) { // then write the end mark
-                       g3->rtype = GLF3_RTYPE_END;
-                       glf3_write1(d->fp_glf, g3);
-               }
-               glf3_ref_write(d->fp_glf, d->h->target_name[tid], d->h->target_len[tid]); // write reference
-               free(d->ref);
-               d->ref = fai_fetch(d->fai, d->h->target_name[tid], &d->len);
-               d->tid = tid;
-               d->last_pos = 0;
-       }
-       rb = (d->ref && (int)pos < d->len)? d->ref[pos] : 'N';
-       g = bam_maqcns_glfgen(n, pu, bam_nt16_table[rb], d->c);
-       memcpy(g3, g, sizeof(glf1_t));
-       g3->rtype = GLF3_RTYPE_SUB;
-       g3->offset = pos - d->last_pos;
-       d->last_pos = pos;
-       glf3_write1(d->fp_glf, g3);
-    if (pos < d->len) {
-        int m = (!d->max_depth || d->max_depth>n) ? n : d->max_depth;
-               if (proposed_indels)
-                       r = bam_maqindel(m, pos, d->ido, pu, d->ref, proposed_indels[0], proposed_indels+1);
-               else r = bam_maqindel(m, pos, d->ido, pu, d->ref, 0, 0);
-       }
-       if (r) { // then write indel line
-               int het = 3 * n, min;
-               min = het;
-               if (min > r->gl[0]) min = r->gl[0];
-               if (min > r->gl[1]) min = r->gl[1];
-               g3->ref_base = 0;
-               g3->rtype = GLF3_RTYPE_INDEL;
-               memset(g3->lk, 0, 10);
-               g3->lk[0] = r->gl[0] - min < 255? r->gl[0] - min : 255;
-               g3->lk[1] = r->gl[1] - min < 255? r->gl[1] - min : 255;
-               g3->lk[2] = het - min < 255? het - min : 255;
-               g3->offset = 0;
-               g3->indel_len[0] = r->indel1;
-               g3->indel_len[1] = r->indel2;
-               g3->min_lk = min < 255? min : 255;
-               g3->max_len = (abs(r->indel1) > abs(r->indel2)? abs(r->indel1) : abs(r->indel2)) + 1;
-               g3->indel_seq[0] = strdup(r->s[0]+1);
-               g3->indel_seq[1] = strdup(r->s[1]+1);
-               glf3_write1(d->fp_glf, g3);
-               bam_maqindel_ret_destroy(r);
-       }
-       free(g);
-       glf3_destroy1(g3);
-       return 0;
-}
-
 static inline void pileup_seq(const bam_pileup1_t *p, int pos, int ref_len, const char *ref)
 {
        int j;
@@ -214,317 +60,6 @@ static inline void pileup_seq(const bam_pileup1_t *p, int pos, int ref_len, cons
        if (p->is_tail) putchar('$');
 }
 
-static int pileup_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pu, void *data)
-{
-       pu_data_t *d = (pu_data_t*)data;
-       bam_maqindel_ret_t *r = 0;
-       int i, rb, rms_mapq = -1, *proposed_indels = 0;
-       uint64_t rms_aux;
-       uint32_t cns = 0;
-
-       // if GLF is required, suppress -c completely
-       if (d->format & BAM_PLF_GLF) return glt3_func(tid, pos, n, pu, data);
-       // if d->hash is initialized, only output the sites in the hash table
-       if (d->hash) {
-               khint_t k = kh_get(64, d->hash, (uint64_t)tid<<32|pos);
-               if (k == kh_end(d->hash)) return 0;
-               proposed_indels = kh_val(d->hash, k);
-       }
-       // update d->ref if necessary
-       if (d->fai && (int)tid != d->tid) {
-               free(d->ref);
-               d->ref = faidx_fetch_seq(d->fai, d->h->target_name[tid], 0, 0x7fffffff, &d->len);
-               d->tid = tid;
-       }
-       rb = (d->ref && (int)pos < d->len)? d->ref[pos] : 'N';
-       // when the indel-only mode is asked for, return if no reads mapped with indels
-       if (d->format & BAM_PLF_INDEL_ONLY) {
-               for (i = 0; i < n; ++i)
-                       if (pu[i].indel != 0) break;
-               if (i == n) return 0;
-       }
-       // call the consensus and indel
-       if (d->format & BAM_PLF_CNS) { // call consensus
-               if (d->format & (BAM_PLF_RANBASE|BAM_PLF_1STBASE)) { // use a random base or the 1st base as the consensus call
-                       const bam_pileup1_t *p = (d->format & BAM_PLF_1STBASE)? pu : pu + (int)(drand48() * n);
-                       int q = bam1_qual(p->b)[p->qpos];
-                       int mapQ = p->b->core.qual < d->c->cap_mapQ? p->b->core.qual : d->c->cap_mapQ;
-                       uint32_t b = bam1_seqi(bam1_seq(p->b), p->qpos);
-                       cns = b<<28 | 0xf<<24 | mapQ<<16 | q<<8;
-               } else if (d->format & BAM_PLF_ALLBASE) { // collapse all bases
-                       uint64_t rmsQ = 0;
-                       uint32_t b = 0;
-                       for (i = 0; i < n; ++i) {
-                               const bam_pileup1_t *p = pu + i;
-                               int q = p->b->core.qual < d->c->cap_mapQ? p->b->core.qual : d->c->cap_mapQ;
-                               b |= bam1_seqi(bam1_seq(p->b), p->qpos);
-                               rmsQ += q * q;
-                       }
-                       rmsQ = (uint64_t)(sqrt((double)rmsQ / n) + .499);
-                       cns = b<<28 | 0xf<<24 | rmsQ<<16 | 60<<8;
-               } else {
-                       glf1_t *g = bam_maqcns_glfgen(n, pu, bam_nt16_table[rb], d->c);
-                       cns = g->depth == 0? (0xfu<<28 | 0xf<<24) : glf2cns(g, (int)(d->c->q_r + .499));
-                       free(g);
-               }
-       }
-    if ((d->format & (BAM_PLF_CNS|BAM_PLF_INDEL_ONLY)) && d->ref && pos < d->len) { // call indels
-        int m = (!d->max_depth || d->max_depth>n) ? n : d->max_depth;
-        if (proposed_indels) // the first element gives the size of the array
-            r = bam_maqindel(m, pos, d->ido, pu, d->ref, proposed_indels[0], proposed_indels+1);
-        else r = bam_maqindel(m, pos, d->ido, pu, d->ref, 0, 0);
-       }
-       // when only variant sites are asked for, test if the site is a variant
-       if ((d->format & BAM_PLF_CNS) && (d->format & BAM_PLF_VAR_ONLY)) {
-               if (!(bam_nt16_table[rb] != 15 && cns>>28 != 15 && cns>>28 != bam_nt16_table[rb])) { // not a SNP
-                       if (!(r && (r->gt == 2 || strcmp(r->s[r->gt], "*")))) { // not an indel
-                               if (r) bam_maqindel_ret_destroy(r);
-                               return 0;
-                       }
-               }
-       }
-       // print the first 3 columns
-       fputs(d->h->target_name[tid], stdout); putchar('\t');
-       printw(pos+1, stdout); putchar('\t'); putchar(rb); putchar('\t');
-       // print consensus information if required
-       if (d->format & BAM_PLF_CNS) {
-               putchar(bam_nt16_rev_table[cns>>28]); putchar('\t');
-               printw(cns>>8&0xff, stdout); putchar('\t');
-               printw(cns&0xff, stdout); putchar('\t');
-               printw(cns>>16&0xff, stdout); putchar('\t');
-       }
-       // print pileup sequences
-       printw(n, stdout); putchar('\t');
-       for (i = 0; i < n; ++i)
-               pileup_seq(pu + i, pos, d->len, d->ref);
-       // finalize rms_mapq
-       if (d->format & BAM_PLF_CNS) {
-               for (i = rms_aux = 0; i < n; ++i) {
-                       const bam_pileup1_t *p = pu + i;
-                       int tmp = p->b->core.qual < d->c->cap_mapQ? p->b->core.qual : d->c->cap_mapQ;
-                       rms_aux += tmp * tmp;
-               }
-               rms_aux = (uint64_t)(sqrt((double)rms_aux / n) + .499);
-               if (rms_mapq < 0) rms_mapq = rms_aux;
-       }
-       putchar('\t');
-       // print quality
-       for (i = 0; i < n; ++i) {
-               const bam_pileup1_t *p = pu + i;
-               int c = bam1_qual(p->b)[p->qpos] + 33;
-               if (c > 126) c = 126;
-               putchar(c);
-       }
-       if (d->format & BAM_PLF_2ND) { // print 2nd calls and qualities
-               const unsigned char *q;
-               putchar('\t');
-               for (i = 0; i < n; ++i) {
-                       const bam_pileup1_t *p = pu + i;
-                       q = bam_aux_get(p->b, "E2");
-                       putchar(q? q[p->qpos + 1] : 'N');
-               }
-               putchar('\t');
-               for (i = 0; i < n; ++i) {
-                       const bam_pileup1_t *p = pu + i;
-                       q = bam_aux_get(p->b, "U2");
-                       putchar(q? q[p->qpos + 1] : '!');
-               }
-       }
-       // print mapping quality if -s is flagged on the command line
-       if (d->format & BAM_PLF_SIMPLE) {
-               putchar('\t');
-               for (i = 0; i < n; ++i) {
-                       int c = pu[i].b->core.qual + 33;
-                       if (c > 126) c = 126;
-                       putchar(c);
-               }
-       }
-       // print read position
-       if (d->format & BAM_PLF_READPOS) {
-               putchar('\t');
-               for (i = 0; i < n; ++i) {
-                       int x = pu[i].qpos;
-                       int l = pu[i].b->core.l_qseq;
-                       printw(x < l/2? x+1 : -((l-1)-x+1), stdout); putchar(',');
-               }
-       }
-       putchar('\n');
-       // print the indel line if r has been calculated. This only happens if:
-       // a) -c or -i are flagged, AND b) the reference sequence is available
-       if (r) {
-               printf("%s\t%d\t*\t", d->h->target_name[tid], pos + 1);
-               if (r->gt < 2) printf("%s/%s\t", r->s[r->gt], r->s[r->gt]);
-               else printf("%s/%s\t", r->s[0], r->s[1]);
-               printf("%d\t%d\t", r->q_cns, r->q_ref);
-               printf("%d\t%d\t", rms_mapq, n);
-               printf("%s\t%s\t", r->s[0], r->s[1]);
-               //printf("%d\t%d\t", r->gl[0], r->gl[1]);
-               printf("%d\t%d\t%d\t", r->cnt1, r->cnt2, r->cnt_anti);
-               printf("%d\t%d\n", r->cnt_ref, r->cnt_ambi);
-               bam_maqindel_ret_destroy(r);
-       }
-       return 0;
-}
-
-int bam_pileup(int argc, char *argv[])
-{
-       int c, is_SAM = 0;
-       char *fn_list = 0, *fn_fa = 0, *fn_pos = 0;
-       pu_data_t *d = (pu_data_t*)calloc(1, sizeof(pu_data_t));
-    d->max_depth = 1024; d->tid = -1; d->mask = BAM_DEF_MASK; d->min_baseQ = 13;
-       d->c = bam_maqcns_init();
-       d->c->errmod = BAM_ERRMOD_MAQ2; // change the default model
-       d->ido = bam_maqindel_opt_init();
-       while ((c = getopt(argc, argv, "st:f:cT:N:r:l:d:im:gI:G:vM:S2aR:PAQ:C:B")) >= 0) {
-               switch (c) {
-               case 'Q': d->c->min_baseQ = atoi(optarg); break;
-               case 'C': d->capQ_thres = atoi(optarg); break;
-               case 'B': d->format |= BAM_PLF_NOBAQ; break;
-               case 'a': d->c->errmod = BAM_ERRMOD_SOAP; break;
-               case 'A': d->c->errmod = BAM_ERRMOD_MAQ; break;
-               case 's': d->format |= BAM_PLF_SIMPLE; break;
-               case 't': fn_list = strdup(optarg); break;
-               case 'l': fn_pos = strdup(optarg); break;
-               case 'f': fn_fa = strdup(optarg); break;
-               case 'T': d->c->theta = atof(optarg); break;
-               case 'N': d->c->n_hap = atoi(optarg); break;
-               case 'r': d->c->het_rate = atof(optarg); d->ido->r_snp = d->c->het_rate; break;
-               case 'M': d->c->cap_mapQ = atoi(optarg); break;
-               case 'd': d->max_depth = atoi(optarg); break;
-               case 'c': d->format |= BAM_PLF_CNS; break;
-               case 'i': d->format |= BAM_PLF_INDEL_ONLY; break;
-               case 'v': d->format |= BAM_PLF_VAR_ONLY; break;
-               case 'm': d->mask = strtol(optarg, 0, 0); break;
-               case 'g': d->format |= BAM_PLF_GLF; break;
-               case '2': d->format |= BAM_PLF_2ND; break;
-               case 'P': d->format |= BAM_PLF_READPOS; break;
-               case 'I': d->ido->q_indel = atoi(optarg); break;
-               case 'G': d->ido->r_indel = atof(optarg); break;
-               case 'S': is_SAM = 1; break;
-               case 'R':
-                       if (strcmp(optarg, "random") == 0) d->format |= BAM_PLF_RANBASE;
-                       else if (strcmp(optarg, "first") == 0) d->format |= BAM_PLF_1STBASE;
-                       else if (strcmp(optarg, "all") == 0) d->format |= BAM_PLF_ALLBASE;
-                       else fprintf(pysamerr, "[bam_pileup] unrecognized -R\n");
-                       break;
-               default: fprintf(pysamerr, "Unrecognizd option '-%c'.\n", c); return 1;
-               }
-       }
-       if (d->c->errmod != BAM_ERRMOD_MAQ2) d->c->theta += 0.02;
-       if (d->c->theta > 1.0) d->c->theta = 1.0;
-       if (fn_list) is_SAM = 1;
-       if (optind == argc) {
-               fprintf(pysamerr, "\n");
-               fprintf(pysamerr, "Usage:  samtools pileup [options] <in.bam>|<in.sam>\n\n");
-               fprintf(pysamerr, "Option: -s        simple (yet incomplete) pileup format\n");
-               fprintf(pysamerr, "        -S        the input is in SAM\n");
-               fprintf(pysamerr, "        -B        disable BAQ computation\n");
-               fprintf(pysamerr, "        -A        use the original MAQ model for SNP calling (DEPRECATED)\n");
-               fprintf(pysamerr, "        -2        output the 2nd best call and quality\n");
-               fprintf(pysamerr, "        -i        only show lines/consensus with indels\n");
-               fprintf(pysamerr, "        -Q INT    min base quality (possibly capped by BAQ) [%d]\n", d->c->min_baseQ);
-               fprintf(pysamerr, "        -C INT    coefficient for adjusting mapQ of poor mappings [%d]\n", d->capQ_thres);
-               fprintf(pysamerr, "        -m INT    filtering reads with bits in INT [0x%x]\n", d->mask);
-               fprintf(pysamerr, "        -M INT    cap mapping quality at INT [%d]\n", d->c->cap_mapQ);
-        fprintf(pysamerr, "        -d INT    limit maximum depth for indels [%d]\n", d->max_depth);
-               fprintf(pysamerr, "        -t FILE   list of reference sequences (force -S)\n");
-               fprintf(pysamerr, "        -l FILE   list of sites at which pileup is output\n");
-               fprintf(pysamerr, "        -f FILE   reference sequence in the FASTA format\n\n");
-               fprintf(pysamerr, "        -c        compute the consensus sequence\n");
-               fprintf(pysamerr, "        -v        print variants only (for -c)\n");
-               fprintf(pysamerr, "        -g        output in the GLFv3 format (DEPRECATED)\n");
-               fprintf(pysamerr, "        -T FLOAT  theta in maq consensus calling model (for -c) [%.4g]\n", d->c->theta);
-               fprintf(pysamerr, "        -N INT    number of haplotypes in the sample (for -c) [%d]\n", d->c->n_hap);
-               fprintf(pysamerr, "        -r FLOAT  prior of a difference between two haplotypes (for -c) [%.4g]\n", d->c->het_rate);
-               fprintf(pysamerr, "        -G FLOAT  prior of an indel between two haplotypes (for -c) [%.4g]\n", d->ido->r_indel);
-               fprintf(pysamerr, "        -I INT    phred prob. of an indel in sequencing/prep. (for -c) [%d]\n", d->ido->q_indel);
-               fprintf(pysamerr, "\n");
-               fprintf(pysamerr, "Warning: Please use the `mpileup' command instead `pileup'. `Pileup' is deprecated!\n\n");
-               free(fn_list); free(fn_fa); free(d);
-               return 1;
-       }
-       if (d->format & (BAM_PLF_RANBASE|BAM_PLF_1STBASE|BAM_PLF_ALLBASE)) d->format |= BAM_PLF_CNS;
-       if (fn_fa) d->fai = fai_load(fn_fa);
-       if (d->format & (BAM_PLF_CNS|BAM_PLF_GLF)) bam_maqcns_prepare(d->c); // consensus calling
-       if (d->format & BAM_PLF_GLF) { // for glf output
-               glf3_header_t *h;
-               h = glf3_header_init();
-               d->fp_glf = bgzf_fdopen(fileno(stdout), "w");
-               glf3_header_write(d->fp_glf, h);
-               glf3_header_destroy(h);
-       }
-       if (d->fai == 0 && (d->format & (BAM_PLF_CNS|BAM_PLF_INDEL_ONLY)))
-               fprintf(pysamerr, "[bam_pileup] indels will not be called when -f is absent.\n");
-       if (fn_fa && is_SAM && fn_list == 0) fn_list = samfaipath(fn_fa);
-
-       {
-               samfile_t *fp;
-               fp = is_SAM? samopen(argv[optind], "r", fn_list) : samopen(argv[optind], "rb", 0);
-               if (fp == 0 || fp->header == 0) {
-                       fprintf(pysamerr, "[bam_pileup] fail to read the header: non-exisiting file or wrong format.\n");
-                       return 1;
-               }
-               d->h = fp->header;
-               if (fn_pos) d->hash = load_pos(fn_pos, d->h);
-               { // run pileup
-                       extern int bam_prob_realn(bam1_t *b, const char *ref);
-                       extern int bam_cap_mapQ(bam1_t *b, char *ref, int thres);
-                       bam1_t *b;
-                       int ret, tid, pos, n_plp;
-                       bam_plp_t iter;
-                       const bam_pileup1_t *plp;
-                       b = bam_init1();
-                       iter = bam_plp_init(0, 0);
-                       bam_plp_set_mask(iter, d->mask);
-                       while ((ret = samread(fp, b)) >= 0) {
-                               int skip = 0;
-                               if ((int)b->core.tid < 0) break;
-                               // update d->ref if necessary
-                               if (d->fai && (int)b->core.tid != d->tid) {
-                                       free(d->ref);
-                                       d->ref = faidx_fetch_seq(d->fai, d->h->target_name[b->core.tid], 0, 0x7fffffff, &d->len);
-                                       d->tid = b->core.tid;
-                               }
-                               if (d->ref && (d->format&BAM_PLF_CNS) && !(d->format&BAM_PLF_NOBAQ)) bam_prob_realn(b, d->ref);
-                               if (d->ref && (d->format&BAM_PLF_CNS) && d->capQ_thres > 10) {
-                                       int q = bam_cap_mapQ(b, d->ref, d->capQ_thres);
-                                       if (q < 0) skip = 1;
-                                       else if (b->core.qual > q) b->core.qual = q;
-                               } else if (b->core.flag&BAM_FUNMAP) skip = 1;
-                               else if ((d->format&BAM_PLF_CNS) && (b->core.flag&1) && !(b->core.flag&2)) skip = 1;
-                               if (skip) continue;
-                               bam_plp_push(iter, b);
-                               while ((plp = bam_plp_next(iter, &tid, &pos, &n_plp)) != 0)
-                                       pileup_func(tid, pos, n_plp, plp, d);
-                       }
-                       bam_plp_push(iter, 0);
-                       while ((plp = bam_plp_next(iter, &tid, &pos, &n_plp)) != 0)
-                               pileup_func(tid, pos, n_plp, plp, d);
-                       bam_plp_destroy(iter);
-                       bam_destroy1(b);
-               }
-               samclose(fp); // d->h will be destroyed here
-       }
-
-       // free
-       if (d->format & BAM_PLF_GLF) bgzf_close(d->fp_glf);
-       if (fn_pos) { // free the hash table
-               khint_t k;
-               for (k = kh_begin(d->hash); k < kh_end(d->hash); ++k)
-                       if (kh_exist(d->hash, k)) free(kh_val(d->hash, k));
-               kh_destroy(64, d->hash);
-       }
-       free(fn_pos); free(fn_list); free(fn_fa);
-       if (d->fai) fai_destroy(d->fai);
-       bam_maqcns_destroy(d->c);
-       free(d->ido); free(d->ref); free(d);
-       return 0;
-}
-
-/***********
- * mpileup *
- ***********/
-
 #include <assert.h>
 #include "bam2bcf.h"
 #include "sample.h"
@@ -538,6 +73,9 @@ int bam_pileup(int argc, char *argv[])
 #define MPLP_NO_INDEL 0x400
 #define MPLP_EXT_BAQ 0x800
 #define MPLP_ILLUMINA13 0x1000
+#define MPLP_IGNORE_RG 0x2000
+#define MPLP_PRINT_POS 0x4000
+#define MPLP_PRINT_MAPQ 0x8000
 
 void *bed_read(const char *fn);
 void bed_destroy(void *_h);
@@ -612,7 +150,7 @@ static int mplp_func(void *data, bam1_t *b)
 }
 
 static void group_smpl(mplp_pileup_t *m, bam_sample_t *sm, kstring_t *buf,
-                                          int n, char *const*fn, int *n_plp, const bam_pileup1_t **plp)
+                                          int n, char *const*fn, int *n_plp, const bam_pileup1_t **plp, int ignore_rg)
 {
        int i, j;
        memset(m->n_plp, 0, m->n * sizeof(int));
@@ -621,7 +159,7 @@ static void group_smpl(mplp_pileup_t *m, bam_sample_t *sm, kstring_t *buf,
                        const bam_pileup1_t *p = plp[i] + j;
                        uint8_t *q;
                        int id = -1;
-                       q = bam_aux_get(p->b, "RG");
+                       q = ignore_rg? 0 : bam_aux_get(p->b, "RG");
                        if (q) id = bam_smpl_rg2smid(sm, fn[i], (char*)q+1, buf);
                        if (id < 0) id = bam_smpl_rg2smid(sm, fn[i], 0, buf);
                        if (id < 0 || id >= m->n) {
@@ -643,7 +181,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
        extern void *bcf_call_add_rg(void *rghash, const char *hdtext, const char *list);
        extern void bcf_call_del_rghash(void *rghash);
        mplp_aux_t **data;
-       int i, tid, pos, *n_plp, beg0 = 0, end0 = 1u<<29, ref_len, ref_tid, max_depth, max_indel_depth;
+       int i, tid, pos, *n_plp, tid0 = -1, beg0 = 0, end0 = 1u<<29, ref_len, ref_tid = -1, max_depth, max_indel_depth;
        const bam_pileup1_t **plp;
        bam_mplp_t iter;
        bam_header_t *h = 0;
@@ -676,7 +214,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                data[i]->conf = conf;
                h_tmp = bam_header_read(data[i]->fp);
                data[i]->h = i? h : h_tmp; // for i==0, "h" has not been set yet
-               bam_smpl_add(sm, fn[i], h_tmp->text);
+               bam_smpl_add(sm, fn[i], (conf->flag&MPLP_IGNORE_RG)? 0 : h_tmp->text);
                rghash = bcf_call_add_rg(rghash, h_tmp->text, conf->pl_list);
                if (conf->reg) {
                        int beg, end;
@@ -690,7 +228,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                                fprintf(pysamerr, "[%s] malformatted region or wrong seqname for %d-th input.\n", __func__, i+1);
                                exit(1);
                        }
-                       if (i == 0) beg0 = beg, end0 = end;
+                       if (i == 0) tid0 = tid, beg0 = beg, end0 = end;
                        data[i]->iter = bam_iter_query(idx, tid, beg, end);
                        bam_index_destroy(idx);
                }
@@ -738,7 +276,11 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                bca->min_frac = conf->min_frac;
                bca->min_support = conf->min_support;
        }
-       ref_tid = -1; ref = 0;
+       if (tid0 >= 0 && conf->fai) { // region is set
+               ref = faidx_fetch_seq(conf->fai, h->target_name[tid0], 0, 0x7fffffff, &ref_len);
+               ref_tid = tid0;
+               for (i = 0; i < n; ++i) data[i]->ref = ref, data[i]->ref_id = tid0;
+       } else ref_tid = -1, ref = 0;
        iter = bam_mplp_init(n, mplp_func, (void**)data);
        max_depth = conf->max_depth;
        if (max_depth * sm->n > 1<<20)
@@ -754,7 +296,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                if (conf->bed && tid >= 0 && !bed_overlap(conf->bed, h->target_name[tid], pos, pos+1)) continue;
                if (tid != ref_tid) {
                        free(ref); ref = 0;
-                       if (conf->fai) ref = fai_fetch(conf->fai, h->target_name[tid], &ref_len);
+                       if (conf->fai) ref = faidx_fetch_seq(conf->fai, h->target_name[tid], 0, 0x7fffffff, &ref_len);
                        for (i = 0; i < n; ++i) data[i]->ref = ref, data[i]->ref_id = tid;
                        ref_tid = tid;
                }
@@ -762,7 +304,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                        int total_depth, _ref0, ref16;
                        bcf1_t *b = calloc(1, sizeof(bcf1_t));
                        for (i = total_depth = 0; i < n; ++i) total_depth += n_plp[i];
-                       group_smpl(&gplp, sm, &buf, n, fn, n_plp, plp);
+                       group_smpl(&gplp, sm, &buf, n, fn, n_plp, plp, conf->flag & MPLP_IGNORE_RG);
                        _ref0 = (ref && pos < ref_len)? ref[pos] : 'N';
                        ref16 = bam_nt16_table[_ref0];
                        for (i = 0; i < gplp.n; ++i)
@@ -789,8 +331,10 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                        for (i = 0; i < n; ++i) {
                                int j;
                                printf("\t%d\t", n_plp[i]);
-                               if (n_plp[i] == 0) printf("*\t*");
-                               else {
+                               if (n_plp[i] == 0) {
+                                       printf("*\t*"); // FIXME: printf() is very slow...
+                                       if (conf->flag & MPLP_PRINT_POS) printf("\t*");
+                               } else {
                                        for (j = 0; j < n_plp[i]; ++j)
                                                pileup_seq(plp[i] + j, pos, ref_len, ref);
                                        putchar('\t');
@@ -800,6 +344,21 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                                                if (c > 126) c = 126;
                                                putchar(c);
                                        }
+                                       if (conf->flag & MPLP_PRINT_MAPQ) {
+                                               putchar('\t');
+                                               for (j = 0; j < n_plp[i]; ++j) {
+                                                       int c = plp[i][j].b->core.qual + 33;
+                                                       if (c > 126) c = 126;
+                                                       putchar(c);
+                                               }
+                                       }
+                                       if (conf->flag & MPLP_PRINT_POS) {
+                                               putchar('\t');
+                                               for (j = 0; j < n_plp[i]; ++j) {
+                                                       if (j > 0) putchar(',');
+                                                       printf("%d", plp[i][j].qpos + 1); // FIXME: printf() is very slow...
+                                               }
+                                       }
                                }
                        }
                        putchar('\n');
@@ -880,6 +439,7 @@ int bam_mpileup(int argc, char *argv[])
     int nfiles = 0, use_orphan = 0;
        mplp_conf_t mplp;
        memset(&mplp, 0, sizeof(mplp_conf_t));
+       #define MPLP_PRINT_POS 0x4000
        mplp.max_mq = 60;
        mplp.min_baseQ = 13;
        mplp.capQ_thres = 0;
@@ -887,7 +447,7 @@ int bam_mpileup(int argc, char *argv[])
        mplp.openQ = 40; mplp.extQ = 20; mplp.tandemQ = 100;
        mplp.min_frac = 0.002; mplp.min_support = 1;
        mplp.flag = MPLP_NO_ORPHAN | MPLP_REALN;
-       while ((c = getopt(argc, argv, "Agf:r:l:M:q:Q:uaRC:BDSd:L:b:P:o:e:h:Im:F:EG:6")) >= 0) {
+       while ((c = getopt(argc, argv, "Agf:r:l:M:q:Q:uaRC:BDSd:L:b:P:o:e:h:Im:F:EG:6Os")) >= 0) {
                switch (c) {
                case 'f':
                        mplp.fai = fai_load(optarg);
@@ -901,12 +461,14 @@ int bam_mpileup(int argc, char *argv[])
                case 'u': mplp.flag |= MPLP_NO_COMP | MPLP_GLF; break;
                case 'a': mplp.flag |= MPLP_NO_ORPHAN | MPLP_REALN; break;
                case 'B': mplp.flag &= ~MPLP_REALN; break;
-               case 'R': mplp.flag |= MPLP_REALN; break;
                case 'D': mplp.flag |= MPLP_FMT_DP; break;
                case 'S': mplp.flag |= MPLP_FMT_SP; break;
                case 'I': mplp.flag |= MPLP_NO_INDEL; break;
                case 'E': mplp.flag |= MPLP_EXT_BAQ; break;
                case '6': mplp.flag |= MPLP_ILLUMINA13; break;
+               case 'R': mplp.flag |= MPLP_IGNORE_RG; break;
+               case 's': mplp.flag |= MPLP_PRINT_MAPQ; break;
+               case 'O': mplp.flag |= MPLP_PRINT_POS; break;
                case 'C': mplp.capQ_thres = atoi(optarg); break;
                case 'M': mplp.max_mq = atoi(optarg); break;
                case 'q': mplp.min_mq = atoi(optarg); break;
@@ -941,6 +503,7 @@ int bam_mpileup(int argc, char *argv[])
                fprintf(pysamerr, "       -A           count anomalous read pairs\n");
                fprintf(pysamerr, "       -B           disable BAQ computation\n");
                fprintf(pysamerr, "       -b FILE      list of input BAM files [null]\n");
+               fprintf(pysamerr, "       -C INT       parameter for adjusting mapQ; 0 to disable [0]\n");
                fprintf(pysamerr, "       -d INT       max per-BAM depth to avoid excessive memory usage [%d]\n", mplp.max_depth);
                fprintf(pysamerr, "       -E           extended BAQ for higher sensitivity but lower specificity\n");
                fprintf(pysamerr, "       -f FILE      faidx indexed reference sequence file [null]\n");
@@ -948,11 +511,14 @@ int bam_mpileup(int argc, char *argv[])
                fprintf(pysamerr, "       -l FILE      list of positions (chr pos) or regions (BED) [null]\n");
                fprintf(pysamerr, "       -M INT       cap mapping quality at INT [%d]\n", mplp.max_mq);
                fprintf(pysamerr, "       -r STR       region in which pileup is generated [null]\n");
+               fprintf(pysamerr, "       -R           ignore RG tags\n");
                fprintf(pysamerr, "       -q INT       skip alignments with mapQ smaller than INT [%d]\n", mplp.min_mq);
                fprintf(pysamerr, "       -Q INT       skip bases with baseQ/BAQ smaller than INT [%d]\n", mplp.min_baseQ);
                fprintf(pysamerr, "\nOutput options:\n\n");
                fprintf(pysamerr, "       -D           output per-sample DP in BCF (require -g/-u)\n");
                fprintf(pysamerr, "       -g           generate BCF output (genotype likelihoods)\n");
+               fprintf(pysamerr, "       -O           output base positions on reads (disabled by -g/-u)\n");
+               fprintf(pysamerr, "       -s           output mapping quality (disabled by -g/-u)\n");
                fprintf(pysamerr, "       -S           output per-sample strand bias P-value in BCF (require -g/-u)\n");
                fprintf(pysamerr, "       -u           generate uncompress BCF output\n");
                fprintf(pysamerr, "\nSNP/INDEL genotype likelihoods options (effective with `-g' or `-u'):\n\n");
diff --git a/samtools/bam_reheader.c.pysam.c b/samtools/bam_reheader.c.pysam.c
new file mode 100644 (file)
index 0000000..35154d7
--- /dev/null
@@ -0,0 +1,63 @@
+#include "pysam.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "bgzf.h"
+#include "bam.h"
+
+#define BUF_SIZE 0x10000
+
+int bam_reheader(BGZF *in, const bam_header_t *h, int fd)
+{
+       BGZF *fp;
+       bam_header_t *old;
+       int len;
+       uint8_t *buf;
+       if (in->open_mode != 'r') return -1;
+       buf = malloc(BUF_SIZE);
+       old = bam_header_read(in);
+       fp = bgzf_fdopen(fd, "w");
+       bam_header_write(fp, h);
+       if (in->block_offset < in->block_length) {
+               bgzf_write(fp, in->uncompressed_block + in->block_offset, in->block_length - in->block_offset);
+               bgzf_flush(fp);
+       }
+#ifdef _USE_KNETFILE
+       while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0)
+               fwrite(buf, 1, len, fp->x.fpw);
+#else
+       while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0)
+               fwrite(buf, 1, len, fp->file);
+#endif
+       free(buf);
+       fp->block_offset = in->block_offset = 0;
+       bgzf_close(fp);
+       return 0;
+}
+
+int main_reheader(int argc, char *argv[])
+{
+       bam_header_t *h;
+       BGZF *in;
+       if (argc != 3) {
+               fprintf(pysamerr, "Usage: samtools reheader <in.header.sam> <in.bam>\n");
+               return 1;
+       }
+       { // read the header
+               tamFile fph = sam_open(argv[1]);
+               if (fph == 0) {
+                       fprintf(pysamerr, "[%s] fail to read the header from %s.\n", __func__, argv[1]);
+                       return 1;
+               }
+               h = sam_header_read(fph);
+               sam_close(fph);
+       }
+       in = strcmp(argv[2], "-")? bam_open(argv[2], "r") : bam_dopen(fileno(stdin), "r");
+       if (in == 0) {
+               fprintf(pysamerr, "[%s] fail to open file %s.\n", __func__, argv[2]);
+               return 1;
+       }
+       bam_reheader(in, h, fileno(stdout));
+       bgzf_close(in);
+       return 0;
+}
index d4abf671f143fe803c9919ecf6dc7c85b1a7e01a..3709702b57d0bae19adf98a24f926be3ae910227 100644 (file)
 #include <ctype.h>
 #include <assert.h>
 #include <string.h>
+#include <math.h>
 #include "bam.h"
 #include "faidx.h"
-#include "bam_maqcns.h"
+#include "bam2bcf.h"
 
 char bam_aux_getCEi(bam1_t *b, int i);
 char bam_aux_getCSi(bam1_t *b, int i);
@@ -52,7 +53,7 @@ typedef struct {
        bamFile fp;
        int curr_tid, left_pos;
        faidx_t *fai;
-       bam_maqcns_t *bmc;
+       bcf_callaux_t *bca;
 
        int ccol, last_pos, row_shift, base_for, color_for, is_dot, l_ref, ins, no_skip, show_name;
        char *ref;
@@ -60,6 +61,7 @@ typedef struct {
 
 int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void *data)
 {
+       extern unsigned char bam_nt16_table[256];
        tview_t *tv = (tview_t*)data;
        int i, j, c, rb, attr, max_ins = 0;
        uint32_t call = 0;
@@ -72,11 +74,26 @@ int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void
                mvaddch(1, tv->ccol++, c);
        }
        if (pos%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", pos+1);
-       // print consensus
-       call = bam_maqcns_call(n, pl, tv->bmc);
+       { // call consensus
+               bcf_callret1_t bcr;
+               int qsum[4], a1, a2, tmp;
+               double p[3], prior = 30;
+               bcf_call_glfgen(n, pl, bam_nt16_table[rb], tv->bca, &bcr);
+               for (i = 0; i < 4; ++i) qsum[i] = bcr.qsum[i]<<2 | i;
+               for (i = 1; i < 4; ++i) // insertion sort
+                       for (j = i; j > 0 && qsum[j] > qsum[j-1]; --j)
+                               tmp = qsum[j], qsum[j] = qsum[j-1], qsum[j-1] = tmp;
+               a1 = qsum[0]&3; a2 = qsum[1]&3;
+               p[0] = bcr.p[a1*5+a1]; p[1] = bcr.p[a1*5+a2] + prior; p[2] = bcr.p[a2*5+a2];
+               if ("ACGT"[a1] != toupper(rb)) p[0] += prior + 3;
+               if ("ACGT"[a2] != toupper(rb)) p[2] += prior + 3;
+               if (p[0] < p[1] && p[0] < p[2]) call = (1<<a1)<<16 | (int)((p[1]<p[2]?p[1]:p[2]) - p[0] + .499);
+               else if (p[2] < p[1] && p[2] < p[0]) call = (1<<a2)<<16 | (int)((p[0]<p[1]?p[0]:p[1]) - p[2] + .499);
+               else call = (1<<a1|1<<a2)<<16 | (int)((p[0]<p[2]?p[0]:p[2]) - p[1] + .499);
+       }
        attr = A_UNDERLINE;
-       c = ",ACMGRSVTWYHKDBN"[call>>28&0xf];
-       i = (call>>8&0xff)/10+1;
+       c = ",ACMGRSVTWYHKDBN"[call>>16&0xf];
+       i = (call&0xffff)/10+1;
        if (i > 4) i = 4;
        attr |= COLOR_PAIR(i);
        if (c == toupper(rb)) c = '.';
@@ -193,9 +210,8 @@ tview_t *tv_init(const char *fn, const char *fn_fa)
        if (tv->idx == 0) exit(1);
        tv->lplbuf = bam_lplbuf_init(tv_pl_func, tv);
        if (fn_fa) tv->fai = fai_load(fn_fa);
-       tv->bmc = bam_maqcns_init();
+       tv->bca = bcf_call_init(0.83, 13);
        tv->ins = 1;
-       bam_maqcns_prepare(tv->bmc);
 
        initscr();
        keypad(stdscr, TRUE);
@@ -226,7 +242,7 @@ void tv_destroy(tview_t *tv)
        endwin();
 
        bam_lplbuf_destroy(tv->lplbuf);
-       bam_maqcns_destroy(tv->bmc);
+       bcf_call_destroy(tv->bca);
        bam_index_destroy(tv->idx);
        if (tv->fai) fai_destroy(tv->fai);
        free(tv->ref);
index ba6dbe9b42ae033c6b3c179a730a48312cf927dd..822ae5cf80fd7f9dc375259524935c933f088323 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef BCF_H
 #define BCF_H
 
+#define BCF_VERSION "0.1.17-dev (r973:277)"
+
 #include <stdint.h>
 #include <zlib.h>
 
@@ -150,6 +152,10 @@ extern "C" {
        int bcf_fix_gt(bcf1_t *b);
        // update PL generated by old samtools
        int bcf_fix_pl(bcf1_t *b);
+       // convert PL to GLF-like 10-likelihood GL
+       int bcf_gl10(const bcf1_t *b, uint8_t *gl);
+       // convert up to 4 INDEL alleles to GLF-like 10-likelihood GL
+       int bcf_gl10_indel(const bcf1_t *b, uint8_t *gl);
 
        // string hash table
        void *bcf_build_refhash(bcf_hdr_t *h);
index c48ab03c29cbcbd08c84f3cfd13ae1f8b1d81678..110d0bb0855f59ec2e8eacb7fc0d144bd5ebb1b3 100644 (file)
@@ -7,6 +7,12 @@
 #include "khash.h"
 KHASH_MAP_INIT_STR(str2id, int)
 
+#ifdef _WIN32
+#define srand48(x) srand(x)
+#define drand48() ((double)rand() / RAND_MAX)
+#endif
+
+// FIXME: valgrind report a memory leak in this function. Probably it does not get deallocated...
 void *bcf_build_refhash(bcf_hdr_t *h)
 {
        khash_t(str2id) *hash;
@@ -310,3 +316,77 @@ int bcf_subsam(int n_smpl, int *list, bcf1_t *b)
        b->n_smpl = n_smpl;
        return 0;
 }
+
+static int8_t nt4_table[128] = {
+       4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4, 
+       4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4, 
+       4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4,  4, 4 /*'-'*/, 4, 4,
+       4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4,  4, 4, 4, 4, 
+       4, 0, 4, 1,  4, 4, 4, 2,  4, 4, 4, 4,  4, 4, 4, 4, 
+       4, 4, 4, 4,  3, 4, 4, 4, -1, 4, 4, 4,  4, 4, 4, 4, 
+       4, 0, 4, 1,  4, 4, 4, 2,  4, 4, 4, 4,  4, 4, 4, 4, 
+       4, 4, 4, 4,  3, 4, 4, 4, -1, 4, 4, 4,  4, 4, 4, 4
+};
+
+int bcf_gl10(const bcf1_t *b, uint8_t *gl)
+{
+       int a[4], k, l, map[4], k1, j, i;
+       const bcf_ginfo_t *PL;
+       char *s;
+       if (b->ref[1] != 0 || b->n_alleles > 4) return -1; // ref is not a single base or >4 alleles
+       for (i = 0; i < b->n_gi; ++i)
+               if (b->gi[i].fmt == bcf_str2int("PL", 2)) break;
+       if (i == b->n_gi) return -1; // no PL
+       PL = b->gi + i;
+       a[0] = nt4_table[(int)b->ref[0]];
+       if (a[0] > 3 || a[0] < 0) return -1; // ref is not A/C/G/T
+       a[1] = a[2] = a[3] = -2; // -1 has a special meaning
+       if (b->alt[0] == 0) return -1; // no alternate allele
+       map[0] = map[1] = map[2] = map[3] = -2;
+       map[a[0]] = 0;
+       for (k = 0, s = b->alt, k1 = -1; k < 3 && *s; ++k, s += 2) {
+               if (s[1] != ',' && s[1] != 0) return -1; // ALT is not single base
+               a[k+1] = nt4_table[(int)*s];
+               if (a[k+1] >= 0) map[a[k+1]] = k+1;
+               else k1 = k + 1;
+               if (s[1] == 0) break; // the end of the ALT string
+       }
+       for (k = 0; k < 4; ++k)
+               if (map[k] < 0) map[k] = k1;
+       for (i = 0; i < b->n_smpl; ++i) {
+               const uint8_t *p = PL->data + i * PL->len; // the PL for the i-th individual
+               uint8_t *g = gl + 10 * i;
+               for (k = j = 0; k < 4; ++k) {
+                       for (l = k; l < 4; ++l) {
+                               int t, x = map[k], y = map[l];
+                               if (x > y) t = x, x = y, y = t; // make sure x is the smaller
+                               g[j++] = p[y * (y+1) / 2 + x];
+                       }
+               }
+       }
+       return 0;
+}
+
+int bcf_gl10_indel(const bcf1_t *b, uint8_t *gl)
+{
+       int k, l, j, i;
+       const bcf_ginfo_t *PL;
+       if (b->alt[0] == 0) return -1; // no alternate allele
+       for (i = 0; i < b->n_gi; ++i)
+               if (b->gi[i].fmt == bcf_str2int("PL", 2)) break;
+       if (i == b->n_gi) return -1; // no PL
+       PL = b->gi + i;
+       for (i = 0; i < b->n_smpl; ++i) {
+               const uint8_t *p = PL->data + i * PL->len; // the PL for the i-th individual
+               uint8_t *g = gl + 10 * i;
+               for (k = j = 0; k < 4; ++k) {
+                       for (l = k; l < 4; ++l) {
+                               int t, x = k, y = l;
+                               if (x > y) t = x, x = y, y = t; // make sure x is the smaller
+                               x = y * (y+1) / 2 + x;
+                               g[j++] = x < PL->len? p[x] : 255;
+                       }
+               }
+       }
+       return 0;
+}
index 378c3d5bb4be6f697b9c0d90cb777353a51b4d5c..fcd2456975e6dc804de79057b268c75fdc645bfd 100644 (file)
 #include "kstring.h"
 #include "time.h"
 
+#ifdef _WIN32
+#define srand48(x) srand(x)
+#define lrand48() rand()
+#endif
+
 #include "kseq.h"
 KSTREAM_INIT(gzFile, gzread, 16384)
 
@@ -28,9 +33,12 @@ KSTREAM_INIT(gzFile, gzread, 16384)
 #define VC_ANNO_MAX 16384
 #define VC_FIX_PL   32768
 #define VC_EM       0x10000
+#define VC_PAIRCALL 0x20000
+#define VC_QCNT     0x40000
 
 typedef struct {
        int flag, prior_type, n1, n_sub, *sublist, n_perm;
+       uint32_t *trio_aux;
        char *prior_file, **subsam, *fn_dict;
        uint8_t *ploidy;
        double theta, pref, indel_frac, min_perm_p, min_smpl_frac, min_lrt;
@@ -104,7 +112,7 @@ static void rm_info(bcf1_t *b, const char *key)
        bcf_sync(b);
 }
 
-static int update_bcf1(bcf1_t *b, const bcf_p1aux_t *pa, const bcf_p1rst_t *pr, double pref, int flag, double em[9])
+static int update_bcf1(bcf1_t *b, const bcf_p1aux_t *pa, const bcf_p1rst_t *pr, double pref, int flag, double em[10], int cons_llr, int64_t cons_gt)
 {
        kstring_t s;
        int has_I16, is_var;
@@ -124,6 +132,13 @@ static int update_bcf1(bcf1_t *b, const bcf_p1aux_t *pa, const bcf_p1rst_t *pr,
                if (em[4] >= 0 && em[4] <= 0.05) ksprintf(&s, ";G3=%.4g,%.4g,%.4g;HWE=%.3g", em[3], em[2], em[1], em[4]);
                if (em[5] >= 0 && em[6] >= 0) ksprintf(&s, ";AF2=%.4g,%.4g", 1 - em[5], 1 - em[6]);
                if (em[7] >= 0) ksprintf(&s, ";LRT=%.3g", em[7]);
+               if (em[8] >= 0) ksprintf(&s, ";LRT2=%.3g", em[8]);
+       }
+       if (cons_llr > 0) {
+               ksprintf(&s, ";CLR=%d", cons_llr);
+               if (cons_gt > 0)
+                       ksprintf(&s, ";UGT=%c%c%c;CGT=%c%c%c", cons_gt&0xff, cons_gt>>8&0xff, cons_gt>>16&0xff,
+                                    cons_gt>>32&0xff, cons_gt>>40&0xff, cons_gt>>48&0xff);
        }
        if (pr == 0) { // if pr is unset, return
                kputc('\0', &s); kputs(b->fmt, &s); kputc('\0', &s);
@@ -136,7 +151,8 @@ static int update_bcf1(bcf1_t *b, const bcf_p1aux_t *pa, const bcf_p1rst_t *pr,
        is_var = (pr->p_ref < pref);
        r = is_var? pr->p_ref : pr->p_var;
 
-       ksprintf(&s, ";CI95=%.4g,%.4g", pr->cil, pr->cih); // FIXME: when EM is not used, ";" should be omitted!
+//     ksprintf(&s, ";CI95=%.4g,%.4g", pr->cil, pr->cih); // FIXME: when EM is not used, ";" should be omitted!
+       ksprintf(&s, ";AC1=%d", pr->ac);
        if (has_I16) ksprintf(&s, ";DP4=%d,%d,%d,%d;MQ=%d", a.d[0], a.d[1], a.d[2], a.d[3], a.mq);
        fq = pr->p_ref_folded < 0.5? -4.343 * log(pr->p_ref_folded) : 4.343 * log(pr->p_var_folded);
        if (fq < -999) fq = -999;
@@ -150,6 +166,7 @@ static int update_bcf1(bcf1_t *b, const bcf_p1aux_t *pa, const bcf_p1rst_t *pr,
                        if (q[i] > 255) q[i] = 255;
                }
                if (pr->perm_rank >= 0) ksprintf(&s, ";PR=%d", pr->perm_rank);
+               // ksprintf(&s, ";LRT3=%.3g", pr->lrt);
                ksprintf(&s, ";PCHI2=%.3g;PC2=%d,%d", q[1], q[2], pr->p_chi2);
        }
        if (has_I16 && a.is_tested) ksprintf(&s, ";PV4=%.2g,%.2g,%.2g,%.2g", a.p[0], a.p[1], a.p[2], a.p[3]);
@@ -231,13 +248,21 @@ static void write_header(bcf_hdr_t *h)
        if (!strstr(str.s, "##INFO=<ID=FQ,"))
                kputs("##INFO=<ID=FQ,Number=1,Type=Float,Description=\"Phred probability of all samples being the same\">\n", &str);
        if (!strstr(str.s, "##INFO=<ID=AF1,"))
-               kputs("##INFO=<ID=AF1,Number=1,Type=Float,Description=\"Max-likelihood estimate of the site allele frequency of the first ALT allele\">\n", &str);
+               kputs("##INFO=<ID=AF1,Number=1,Type=Float,Description=\"Max-likelihood estimate of the first ALT allele frequency (assuming HWE)\">\n", &str);
+       if (!strstr(str.s, "##INFO=<ID=AC1,"))
+               kputs("##INFO=<ID=AC1,Number=1,Type=Float,Description=\"Max-likelihood estimate of the first ALT allele count (no HWE assumption)\">\n", &str);
        if (!strstr(str.s, "##INFO=<ID=G3,"))
                kputs("##INFO=<ID=G3,Number=3,Type=Float,Description=\"ML estimate of genotype frequencies\">\n", &str);
        if (!strstr(str.s, "##INFO=<ID=HWE,"))
                kputs("##INFO=<ID=HWE,Number=1,Type=Float,Description=\"Chi^2 based HWE test P-value based on G3\">\n", &str);
-       if (!strstr(str.s, "##INFO=<ID=CI95,"))
-               kputs("##INFO=<ID=CI95,Number=2,Type=Float,Description=\"Equal-tail Bayesian credible interval of the site allele frequency at the 95% level\">\n", &str);
+       if (!strstr(str.s, "##INFO=<ID=CLR,"))
+               kputs("##INFO=<ID=CLR,Number=1,Type=Integer,Description=\"Log ratio of genotype likelihoods with and without the constraint\">\n", &str);
+       if (!strstr(str.s, "##INFO=<ID=UGT,"))
+               kputs("##INFO=<ID=UGT,Number=1,Type=String,Description=\"The most probable unconstrained genotype configuration in the trio\">\n", &str);
+       if (!strstr(str.s, "##INFO=<ID=CGT,"))
+               kputs("##INFO=<ID=CGT,Number=1,Type=String,Description=\"The most probable constrained genotype configuration in the trio\">\n", &str);
+//     if (!strstr(str.s, "##INFO=<ID=CI95,"))
+//             kputs("##INFO=<ID=CI95,Number=2,Type=Float,Description=\"Equal-tail Bayesian credible interval of the site allele frequency at the 95% level\">\n", &str);
        if (!strstr(str.s, "##INFO=<ID=PV4,"))
                kputs("##INFO=<ID=PV4,Number=4,Type=Float,Description=\"P-values for strand bias, baseQ bias, mapQ bias and tail distance bias\">\n", &str);
     if (!strstr(str.s, "##INFO=<ID=INDEL,"))
@@ -250,6 +275,8 @@ static void write_header(bcf_hdr_t *h)
         kputs("##INFO=<ID=QCHI2,Number=1,Type=Integer,Description=\"Phred scaled PCHI2.\">\n", &str);
     if (!strstr(str.s, "##INFO=<ID=RP,"))
         kputs("##INFO=<ID=PR,Number=1,Type=Integer,Description=\"# permutations yielding a smaller PCHI2.\">\n", &str);
+    if (!strstr(str.s, "##INFO=<ID=VDB,"))
+        kputs("##INFO=<ID=VDB,Number=1,Type=Float,Description=\"Variant Distance Bias\">\n", &str);
     if (!strstr(str.s, "##FORMAT=<ID=GT,"))
         kputs("##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">\n", &str);
     if (!strstr(str.s, "##FORMAT=<ID=GQ,"))
@@ -261,7 +288,7 @@ static void write_header(bcf_hdr_t *h)
        if (!strstr(str.s, "##FORMAT=<ID=SP,"))
                kputs("##FORMAT=<ID=SP,Number=1,Type=Integer,Description=\"Phred-scaled strand bias P-value\">\n", &str);
        if (!strstr(str.s, "##FORMAT=<ID=PL,"))
-               kputs("##FORMAT=<ID=PL,Number=-1,Type=Integer,Description=\"List of Phred-scaled genotype likelihoods, number of values is (#ALT+1)*(#ALT+2)/2\">\n", &str);
+               kputs("##FORMAT=<ID=PL,Number=G,Type=Integer,Description=\"List of Phred-scaled genotype likelihoods\">\n", &str);
        h->l_txt = str.l + 1; h->txt = str.s;
 }
 
@@ -274,10 +301,15 @@ int bcfview(int argc, char *argv[])
        extern int bcf_fix_gt(bcf1_t *b);
        extern int bcf_anno_max(bcf1_t *b);
        extern int bcf_shuffle(bcf1_t *b, int seed);
+       extern uint32_t *bcf_trio_prep(int is_x, int is_son);
+       extern int bcf_trio_call(uint32_t *prep, const bcf1_t *b, int *llr, int64_t *gt);
+       extern int bcf_pair_call(const bcf1_t *b);
+       extern int bcf_min_diff(const bcf1_t *b);
+
        bcf_t *bp, *bout = 0;
        bcf1_t *b, *blast;
        int c, *seeds = 0;
-       uint64_t n_processed = 0;
+       uint64_t n_processed = 0, qcnt[256];
        viewconf_t vc;
        bcf_p1aux_t *p1 = 0;
        bcf_hdr_t *hin, *hout;
@@ -287,7 +319,8 @@ int bcfview(int argc, char *argv[])
        tid = begin = end = -1;
        memset(&vc, 0, sizeof(viewconf_t));
        vc.prior_type = vc.n1 = -1; vc.theta = 1e-3; vc.pref = 0.5; vc.indel_frac = -1.; vc.n_perm = 0; vc.min_perm_p = 0.01; vc.min_smpl_frac = 0; vc.min_lrt = 1;
-       while ((c = getopt(argc, argv, "FN1:l:cC:eHAGvbSuP:t:p:QgLi:IMs:D:U:X:d:")) >= 0) {
+       memset(qcnt, 0, 8 * 256);
+       while ((c = getopt(argc, argv, "FN1:l:cC:eHAGvbSuP:t:p:QgLi:IMs:D:U:X:d:T:Y")) >= 0) {
                switch (c) {
                case '1': vc.n1 = atoi(optarg); break;
                case 'l': vc.bed = bed_read(optarg); break;
@@ -305,6 +338,7 @@ int bcfview(int argc, char *argv[])
                case 'g': vc.flag |= VC_CALL_GT | VC_CALL; break;
                case 'I': vc.flag |= VC_NO_INDEL; break;
                case 'M': vc.flag |= VC_ANNO_MAX; break;
+               case 'Y': vc.flag |= VC_QCNT; break;
                case 't': vc.theta = atof(optarg); break;
                case 'p': vc.pref = atof(optarg); break;
                case 'i': vc.indel_frac = atof(optarg); break;
@@ -319,6 +353,16 @@ int bcfview(int argc, char *argv[])
                        for (tid = 0; tid < vc.n_sub; ++tid) vc.ploidy[tid] = vc.subsam[tid][strlen(vc.subsam[tid]) + 1];
                        tid = -1;
                        break;
+               case 'T':
+                       if (strcmp(optarg, "trioauto") == 0) vc.trio_aux = bcf_trio_prep(0, 0);
+                       else if (strcmp(optarg, "trioxd") == 0) vc.trio_aux = bcf_trio_prep(1, 0);
+                       else if (strcmp(optarg, "trioxs") == 0) vc.trio_aux = bcf_trio_prep(1, 1);
+                       else if (strcmp(optarg, "pair") == 0) vc.flag |= VC_PAIRCALL;
+                       else {
+                               fprintf(pysamerr, "[%s] Option '-T' can only take value trioauto, trioxd or trioxs.\n", __func__);
+                               return 1;
+                       }
+                       break;
                case 'P':
                        if (strcmp(optarg, "full") == 0) vc.prior_type = MC_PTYPE_FULL;
                        else if (strcmp(optarg, "cond2") == 0) vc.prior_type = MC_PTYPE_COND2;
@@ -353,6 +397,7 @@ int bcfview(int argc, char *argv[])
                fprintf(pysamerr, "       -p FLOAT  variant if P(ref|D)<FLOAT [%.3g]\n", vc.pref);
                fprintf(pysamerr, "       -P STR    type of prior: full, cond2, flat [full]\n");
                fprintf(pysamerr, "       -t FLOAT  scaled substitution mutation rate [%.4g]\n", vc.theta);
+               fprintf(pysamerr, "       -T STR    constrained calling; STR can be: pair, trioauto, trioxd and trioxs (see manual) [null]\n");
                fprintf(pysamerr, "       -v        output potential variant sites only (force -c)\n");
                fprintf(pysamerr, "\nContrast calling and association test options:\n\n");
                fprintf(pysamerr, "       -1 INT    number of group-1 samples [0]\n");
@@ -426,8 +471,9 @@ int bcfview(int argc, char *argv[])
                }
        }
        while (vcf_read(bp, hin, b) > 0) {
-               int is_indel;
-               double em[9];
+               int is_indel, cons_llr = -1;
+               int64_t cons_gt = -1;
+               double em[10];
                if ((vc.flag & VC_VARONLY) && strcmp(b->alt, "X") == 0) continue;
                if ((vc.flag & VC_VARONLY) && vc.min_smpl_frac > 0.) {
                        extern int bcf_smpl_covered(const bcf1_t *b);
@@ -452,16 +498,25 @@ int bcfview(int argc, char *argv[])
                        if (!(l > begin && end > b->pos)) continue;
                }
                ++n_processed;
+               if ((vc.flag & VC_QCNT) && !is_indel) { // summarize the difference
+                       int x = bcf_min_diff(b);
+                       if (x > 255) x = 255;
+                       if (x >= 0) ++qcnt[x];
+               }
                if (vc.flag & VC_QCALL) { // output QCALL format; STOP here
                        bcf_2qcall(hout, b);
                        continue;
                }
-               if (vc.flag & VC_EM) bcf_em1(b, vc.n1, 0xff, em);
+               if (vc.trio_aux) // do trio calling
+                       bcf_trio_call(vc.trio_aux, b, &cons_llr, &cons_gt);
+               else if (vc.flag & VC_PAIRCALL)
+                       cons_llr = bcf_pair_call(b);
+               if (vc.flag & (VC_CALL|VC_ADJLD|VC_EM)) bcf_gl2pl(b);
+               if (vc.flag & VC_EM) bcf_em1(b, vc.n1, 0x1ff, em);
                else {
                        int i;
                        for (i = 0; i < 9; ++i) em[i] = -1.;
                }
-               if (vc.flag & (VC_CALL|VC_ADJLD)) bcf_gl2pl(b);
                if (vc.flag & VC_CALL) { // call variants
                        bcf_p1rst_t pr;
                        int calret = bcf_p1_cal(b, (em[7] >= 0 && em[7] < vc.min_lrt), p1, &pr);
@@ -475,7 +530,7 @@ int bcfview(int argc, char *argv[])
                                int i, n = 0;
                                for (i = 0; i < vc.n_perm; ++i) {
 #ifdef BCF_PERM_LRT // LRT based permutation is much faster but less robust to artifacts
-                                       double x[9];
+                                       double x[10];
                                        bcf_shuffle(b, seeds[i]);
                                        bcf_em1(b, vc.n1, 1<<7, x);
                                        if (x[7] < em[7]) ++n;
@@ -487,8 +542,8 @@ int bcfview(int argc, char *argv[])
                                }
                                pr.perm_rank = n;
                        }
-                       if (calret >= 0) update_bcf1(b, p1, &pr, vc.pref, vc.flag, em);
-               } else if (vc.flag & VC_EM) update_bcf1(b, 0, 0, 0, vc.flag, em);
+                       if (calret >= 0) update_bcf1(b, p1, &pr, vc.pref, vc.flag, em, cons_llr, cons_gt);
+               } else if (vc.flag & VC_EM) update_bcf1(b, 0, 0, 0, vc.flag, em, cons_llr, cons_gt);
                if (vc.flag & VC_ADJLD) { // compute LD
                        double f[4], r2;
                        if ((r2 = bcf_pair_freq(blast, b, f)) >= 0) {
@@ -517,12 +572,16 @@ int bcfview(int argc, char *argv[])
        vcf_close(bp); vcf_close(bout);
        if (vc.fn_dict) free(vc.fn_dict);
        if (vc.ploidy) free(vc.ploidy);
+       if (vc.trio_aux) free(vc.trio_aux);
        if (vc.n_sub) {
                int i;
                for (i = 0; i < vc.n_sub; ++i) free(vc.subsam[i]);
                free(vc.subsam); free(vc.sublist);
        }
        if (vc.bed) bed_destroy(vc.bed);
+       if (vc.flag & VC_QCNT)
+               for (c = 0; c < 256; ++c)
+                       fprintf(pysamerr, "QT\t%d\t%lld\n", c, (long long)qcnt[c]);
        if (seeds) free(seeds);
        if (p1) bcf_p1_destroy(p1);
        return 0;
index 914dc0587b8bc83486ea7b7232347a1bf87b4905..94b6d7532ca012c698986b7f668e198331b211a5 100644 (file)
@@ -170,7 +170,7 @@ static double lk_ratio_test(int n, int n1, const double *pdg, double f3[3][3])
 // x[5..6]: group1 freq, group2 freq
 // x[7]: 1-degree P-value
 // x[8]: 2-degree P-value
-int bcf_em1(const bcf1_t *b, int n1, int flag, double x[9])
+int bcf_em1(const bcf1_t *b, int n1, int flag, double x[10])
 {
        double *pdg;
        int i, n, n2;
@@ -182,7 +182,7 @@ int bcf_em1(const bcf1_t *b, int n1, int flag, double x[9])
        n = b->n_smpl; n2 = n - n1;
        pdg = get_pdg3(b);
        if (pdg == 0) return -1;
-       for (i = 0; i < 9; ++i) x[i] = -1.;
+       for (i = 0; i < 10; ++i) x[i] = -1.; // set to negative
        {
                if ((x[0] = est_freq(n, pdg)) < 0.) {
                        free(pdg);
@@ -190,7 +190,7 @@ int bcf_em1(const bcf1_t *b, int n1, int flag, double x[9])
                }
                x[0] = freqml(x[0], 0, n, pdg);
        }
-       if (flag & (0xf<<1|1<<8)) { // estimate the genotype frequency and test HWE
+       if (flag & (0xf<<1|3<<8)) { // estimate the genotype frequency and test HWE
                double *g = x + 1, f3[3], r;
                f3[0] = g[0] = (1 - x[0]) * (1 - x[0]);
                f3[1] = g[1] = 2 * x[0] * (1 - x[0]);
@@ -209,20 +209,24 @@ int bcf_em1(const bcf1_t *b, int n1, int flag, double x[9])
                x[6] = freqml(x[0], n1, n, pdg);
        }
        if ((flag & 1<<7) && n1 > 0 && n1 < n) { // 1-degree P-value
-               double f[3], f3[3][3];
+               double f[3], f3[3][3], tmp;
                f[0] = x[0]; f[1] = x[5]; f[2] = x[6];
                for (i = 0; i < 3; ++i)
                        f3[i][0] = (1-f[i])*(1-f[i]), f3[i][1] = 2*f[i]*(1-f[i]), f3[i][2] = f[i]*f[i];
-               x[7] = kf_gammaq(.5, log(lk_ratio_test(n, n1, pdg, f3)));
+               tmp = log(lk_ratio_test(n, n1, pdg, f3));
+               if (tmp < 0) tmp = 0;
+               x[7] = kf_gammaq(.5, tmp);
        }
-       if ((flag & 1<<8) && n1 > 0 && n1 < n) { // 2-degree P-value
-               double g[3][3];
+       if ((flag & 3<<8) && n1 > 0 && n1 < n) { // 2-degree P-value
+               double g[3][3], tmp;
                for (i = 0; i < 3; ++i) memcpy(g[i], x + 1, 3 * sizeof(double));
                for (i = 0; i < ITER_MAX; ++i)
                        if (g3_iter(g[1], pdg, 0, n1) < EPS) break;
                for (i = 0; i < ITER_MAX; ++i)
                        if (g3_iter(g[2], pdg, n1, n) < EPS) break;
-               x[8] = kf_gammaq(1., log(lk_ratio_test(n, n1, pdg, g)));
+               tmp = log(lk_ratio_test(n, n1, pdg, g));
+               if (tmp < 0) tmp = 0;
+               x[8] = kf_gammaq(1., tmp);
        }
        // free
        free(pdg);
diff --git a/samtools/bcftools/mut.c.pysam.c b/samtools/bcftools/mut.c.pysam.c
new file mode 100644 (file)
index 0000000..59ffb60
--- /dev/null
@@ -0,0 +1,129 @@
+#include "pysam.h"
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "bcf.h"
+
+#define MAX_GENO 359
+
+int8_t seq_bitcnt[] = { 4, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
+char *seq_nt16rev = "XACMGRSVTWYHKDBN";
+
+uint32_t *bcf_trio_prep(int is_x, int is_son)
+{
+       int i, j, k, n, map[10];
+       uint32_t *ret;
+       ret = calloc(MAX_GENO, 4);
+       for (i = 0, k = 0; i < 4; ++i)
+               for (j = i; j < 4; ++j)
+                       map[k++] = 1<<i|1<<j;
+       for (i = 0, n = 1; i < 10; ++i) { // father
+               if (is_x && seq_bitcnt[map[i]] != 1) continue;
+               if (is_x && is_son) {
+                       for (j = 0; j < 10; ++j) // mother
+                               for (k = 0; k < 10; ++k) // child
+                                       if (seq_bitcnt[map[k]] == 1 && (map[j]&map[k]))
+                                               ret[n++] = j<<16 | i<<8 | k;
+               } else {
+                       for (j = 0; j < 10; ++j) // mother
+                               for (k = 0; k < 10; ++k) // child
+                                       if ((map[i]&map[k]) && (map[j]&map[k]) && ((map[i]|map[j])&map[k]) == map[k])
+                                               ret[n++] = j<<16 | i<<8 | k;
+               }
+       }
+       ret[0] = n - 1;
+       return ret;
+}
+
+
+int bcf_trio_call(const uint32_t *prep, const bcf1_t *b, int *llr, int64_t *gt)
+{
+       int i, j, k;
+       const bcf_ginfo_t *PL;
+       uint8_t *gl10;
+       int map[10];
+       if (b->n_smpl != 3) return -1; // not a trio
+       for (i = 0; i < b->n_gi; ++i)
+               if (b->gi[i].fmt == bcf_str2int("PL", 2)) break;
+       if (i == b->n_gi) return -1; // no PL
+       gl10 = alloca(10 * b->n_smpl);
+       if (bcf_gl10(b, gl10) < 0) {
+               if (bcf_gl10_indel(b, gl10) < 0) return -1;
+       }
+       PL = b->gi + i;
+       for (i = 0, k = 0; i < 4; ++i)
+               for (j = i; j < 4; ++j)
+                       map[k++] = seq_nt16rev[1<<i|1<<j];
+       for (j = 0; j < 3; ++j) // check if ref hom is the most probable in all members
+               if (((uint8_t*)PL->data)[j * PL->len] != 0) break;
+       if (j < 3) { // we need to go through the complex procedure
+               uint8_t *g[3];
+               int minc = 1<<30, minc_j = -1, minf = 0, gtf = 0, gtc = 0;
+               g[0] = gl10;
+               g[1] = gl10 + 10;
+               g[2] = gl10 + 20;
+               for (j = 1; j <= (int)prep[0]; ++j) { // compute LK with constraint
+                       int sum = g[0][prep[j]&0xff] + g[1][prep[j]>>8&0xff] + g[2][prep[j]>>16&0xff];
+                       if (sum < minc) minc = sum, minc_j = j;
+               }
+               gtc |= map[prep[minc_j]&0xff]; gtc |= map[prep[minc_j]>>8&0xff]<<8; gtc |= map[prep[minc_j]>>16]<<16;
+               for (j = 0; j < 3; ++j) { // compute LK without constraint
+                       int min = 1<<30, min_k = -1;
+                       for (k = 0; k < 10; ++k)
+                               if (g[j][k] < min) min = g[j][k], min_k = k;
+                       gtf |= map[min_k]<<(j*8);
+                       minf += min;
+               }
+               *llr = minc - minf; *gt = (int64_t)gtc<<32 | gtf;
+       } else *llr = 0, *gt = -1;
+       return 0;
+}
+
+int bcf_pair_call(const bcf1_t *b)
+{
+       int i, j, k;
+       const bcf_ginfo_t *PL;
+       if (b->n_smpl != 2) return -1; // not a pair
+       for (i = 0; i < b->n_gi; ++i)
+               if (b->gi[i].fmt == bcf_str2int("PL", 2)) break;
+       if (i == b->n_gi) return -1; // no PL
+       PL = b->gi + i;
+       for (j = 0; j < 2; ++j) // check if ref hom is the most probable in all members
+               if (((uint8_t*)PL->data)[j * PL->len] != 0) break;
+       if (j < 2) { // we need to go through the complex procedure
+               uint8_t *g[2];
+               int minc = 1<<30, minf = 0;
+               g[0] = PL->data;
+               g[1] = (uint8_t*)PL->data + PL->len;
+               for (j = 0; j < PL->len; ++j) // compute LK with constraint
+                       minc = minc < g[0][j] + g[1][j]? minc : g[0][j] + g[1][j];
+               for (j = 0; j < 2; ++j) { // compute LK without constraint
+                       int min = 1<<30;
+                       for (k = 0; k < PL->len; ++k)
+                               min = min < g[j][k]? min : g[j][k];
+                       minf += min;
+               }
+               return minc - minf;
+       } else return 0;
+}
+
+int bcf_min_diff(const bcf1_t *b)
+{
+       int i, min = 1<<30;
+       const bcf_ginfo_t *PL;
+       for (i = 0; i < b->n_gi; ++i)
+               if (b->gi[i].fmt == bcf_str2int("PL", 2)) break;
+       if (i == b->n_gi) return -1; // no PL
+       PL = b->gi + i;
+       for (i = 0; i < b->n_smpl; ++i) {
+               int m1, m2, j;
+               const uint8_t *p = (uint8_t*)PL->data;
+               m1 = m2 = 1<<30;
+               for (j = 0; j < PL->len; ++j) {
+                       if ((int)p[j] < m1) m2 = m1, m1 = p[j];
+                       else if ((int)p[j] < m2) m2 = p[j];
+               }
+               min = min < m2 - m1? min : m2 - m1;
+       }
+       return min;
+}
index ac331848f624e466091552f6291ea46e0d239062..5bc52a564e85bb44a09cc4dedb65783b1762bc6b 100644 (file)
@@ -499,6 +499,13 @@ int bcf_p1_cal(const bcf1_t *b, int do_contrast, bcf_p1aux_t *ma, bcf_p1rst_t *r
        for (k = 0, sum = 0.; k < ma->M; ++k)
                sum += ma->afs1[k];
        rst->p_var = (double)sum;
+       { // compute the allele count
+               double max = -1;
+               rst->ac = -1;
+               for (k = 0; k <= ma->M; ++k)
+                       if (max < ma->z[k]) max = ma->z[k], rst->ac = k;
+               rst->ac = ma->M - rst->ac;
+       }
        // calculate f_flat and f_em
        for (k = 0, sum = 0.; k <= ma->M; ++k)
                sum += (long double)ma->z[k];
@@ -511,16 +518,27 @@ int bcf_p1_cal(const bcf1_t *b, int do_contrast, bcf_p1aux_t *ma, bcf_p1rst_t *r
        { // estimate equal-tail credible interval (95% level)
                int l, h;
                double p;
-               for (i = 0, p = 0.; i < ma->M; ++i)
+               for (i = 0, p = 0.; i <= ma->M; ++i)
                        if (p + ma->afs1[i] > 0.025) break;
                        else p += ma->afs1[i];
                l = i;
-               for (i = ma->M-1, p = 0.; i >= 0; --i)
+               for (i = ma->M, p = 0.; i >= 0; --i)
                        if (p + ma->afs1[i] > 0.025) break;
                        else p += ma->afs1[i];
                h = i;
                rst->cil = (double)(ma->M - h) / ma->M; rst->cih = (double)(ma->M - l) / ma->M;
        }
+       if (ma->n1 > 0) { // compute LRT
+               double max0, max1, max2;
+               for (k = 0, max0 = -1; k <= ma->M; ++k)
+                       if (max0 < ma->z[k]) max0 = ma->z[k];
+               for (k = 0, max1 = -1; k <= ma->n1 * 2; ++k)
+                       if (max1 < ma->z1[k]) max1 = ma->z1[k];
+               for (k = 0, max2 = -1; k <= ma->M - ma->n1 * 2; ++k)
+                       if (max2 < ma->z2[k]) max2 = ma->z2[k];
+               rst->lrt = log(max1 * max2 / max0);
+               rst->lrt = rst->lrt < 0? 1 : kf_gammaq(.5, rst->lrt);
+       } else rst->lrt = -1.0;
        rst->cmp[0] = rst->cmp[1] = rst->cmp[2] = rst->p_chi2 = -1.0;
        if (do_contrast && rst->p_var > 0.5) // skip contrast2() if the locus is a strong non-variant
                rst->p_chi2 = contrast2(ma, rst->cmp);
index 571f42f1c63f5e93a4d1b601bd4843f7e1a48483..0a51a0ae2650f377f4fc48665109487687eb69cb 100644 (file)
@@ -8,9 +8,10 @@ typedef struct __bcf_p1aux_t bcf_p1aux_t;
 
 typedef struct {
        int rank0, perm_rank; // NB: perm_rank is always set to -1 by bcf_p1_cal()
+       int ac; // ML alternative allele count
        double f_exp, f_flat, p_ref_folded, p_ref, p_var_folded, p_var;
        double cil, cih;
-       double cmp[3], p_chi2; // used by contrast2()
+       double cmp[3], p_chi2, lrt; // used by contrast2()
 } bcf_p1rst_t;
 
 #define MC_PTYPE_FULL  1
@@ -32,7 +33,7 @@ extern "C" {
        int bcf_p1_set_n1(bcf_p1aux_t *b, int n1);
        void bcf_p1_set_folded(bcf_p1aux_t *p1a); // only effective when set_n1() is not called
 
-       int bcf_em1(const bcf1_t *b, int n1, int flag, double x[9]);
+       int bcf_em1(const bcf1_t *b, int n1, int flag, double x[10]);
 
 #ifdef __cplusplus
 }
index c3ab06ff5a82be4e4c377bdb9c343f30754418c4..2bbb05f5347849eaf7f2689fb78152cae732c241 100644 (file)
@@ -6,6 +6,10 @@
 #include <stdio.h>
 #include <zlib.h>
 
+#ifdef _WIN32
+#define drand48() ((double)rand() / RAND_MAX)
+#endif
+
 #include "ksort.h"
 KSORT_INIT_GENERIC(uint64_t)
 
@@ -121,8 +125,10 @@ void *bed_read(const char *fn)
                        if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
                                beg = atoi(str->s); // begin
                                if (dret != '\n') {
-                                       if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0]))
+                                       if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
                                                end = atoi(str->s); // end
+                                               if (end < beg) end = -1;
+                                       }
                                }
                        }
                }
index 526a9c0022ff477807e6475b2910c2497f4caf36..376629ead6701fc4bebdec4337c10abbed1da06b 100644 (file)
@@ -9,7 +9,8 @@
 #include "khash.h"
 
 typedef struct {
-       uint64_t len:32, line_len:16, line_blen:16;
+       int32_t line_len, line_blen;
+       int64_t len;
        uint64_t offset;
 } faidx1_t;
 KHASH_MAP_INIT_STR(s, faidx1_t)
@@ -66,10 +67,11 @@ faidx_t *fai_build_core(RAZF *rz)
 {
        char c, *name;
        int l_name, m_name, ret;
-       int len, line_len, line_blen, state;
+       int line_len, line_blen, state;
        int l1, l2;
        faidx_t *idx;
        uint64_t offset;
+       int64_t len;
 
        idx = (faidx_t*)calloc(1, sizeof(faidx_t));
        idx->hash = kh_init(s);
@@ -121,11 +123,6 @@ faidx_t *fai_build_core(RAZF *rz)
                                return 0;
                        }
                        ++l1; len += l2;
-                       if (l2 >= 0x10000) {
-                               fprintf(pysamerr, "[fai_build_core] line length exceeds 65535 in sequence '%s'.\n", name);
-                               free(name); fai_destroy(idx);
-                               return 0;
-                       }
                        if (state == 1) line_len = l1, line_blen = l2, state = 0;
                        else if (state == 0) {
                                if (l1 != line_len || l2 != line_blen) state = 2;
@@ -307,8 +304,8 @@ faidx_t *fai_load(const char *fn)
 
 char *fai_fetch(const faidx_t *fai, const char *str, int *len)
 {
-       char *s, *p, c;
-       int i, l, k;
+       char *s, c;
+       int i, l, k, name_end;
        khiter_t iter;
        faidx1_t val;
        khash_t(s) *h;
@@ -316,31 +313,43 @@ char *fai_fetch(const faidx_t *fai, const char *str, int *len)
 
        beg = end = -1;
        h = fai->hash;
-       l = strlen(str);
-       p = s = (char*)malloc(l+1);
-       /* squeeze out "," */
-       for (i = k = 0; i != l; ++i)
-               if (str[i] != ',' && !isspace(str[i])) s[k++] = str[i];
-       s[k] = 0;
-       for (i = 0; i != k; ++i) if (s[i] == ':') break;
-       s[i] = 0;
-       iter = kh_get(s, h, s); /* get the ref_id */
-       if (iter == kh_end(h)) {
-               *len = 0;
-               free(s); return 0;
-       }
+       name_end = l = strlen(str);
+       s = (char*)malloc(l+1);
+       // remove space
+       for (i = k = 0; i < l; ++i)
+               if (!isspace(str[i])) s[k++] = str[i];
+       s[k] = 0; l = k;
+       // determine the sequence name
+       for (i = l - 1; i >= 0; --i) if (s[i] == ':') break; // look for colon from the end
+       if (i >= 0) name_end = i;
+       if (name_end < l) { // check if this is really the end
+               int n_hyphen = 0;
+               for (i = name_end + 1; i < l; ++i) {
+                       if (s[i] == '-') ++n_hyphen;
+                       else if (!isdigit(s[i]) && s[i] != ',') break;
+               }
+               if (i < l || n_hyphen > 1) name_end = l; // malformated region string; then take str as the name
+               s[name_end] = 0;
+               iter = kh_get(s, h, s);
+               if (iter == kh_end(h)) { // cannot find the sequence name
+                       iter = kh_get(s, h, str); // try str as the name
+                       if (iter == kh_end(h)) {
+                               *len = 0;
+                       free(s); return 0;
+                       } else s[name_end] = ':', name_end = l;
+               }
+       } else iter = kh_get(s, h, str);
        val = kh_value(h, iter);
-       if (i == k) { /* dump the whole sequence */
-               beg = 0; end = val.len;
-       } else {
-               for (p = s + i + 1; i != k; ++i) if (s[i] == '-') break;
-               beg = atoi(p);
-               if (i < k) {
-                       p = s + i + 1;
-                       end = atoi(p);
-               } else end = val.len;
-       }
-       if (beg > 0) --beg;
+       // parse the interval
+       if (name_end < l) {
+               for (i = k = name_end + 1; i < l; ++i)
+                       if (s[i] != ',') s[k++] = s[i];
+               s[k] = 0;
+               beg = atoi(s + name_end + 1);
+               for (i = name_end + 1; i != k; ++i) if (s[i] == '-') break;
+               end = i < k? atoi(s + i + 1) : val.len;
+               if (beg > 0) --beg;
+       } else beg = 0, end = val.len;
        if (beg >= val.len) beg = val.len;
        if (end >= val.len) end = val.len;
        if (beg > end) beg = end;
diff --git a/samtools/glf.c.pysam.c b/samtools/glf.c.pysam.c
deleted file mode 100644 (file)
index 099d4ac..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-#include "pysam.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include "glf.h"
-
-#ifdef _NO_BGZF
-// then alias bgzf_*() functions
-#endif
-
-static int glf3_is_BE = 0;
-
-static inline uint32_t bam_swap_endian_4(uint32_t v)
-{
-       v = ((v & 0x0000FFFFU) << 16) | (v >> 16);
-       return ((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8);
-}
-
-static inline uint16_t bam_swap_endian_2(uint16_t v)
-{
-       return (uint16_t)(((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8));
-}
-
-static inline int bam_is_big_endian()
-{
-       long one= 1;
-       return !(*((char *)(&one)));
-}
-
-glf3_header_t *glf3_header_init()
-{
-       glf3_is_BE = bam_is_big_endian();
-       return (glf3_header_t*)calloc(1, sizeof(glf3_header_t));
-}
-
-glf3_header_t *glf3_header_read(glfFile fp)
-{
-       glf3_header_t *h;
-       char magic[4];
-       h = glf3_header_init();
-       bgzf_read(fp, magic, 4);
-       if (strncmp(magic, "GLF\3", 4)) {
-               fprintf(pysamerr, "[glf3_header_read] invalid magic.\n");
-               glf3_header_destroy(h);
-               return 0;
-       }
-       bgzf_read(fp, &h->l_text, 4);
-       if (glf3_is_BE) h->l_text = bam_swap_endian_4(h->l_text);
-       if (h->l_text) {
-               h->text = (uint8_t*)calloc(h->l_text + 1, 1);
-               bgzf_read(fp, h->text, h->l_text);
-       }
-       return h;
-}
-
-void glf3_header_write(glfFile fp, const glf3_header_t *h)
-{
-       int32_t x;
-       bgzf_write(fp, "GLF\3", 4);
-       x = glf3_is_BE? bam_swap_endian_4(h->l_text) : h->l_text;
-       bgzf_write(fp, &x, 4);
-       if (h->l_text) bgzf_write(fp, h->text, h->l_text);
-}
-
-void glf3_header_destroy(glf3_header_t *h)
-{
-       free(h->text);
-       free(h);
-}
-
-char *glf3_ref_read(glfFile fp, int *len)
-{
-       int32_t n, x;
-       char *str;
-       *len = 0;
-       if (bgzf_read(fp, &n, 4) != 4) return 0;
-       if (glf3_is_BE) n = bam_swap_endian_4(n);
-       if (n < 0) {
-               fprintf(pysamerr, "[glf3_ref_read] invalid reference name length: %d.\n", n);
-               return 0;
-       }
-       str = (char*)calloc(n + 1, 1); // not necesarily n+1 in fact
-       x = bgzf_read(fp, str, n);
-       x += bgzf_read(fp, len, 4);
-       if (x != n + 4) {
-               free(str); *len = -1; return 0; // truncated
-       }
-       if (glf3_is_BE) *len = bam_swap_endian_4(*len);
-       return str;
-}
-
-void glf3_ref_write(glfFile fp, const char *str, int len)
-{
-       int32_t m, n = strlen(str) + 1;
-       m = glf3_is_BE? bam_swap_endian_4(n) : n;
-       bgzf_write(fp, &m, 4);
-       bgzf_write(fp, str, n);
-       if (glf3_is_BE) len = bam_swap_endian_4(len);
-       bgzf_write(fp, &len, 4);
-}
-
-void glf3_view1(const char *ref_name, const glf3_t *g3, int pos)
-{
-       int j;
-       if (g3->rtype == GLF3_RTYPE_END) return;
-       printf("%s\t%d\t%c\t%d\t%d\t%d", ref_name, pos + 1,
-                  g3->rtype == GLF3_RTYPE_INDEL? '*' : "XACMGRSVTWYHKDBN"[g3->ref_base],
-                  g3->depth, g3->rms_mapQ, g3->min_lk);
-       if (g3->rtype == GLF3_RTYPE_SUB)
-               for (j = 0; j != 10; ++j) printf("\t%d", g3->lk[j]);
-       else {
-               printf("\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t", g3->lk[0], g3->lk[1], g3->lk[2], g3->indel_len[0], g3->indel_len[1],
-                          g3->indel_len[0]? g3->indel_seq[0] : "*", g3->indel_len[1]? g3->indel_seq[1] : "*");
-       }
-       printf("\n");
-}
-
-int glf3_write1(glfFile fp, const glf3_t *g3)
-{
-       int r;
-       uint8_t c;
-       uint32_t y[2];
-       c = g3->rtype<<4 | g3->ref_base;
-       r = bgzf_write(fp, &c, 1);
-       if (g3->rtype == GLF3_RTYPE_END) return r;
-       y[0] = g3->offset;
-       y[1] = g3->min_lk<<24 | g3->depth;
-       if (glf3_is_BE) {
-               y[0] = bam_swap_endian_4(y[0]);
-               y[1] = bam_swap_endian_4(y[1]);
-       }
-       r += bgzf_write(fp, y, 8);
-       r += bgzf_write(fp, &g3->rms_mapQ, 1);
-       if (g3->rtype == GLF3_RTYPE_SUB) r += bgzf_write(fp, g3->lk, 10);
-       else {
-               int16_t x[2];
-               r += bgzf_write(fp, g3->lk, 3);
-               x[0] = glf3_is_BE? bam_swap_endian_2(g3->indel_len[0]) : g3->indel_len[0];
-               x[1] = glf3_is_BE? bam_swap_endian_2(g3->indel_len[1]) : g3->indel_len[1];
-               r += bgzf_write(fp, x, 4);
-               if (g3->indel_len[0]) r += bgzf_write(fp, g3->indel_seq[0], abs(g3->indel_len[0]));
-               if (g3->indel_len[1]) r += bgzf_write(fp, g3->indel_seq[1], abs(g3->indel_len[1]));
-       }
-       return r;
-}
-
-#ifndef kv_roundup32
-#define kv_roundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
-#endif
-
-int glf3_read1(glfFile fp, glf3_t *g3)
-{
-       int r;
-       uint8_t c;
-       uint32_t y[2];
-       r = bgzf_read(fp, &c, 1);
-       if (r == 0) return 0;
-       g3->ref_base = c & 0xf;
-       g3->rtype = c>>4;
-       if (g3->rtype == GLF3_RTYPE_END) return r;
-       r += bgzf_read(fp, y, 8);
-       if (glf3_is_BE) {
-               y[0] = bam_swap_endian_4(y[0]);
-               y[1] = bam_swap_endian_4(y[1]);
-       }
-       g3->offset = y[0];
-       g3->min_lk = y[1]>>24;
-       g3->depth = y[1]<<8>>8;
-       r += bgzf_read(fp, &g3->rms_mapQ, 1);
-       if (g3->rtype == GLF3_RTYPE_SUB) r += bgzf_read(fp, g3->lk, 10);
-       else {
-               int16_t x[2], max;
-               r += bgzf_read(fp, g3->lk, 3);
-               r += bgzf_read(fp, x, 4);
-               if (glf3_is_BE) {
-                       x[0] = bam_swap_endian_2(x[0]);
-                       x[1] = bam_swap_endian_2(x[1]);
-               }
-               g3->indel_len[0] = x[0];
-               g3->indel_len[1] = x[1];
-               x[0] = abs(x[0]); x[1] = abs(x[1]);
-               max = (x[0] > x[1]? x[0] : x[1]) + 1;
-               if (g3->max_len < max) {
-                       g3->max_len = max;
-                       kv_roundup32(g3->max_len);
-                       g3->indel_seq[0] = (char*)realloc(g3->indel_seq[0], g3->max_len);
-                       g3->indel_seq[1] = (char*)realloc(g3->indel_seq[1], g3->max_len);
-               }
-               r += bgzf_read(fp, g3->indel_seq[0], x[0]);
-               r += bgzf_read(fp, g3->indel_seq[1], x[1]);
-               g3->indel_seq[0][x[0]] = g3->indel_seq[1][x[1]] = 0;
-       }
-       return r;
-}
-
-void glf3_view(glfFile fp)
-{
-       glf3_header_t *h;
-       char *name;
-       glf3_t *g3;
-       int len;
-       h = glf3_header_read(fp);
-       g3 = glf3_init1();
-       while ((name = glf3_ref_read(fp, &len)) != 0) {
-               int pos = 0;
-               while (glf3_read1(fp, g3) && g3->rtype != GLF3_RTYPE_END) {
-                       pos += g3->offset;
-                       glf3_view1(name, g3, pos);
-               }
-               free(name);
-       }
-       glf3_header_destroy(h);
-       glf3_destroy1(g3);
-}
-
-int glf3_view_main(int argc, char *argv[])
-{
-       glfFile fp;
-       if (argc == 1) {
-               fprintf(pysamerr, "Usage: glfview <in.glf>\n");
-               return 1;
-       }
-       fp = (strcmp(argv[1], "-") == 0)? bgzf_fdopen(fileno(stdin), "r") : bgzf_open(argv[1], "r");
-       if (fp == 0) {
-               fprintf(pysamerr, "Fail to open file '%s'\n", argv[1]);
-               return 1;
-       }
-       glf3_view(fp);
-       bgzf_close(fp);
-       return 0;
-}
-
-#ifdef GLFVIEW_MAIN
-int main(int argc, char *argv[])
-{
-       return glf3_view_main(argc, argv);
-}
-#endif
diff --git a/samtools/glf.h b/samtools/glf.h
deleted file mode 100644 (file)
index 12e5400..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef GLF_H_
-#define GLF_H_
-
-typedef struct {
-       unsigned char ref_base:4, dummy:4; /** "XACMGRSVTWYHKDBN"[ref_base] gives the reference base */
-       unsigned char max_mapQ; /** maximum mapping quality */
-       unsigned char lk[10];   /** log likelihood ratio, capped at 255 */
-       unsigned min_lk:8, depth:24; /** minimum lk capped at 255, and the number of mapped reads */
-} glf1_t;
-
-#include <stdint.h>
-#include "bgzf.h"
-typedef BGZF *glfFile;
-
-#define GLF3_RTYPE_END   0
-#define GLF3_RTYPE_SUB   1
-#define GLF3_RTYPE_INDEL 2
-
-typedef struct {
-       uint8_t ref_base:4, rtype:4; /** "XACMGRSVTWYHKDBN"[ref_base] gives the reference base */
-       uint8_t rms_mapQ; /** RMS mapping quality */
-       uint8_t lk[10];   /** log likelihood ratio, capped at 255 */
-       uint32_t min_lk:8, depth:24; /** minimum lk capped at 255, and the number of mapped reads */
-       int32_t offset; /** the first base in a chromosome has offset zero. */
-       // for indel (lkHom1, lkHom2 and lkHet are the first three elements in lk[10])
-       int16_t indel_len[2];
-       int32_t max_len; // maximum indel len; will be modified by glf3_read1()
-       char *indel_seq[2];
-} glf3_t;
-
-typedef struct {
-       int32_t l_text;
-       uint8_t *text;
-} glf3_header_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define glf3_init1() ((glf3_t*)calloc(1, sizeof(glf3_t)))
-#define glf3_destroy1(g3) do { free((g3)->indel_seq[0]); free((g3)->indel_seq[1]); free(g3); } while (0)
-
-       glf3_header_t *glf3_header_init();
-       glf3_header_t *glf3_header_read(glfFile fp);
-       void glf3_header_write(glfFile fp, const glf3_header_t *h);
-       void glf3_header_destroy(glf3_header_t *h);
-       char *glf3_ref_read(glfFile fp, int *len);
-       void glf3_ref_write(glfFile fp, const char *name, int len);
-       int glf3_write1(glfFile fp, const glf3_t *g3);
-       int glf3_read1(glfFile fp, glf3_t *g3);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
index b87dcf07c831dc946900028fc1a2b3a073b404b5..3404936c70689012234e956e754844f1b5d0618e 100644 (file)
@@ -163,7 +163,7 @@ int kpa_glocal(const uint8_t *_ref, int l_ref, const uint8_t *_query, int l_quer
                double p = 1., Pr1 = 0.;
                for (i = 0; i <= l_query + 1; ++i) {
                        p *= s[i];
-                       if (p < 1e-100) Pr += -4.343 * log(p), p = 1.;
+                       if (p < 1e-100) Pr1 += -4.343 * log(p), p = 1.;
                }
                Pr1 += -4.343 * log(p * l_ref * l_query);
                Pr = (int)(Pr1 + .499);
index 82face095919a3991b1f927bb5422ffd95f102a4..0bbc7dc9370e910b19286167bd0862c64855387c 100644 (file)
@@ -1,6 +1,6 @@
 /* The MIT License
 
-   Copyright (c) 2008 Genome Research Ltd (GRL).
+   Copyright (c) 2008, 2009, 2011 Attractive Chaos <attractor@live.co.uk>
 
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    SOFTWARE.
 */
 
-/* Contact: Heng Li <lh3@sanger.ac.uk> */
-
-/*
-  2009-07-16 (lh3): in kstream_t, change "char*" to "unsigned char*"
- */
-
-/* Last Modified: 12APR2009 */
+/* Last Modified: 18AUG2011 */
 
 #ifndef AC_KSEQ_H
 #define AC_KSEQ_H
@@ -94,10 +88,10 @@ typedef struct __kstring_t {
 #endif
 
 #define __KS_GETUNTIL(__read, __bufsize)                                                               \
-       static int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \
+       static int ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append) \
        {                                                                                                                                       \
                if (dret) *dret = 0;                                                                                    \
-               str->l = 0;                                                                                                             \
+               str->l = append? str->l : 0;                                                                    \
                if (ks->begin >= ks->end && ks->is_eof) return -1;                              \
                for (;;) {                                                                                                              \
                        int i;                                                                                                          \
@@ -132,13 +126,15 @@ typedef struct __kstring_t {
                                break;                                                                                                  \
                        }                                                                                                                       \
                }                                                                                                                               \
-               if (str->l == 0) {                                                                                              \
+               if (str->s == 0) {                                                                                              \
                        str->m = 1;                                                                                                     \
                        str->s = (char*)calloc(1, 1);                                                           \
                }                                                                                                                               \
                str->s[str->l] = '\0';                                                                                  \
                return str->l;                                                                                                  \
-       }
+       } \
+       static inline int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \
+       { return ks_getuntil2(ks, delimiter, str, dret, 0); }
 
 #define KSTREAM_INIT(type_t, __read, __bufsize) \
        __KS_TYPE(type_t)                                                       \
@@ -171,44 +167,45 @@ typedef struct __kstring_t {
    -1   end-of-file
    -2   truncated quality string
  */
-#define __KSEQ_READ                                                                                                            \
-       static int kseq_read(kseq_t *seq)                                                                       \
-       {                                                                                                                                       \
-               int c;                                                                                                                  \
-               kstream_t *ks = seq->f;                                                                                 \
+#define __KSEQ_READ \
+       static int kseq_read(kseq_t *seq) \
+       { \
+               int c; \
+               kstream_t *ks = seq->f; \
                if (seq->last_char == 0) { /* then jump to the next header line */ \
-                       while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@');        \
-                       if (c == -1) return -1; /* end of file */                                       \
-                       seq->last_char = c;                                                                                     \
-               } /* the first header char has been read */                                             \
-               seq->comment.l = seq->seq.l = seq->qual.l = 0;                                  \
-               if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1;                  \
-               if (c != '\n') ks_getuntil(ks, '\n', &seq->comment, 0);                 \
+                       while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@'); \
+                       if (c == -1) return -1; /* end of file */ \
+                       seq->last_char = c; \
+               } /* else: the first header char has been read in the previous call */ \
+               seq->comment.l = seq->seq.l = seq->qual.l = 0; /* reset all members */ \
+               if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1; /* normal exit: EOF */ \
+               if (c != '\n') ks_getuntil(ks, '\n', &seq->comment, 0); /* read FASTA/Q comment */ \
+               if (seq->seq.s == 0) { /* we can do this in the loop below, but that is slower */ \
+                       seq->seq.m = 256; \
+                       seq->seq.s = (char*)malloc(seq->seq.m); \
+               } \
                while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \
-                       if (isgraph(c)) { /* printable non-space character */           \
-                               if (seq->seq.l + 1 >= seq->seq.m) { /* double the memory */ \
-                                       seq->seq.m = seq->seq.l + 2;                                            \
-                                       kroundup32(seq->seq.m); /* rounded to next closest 2^k */ \
-                                       seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \
-                               }                                                                                                               \
-                               seq->seq.s[seq->seq.l++] = (char)c;                                             \
-                       }                                                                                                                       \
-               }                                                                                                                               \
+                       seq->seq.s[seq->seq.l++] = c; /* this is safe: we always have enough space for 1 char */ \
+                       ks_getuntil2(ks, '\n', &seq->seq, 0, 1); /* read the rest of the line */ \
+               } \
                if (c == '>' || c == '@') seq->last_char = c; /* the first header char has been read */ \
-               seq->seq.s[seq->seq.l] = 0;     /* null terminated string */            \
-               if (c != '+') return seq->seq.l; /* FASTA */                                    \
-               if (seq->qual.m < seq->seq.m) { /* allocate enough memory */    \
-                       seq->qual.m = seq->seq.m;                                                                       \
-                       seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m);         \
-               }                                                                                                                               \
+               if (seq->seq.l + 1 >= seq->seq.m) { /* seq->seq.s[seq->seq.l] below may be out of boundary */ \
+                       seq->seq.m = seq->seq.l + 2; \
+                       kroundup32(seq->seq.m); /* rounded to the next closest 2^k */ \
+                       seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \
+               } \
+               seq->seq.s[seq->seq.l] = 0;     /* null terminated string */ \
+               if (c != '+') return seq->seq.l; /* FASTA */ \
+               if (seq->qual.m < seq->seq.m) { /* allocate memory for qual in case insufficient */ \
+                       seq->qual.m = seq->seq.m; \
+                       seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m); \
+               } \
                while ((c = ks_getc(ks)) != -1 && c != '\n'); /* skip the rest of '+' line */ \
-               if (c == -1) return -2; /* we should not stop here */                   \
-               while ((c = ks_getc(ks)) != -1 && seq->qual.l < seq->seq.l)             \
-                       if (c >= 33 && c <= 127) seq->qual.s[seq->qual.l++] = (unsigned char)c; \
-               seq->qual.s[seq->qual.l] = 0; /* null terminated string */              \
+               if (c == -1) return -2; /* error: no quality string */ \
+               while (ks_getuntil2(ks, '\n', &seq->qual, 0, 1) >= 0 && seq->qual.l < seq->seq.l); \
                seq->last_char = 0;     /* we have not come to the next header line */ \
-               if (seq->seq.l != seq->qual.l) return -2; /* qual string is shorter than seq string */ \
-               return seq->seq.l;                                                                                              \
+               if (seq->seq.l != seq->qual.l) return -2; /* error: qual string is of a different length */ \
+               return seq->seq.l; \
        }
 
 #define __KSEQ_TYPE(type_t)                                            \
@@ -219,7 +216,7 @@ typedef struct __kstring_t {
        } kseq_t;
 
 #define KSEQ_INIT(type_t, __read)                              \
-       KSTREAM_INIT(type_t, __read, 4096)                      \
+       KSTREAM_INIT(type_t, __read, 16384)                     \
        __KSEQ_TYPE(type_t)                                                     \
        __KSEQ_BASIC(type_t)                                            \
        __KSEQ_READ
diff --git a/samtools/misc/seqtk.c.pysam.c b/samtools/misc/seqtk.c.pysam.c
new file mode 100644 (file)
index 0000000..46b3c56
--- /dev/null
@@ -0,0 +1,785 @@
+#include "pysam.h"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <zlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+
+#include "kseq.h"
+KSEQ_INIT(gzFile, gzread)
+
+typedef struct {
+       int n, m;
+       uint64_t *a;
+} reglist_t;
+
+#include "khash.h"
+KHASH_MAP_INIT_STR(reg, reglist_t)
+
+typedef kh_reg_t reghash_t;
+
+reghash_t *stk_reg_read(const char *fn)
+{
+       reghash_t *h = kh_init(reg);
+       gzFile fp;
+       kstream_t *ks;
+       int dret;
+       kstring_t *str;
+       // read the list
+       str = calloc(1, sizeof(kstring_t));
+       fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r");
+       ks = ks_init(fp);
+       while (ks_getuntil(ks, 0, str, &dret) >= 0) {
+               int beg = -1, end = -1;
+               reglist_t *p;
+               khint_t k = kh_get(reg, h, str->s);
+               if (k == kh_end(h)) {
+                       int ret;
+                       char *s = strdup(str->s);
+                       k = kh_put(reg, h, s, &ret);
+                       memset(&kh_val(h, k), 0, sizeof(reglist_t));
+               }
+               p = &kh_val(h, k);
+               if (dret != '\n') {
+                       if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
+                               beg = atoi(str->s);
+                               if (dret != '\n') {
+                                       if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
+                                               end = atoi(str->s);
+                                               if (end < 0) end = -1;
+                                       }
+                               }
+                       }
+               }
+               // skip the rest of the line
+               if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n');
+               if (end < 0 && beg > 0) end = beg, beg = beg - 1; // if there is only one column
+               if (beg < 0) beg = 0, end = INT_MAX;
+               if (p->n == p->m) {
+                       p->m = p->m? p->m<<1 : 4;
+                       p->a = realloc(p->a, p->m * 8);
+               }
+               p->a[p->n++] = (uint64_t)beg<<32 | end;
+       }
+       ks_destroy(ks);
+       gzclose(fp);
+       free(str->s); free(str);
+       return h;
+}
+
+void stk_reg_destroy(reghash_t *h)
+{
+       khint_t k;
+       for (k = 0; k < kh_end(h); ++k) {
+               if (kh_exist(h, k)) {
+                       free(kh_val(h, k).a);
+                       free((char*)kh_key(h, k));
+               }
+       }
+       kh_destroy(reg, h);
+}
+
+/* constant table */
+
+unsigned char seq_nt16_table[256] = {
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15 /*'-'*/,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15, 1,14, 2, 13,15,15, 4, 11,15,15,12, 15, 3,15,15,
+       15,15, 5, 6,  8,15, 7, 9,  0,10,15,15, 15,15,15,15,
+       15, 1,14, 2, 13,15,15, 4, 11,15,15,12, 15, 3,15,15,
+       15,15, 5, 6,  8,15, 7, 9,  0,10,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+       15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15
+};
+
+char *seq_nt16_rev_table = "XACMGRSVTWYHKDBN";
+unsigned char seq_nt16to4_table[] = { 4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4 };
+int bitcnt_table[] = { 4, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
+
+/* composition */
+int stk_comp(int argc, char *argv[])
+{
+       gzFile fp;
+       kseq_t *seq;
+       int l, c, upper_only = 0;
+       reghash_t *h = 0;
+       reglist_t dummy;
+       while ((c = getopt(argc, argv, "ur:")) >= 0) {
+               switch (c) {
+                       case 'u': upper_only = 1; break;
+                       case 'r': h = stk_reg_read(optarg); break;
+               }
+       }
+       if (argc == optind) {
+               fprintf(pysamerr, "Usage:  seqtk comp [-u] [-r in.bed] <in.fa>\n\n");
+               fprintf(pysamerr, "Output format: chr, length, #A, #C, #G, #T, #2, #3, #4, #CpG, #tv, #ts, #CpG-ts\n");
+               return 1;
+       }
+       fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r");
+       seq = kseq_init(fp);
+       dummy.n= dummy.m = 1; dummy.a = calloc(1, 8);
+       while ((l = kseq_read(seq)) >= 0) {
+               int i, k;
+               reglist_t *p = 0;
+               if (h) {
+                       khint_t k = kh_get(reg, h, seq->name.s);
+                       if (k != kh_end(h)) p = &kh_val(h, k);
+               } else {
+                       p = &dummy;
+                       dummy.a[0] = l;
+               }
+               for (k = 0; p && k < p->n; ++k) {
+                       int beg = p->a[k]>>32, end = p->a[k]&0xffffffff;
+                       int la, lb, lc, na, nb, nc, cnt[11];
+                       if (beg > 0) la = seq->seq.s[beg-1], lb = seq_nt16_table[la], lc = bitcnt_table[lb];
+                       else la = 'a', lb = -1, lc = 0;
+                       na = seq->seq.s[beg]; nb = seq_nt16_table[na]; nc = bitcnt_table[nb];
+                       memset(cnt, 0, 11 * sizeof(int));
+                       for (i = beg; i < end; ++i) {
+                               int is_CpG = 0, a, b, c;
+                               a = na; b = nb; c = nc;
+                               na = seq->seq.s[i+1]; nb = seq_nt16_table[na]; nc = bitcnt_table[nb];
+                               if (b == 2 || b == 10) { // C or Y
+                                       if (nb == 4 || nb == 5) is_CpG = 1;
+                               } else if (b == 4 || b == 5) { // G or R
+                                       if (lb == 2 || lb == 10) is_CpG = 1;
+                               }
+                               if (upper_only == 0 || isupper(a)) {
+                                       if (c > 1) ++cnt[c+2];
+                                       if (c == 1) ++cnt[seq_nt16to4_table[b]];
+                                       if (b == 10 || b == 5) ++cnt[9];
+                                       else if (c == 2) {
+                                               ++cnt[8];
+                                       }
+                                       if (is_CpG) {
+                                               ++cnt[7];
+                                               if (b == 10 || b == 5) ++cnt[10];
+                                       }
+                               }
+                               la = a; lb = b; lc = c;
+                       }
+                       if (h) printf("%s\t%d\t%d", seq->name.s, beg, end);
+                       else printf("%s\t%d", seq->name.s, l);
+                       for (i = 0; i < 11; ++i) printf("\t%d", cnt[i]);
+                       putchar('\n');
+               }
+               fflush(stdout);
+       }
+       free(dummy.a);
+       kseq_destroy(seq);
+       gzclose(fp);
+       return 0;
+}
+
+int stk_randbase(int argc, char *argv[])
+{
+       gzFile fp;
+       kseq_t *seq;
+       int l;
+       if (argc == 1) {
+               fprintf(pysamerr, "Usage: seqtk randbase <in.fa>\n");
+               return 1;
+       }
+       fp = (strcmp(argv[1], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[1], "r");
+       seq = kseq_init(fp);
+       while ((l = kseq_read(seq)) >= 0) {
+               int i;
+               printf(">%s", seq->name.s);
+               for (i = 0; i < l; ++i) {
+                       int c, b, a, j, k, m;
+                       b = seq->seq.s[i];
+                       c = seq_nt16_table[b];
+                       a = bitcnt_table[c];
+                       if (a == 2) {
+                               m = (drand48() < 0.5);
+                               for (j = k = 0; j < 4; ++j) {
+                                       if ((1<<j & c) == 0) continue;
+                                       if (k == m) break;
+                                       ++k;
+                               }
+                               seq->seq.s[i] = islower(b)? "acgt"[j] : "ACGT"[j];
+                       }
+                       if (i%60 == 0) putchar('\n');
+                       putchar(seq->seq.s[i]);
+               }
+               putchar('\n');
+       }
+       kseq_destroy(seq);
+       gzclose(fp);
+       return 0;
+}
+
+int stk_hety(int argc, char *argv[])
+{
+       gzFile fp;
+       kseq_t *seq;
+       int l, c, win_size = 50000, n_start = 5, win_step, is_lower_mask = 0;
+       char *buf;
+       uint32_t cnt[3];
+       if (argc == 1) {
+               fprintf(pysamerr, "\n");
+               fprintf(pysamerr, "Usage:   seqtk hety [options] <in.fa>\n\n");
+               fprintf(pysamerr, "Options: -w INT   window size [%d]\n", win_size);
+               fprintf(pysamerr, "         -t INT   # start positions in a window [%d]\n", n_start);
+               fprintf(pysamerr, "         -m       treat lowercases as masked\n");
+               fprintf(pysamerr, "\n");
+               return 1;
+       }
+       while ((c = getopt(argc, argv, "w:t:m")) >= 0) {
+               switch (c) {
+               case 'w': win_size = atoi(optarg); break;
+               case 't': n_start = atoi(optarg); break;
+               case 'm': is_lower_mask = 1; break;
+               }
+       }
+       fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r");
+       seq = kseq_init(fp);
+       win_step = win_size / n_start;
+       buf = calloc(win_size, 1);
+       while ((l = kseq_read(seq)) >= 0) {
+               int x, i, y, z, next = 0;
+               cnt[0] = cnt[1] = cnt[2] = 0;
+               for (i = 0; i <= l; ++i) {
+                       if ((i >= win_size && i % win_step == 0) || i == l) {
+                               if (i == l && l >= win_size) {
+                                       for (y = l - win_size; y < next; ++y) --cnt[(int)buf[y % win_size]];
+                               }
+                               if (cnt[1] + cnt[2] > 0)
+                                       printf("%s\t%d\t%d\t%.2lf\t%d\t%d\n", seq->name.s, next, i,
+                                                  (double)cnt[2] / (cnt[1] + cnt[2]) * win_size, cnt[1] + cnt[2], cnt[2]);
+                               next = i;
+                       }
+                       if (i < l) {
+                               y = i % win_size;
+                               c = seq->seq.s[i];
+                               if (is_lower_mask && islower(c)) c = 'N';
+                               c = seq_nt16_table[c];
+                               x = bitcnt_table[c];
+                               if (i >= win_size) --cnt[(int)buf[y]];
+                               buf[y] = z = x > 2? 0 : x == 2? 2 : 1;
+                               ++cnt[z];
+                       }
+               }
+       }
+       free(buf);
+       kseq_destroy(seq);
+       gzclose(fp);
+       return 0;
+}
+
+/* fq2fa */
+int stk_fq2fa(int argc, char *argv[])
+{
+       gzFile fp;
+       kseq_t *seq;
+       char *buf;
+       int l, i, c, qual_thres = 0, linelen = 60;
+       while ((c = getopt(argc, argv, "q:l:")) >= 0) {
+               switch (c) {
+                       case 'q': qual_thres = atoi(optarg); break;
+                       case 'l': linelen = atoi(optarg); break;
+               }
+       }
+       if (argc == optind) {
+               fprintf(pysamerr, "Usage: seqtk fq2fa [-q qualThres=0] [-l lineLen=60] <in.fq>\n");
+               return 1;
+       }
+       buf = linelen > 0? malloc(linelen + 1) : 0;
+       fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r");
+       seq = kseq_init(fp);
+       while ((l = kseq_read(seq)) >= 0) {
+               if (seq->qual.l && qual_thres > 0) {
+                       for (i = 0; i < l; ++i)
+                               if (seq->qual.s[i] - 33 < qual_thres)
+                                       seq->seq.s[i] = tolower(seq->seq.s[i]);
+               }
+               putchar('>');
+               if (seq->comment.l) {
+                       fputs(seq->name.s, stdout);
+                       putchar(' ');
+                       puts(seq->comment.s);
+               } else puts(seq->name.s);
+               if (buf) { // multi-line
+                       for (i = 0; i < l; i += linelen) {
+                               int x = i + linelen < l? linelen : l - i;
+                               memcpy(buf, seq->seq.s + i, x);
+                               buf[x] = 0;
+                               puts(buf);
+                       }
+               } else puts(seq->seq.s);
+       }
+       free(buf);
+       kseq_destroy(seq);
+       gzclose(fp);
+       return 0;
+}
+
+int stk_maskseq(int argc, char *argv[])
+{
+       khash_t(reg) *h = kh_init(reg);
+       gzFile fp;
+       kseq_t *seq;
+       int l, i, j, c, is_complement = 0, is_lower = 0;
+       khint_t k;
+       while ((c = getopt(argc, argv, "cl")) >= 0) {
+               switch (c) {
+               case 'c': is_complement = 1; break;
+               case 'l': is_lower = 1; break;
+               }
+       }
+       if (argc - optind < 2) {
+               fprintf(pysamerr, "Usage:   seqtk maskseq [-cl] <in.fa> <in.bed>\n\n");
+               fprintf(pysamerr, "Options: -c     mask the complement regions\n");
+               fprintf(pysamerr, "         -l     soft mask (to lower cases)\n");
+               return 1;
+       }
+       h = stk_reg_read(argv[optind+1]);
+       // maskseq
+       fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r");
+       seq = kseq_init(fp);
+       while ((l = kseq_read(seq)) >= 0) {
+               k = kh_get(reg, h, seq->name.s);
+               if (k == kh_end(h)) { // not found in the hash table
+                       if (is_complement) {
+                               for (j = 0; j < l; ++j)
+                                       seq->seq.s[j] = is_lower? tolower(seq->seq.s[j]) : 'N';
+                       }
+               } else {
+                       reglist_t *p = &kh_val(h, k);
+                       if (!is_complement) {
+                               for (i = 0; i < p->n; ++i) {
+                                       int beg = p->a[i]>>32, end = p->a[i];
+                                       if (beg >= seq->seq.l) {
+                                               fprintf(pysamerr, "[maskseq] start position >= the sequence length.\n");
+                                               continue;
+                                       }
+                                       if (end >= seq->seq.l) end = seq->seq.l;
+                                       if (is_lower) for (j = beg; j < end; ++j) seq->seq.s[j] = tolower(seq->seq.s[j]);
+                                       else for (j = beg; j < end; ++j) seq->seq.s[j] = 'N';
+                               }
+                       } else {
+                               int8_t *mask = calloc(seq->seq.l, 1);
+                               for (i = 0; i < p->n; ++i) {
+                                       int beg = p->a[i]>>32, end = p->a[i];
+                                       if (end >= seq->seq.l) end = seq->seq.l;
+                                       for (j = beg; j < end; ++j) mask[j] = 1;
+                               }
+                               for (j = 0; j < l; ++j)
+                                       if (mask[j] == 0) seq->seq.s[j] = is_lower? tolower(seq->seq.s[j]) : 'N';
+                               free(mask);
+                       }
+               }
+               printf(">%s", seq->name.s);
+               for (j = 0; j < seq->seq.l; ++j) {
+                       if (j%60 == 0) putchar('\n');
+                       putchar(seq->seq.s[j]);
+               }
+               putchar('\n');
+       }
+       // free
+       kseq_destroy(seq);
+       gzclose(fp);
+       stk_reg_destroy(h);
+       return 0;
+}
+
+/* subseq */
+
+int stk_subseq(int argc, char *argv[])
+{
+       khash_t(reg) *h = kh_init(reg);
+       gzFile fp;
+       kseq_t *seq;
+       int l, i, j, c, is_tab = 0;
+       khint_t k;
+       while ((c = getopt(argc, argv, "t")) >= 0) {
+               switch (c) {
+               case 't': is_tab = 1; break;
+               }
+       }
+       if (optind + 2 > argc) {
+               fprintf(pysamerr, "Usage: seqtk subseq [-t] <in.fa> <in.bed>\n\n");
+               fprintf(pysamerr, "Note: Use 'samtools faidx' if only a few regions are intended.\n");
+               return 1;
+       }
+       h = stk_reg_read(argv[optind+1]);
+       // subseq
+       fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r");
+       seq = kseq_init(fp);
+       while ((l = kseq_read(seq)) >= 0) {
+               reglist_t *p;
+               k = kh_get(reg, h, seq->name.s);
+               if (k == kh_end(h)) continue;
+               p = &kh_val(h, k);
+               for (i = 0; i < p->n; ++i) {
+                       int beg = p->a[i]>>32, end = p->a[i];
+                       if (beg >= seq->seq.l) {
+                               fprintf(pysamerr, "[subseq] %s: %d >= %ld\n", seq->name.s, beg, seq->seq.l);
+                               continue;
+                       }
+                       if (end > seq->seq.l) end = seq->seq.l;
+                       if (is_tab == 0) {
+                               printf("%c%s", seq->qual.l == seq->seq.l? '@' : '>', seq->name.s);
+                               if (end == INT_MAX) {
+                                       if (beg) printf(":%d", beg+1);
+                               } else printf(":%d-%d", beg+1, end);
+                       } else printf("%s\t%d\t", seq->name.s, beg + 1);
+                       if (end > seq->seq.l) end = seq->seq.l;
+                       for (j = 0; j < end - beg; ++j) {
+                               if (is_tab == 0 && j % 60 == 0) putchar('\n');
+                               putchar(seq->seq.s[j + beg]);
+                       }
+                       putchar('\n');
+                       if (seq->qual.l != seq->seq.l || is_tab) continue;
+                       printf("+");
+                       for (j = 0; j < end - beg; ++j) {
+                               if (j % 60 == 0) putchar('\n');
+                               putchar(seq->qual.s[j + beg]);
+                       }
+                       putchar('\n');
+               }
+       }
+       // free
+       kseq_destroy(seq);
+       gzclose(fp);
+       stk_reg_destroy(h);
+       return 0;
+}
+
+/* mergefa */
+int stk_mergefa(int argc, char *argv[])
+{
+       gzFile fp[2];
+       kseq_t *seq[2];
+       int i, l, c, is_intersect = 0, is_haploid = 0, qual = 0, is_mask = 0;
+       while ((c = getopt(argc, argv, "himq:")) >= 0) {
+               switch (c) {
+                       case 'i': is_intersect = 1; break;
+                       case 'h': is_haploid = 1; break;
+                       case 'm': is_mask = 1; break;
+                       case 'q': qual = atoi(optarg); break;
+               }
+       }
+       if (is_mask && is_intersect) {
+               fprintf(pysamerr, "[%s] `-i' and `-h' cannot be applied at the same time.\n", __func__);
+               return 1;
+       }
+       if (optind + 2 > argc) {
+               fprintf(pysamerr, "\nUsage: seqtk mergefa [options] <in1.fa> <in2.fa>\n\n");
+               fprintf(pysamerr, "Options: -q INT   quality threshold [0]\n");
+               fprintf(pysamerr, "         -i       take intersection\n");
+               fprintf(pysamerr, "         -m       convert to lowercase when one of the input base is N.\n");
+               fprintf(pysamerr, "         -h       suppress hets in the input\n\n");
+               return 1;
+       }
+       for (i = 0; i < 2; ++i) {
+               fp[i] = strcmp(argv[optind+i], "-")? gzopen(argv[optind+i], "r") : gzdopen(fileno(stdin), "r");
+               seq[i] = kseq_init(fp[i]);
+       }
+       while (kseq_read(seq[0]) >= 0) {
+               int min_l, c[2], is_upper;
+               kseq_read(seq[1]);
+               if (strcmp(seq[0]->name.s, seq[1]->name.s))
+                       fprintf(pysamerr, "[%s] Different sequence names: %s != %s\n", __func__, seq[0]->name.s, seq[1]->name.s);
+               if (seq[0]->seq.l != seq[1]->seq.l)
+                       fprintf(pysamerr, "[%s] Unequal sequence length: %ld != %ld\n", __func__, seq[0]->seq.l, seq[1]->seq.l);
+               min_l = seq[0]->seq.l < seq[1]->seq.l? seq[0]->seq.l : seq[1]->seq.l;
+               printf(">%s", seq[0]->name.s);
+               for (l = 0; l < min_l; ++l) {
+                       c[0] = seq[0]->seq.s[l]; c[1] = seq[1]->seq.s[l];
+                       if (seq[0]->qual.l && seq[0]->qual.s[l] - 33 < qual) c[0] = tolower(c[0]);
+                       if (seq[1]->qual.l && seq[1]->qual.s[l] - 33 < qual) c[1] = tolower(c[1]);
+                       if (is_intersect) is_upper = (isupper(c[0]) || isupper(c[1]))? 1 : 0;
+                       else if (is_mask) is_upper = (isupper(c[0]) || isupper(c[1]))? 1 : 0;
+                       else is_upper = (isupper(c[0]) && isupper(c[1]))? 1 : 0;
+                       c[0] = seq_nt16_table[c[0]]; c[1] = seq_nt16_table[c[1]];
+                       if (c[0] == 0) c[0] = 15;
+                       if (c[1] == 0) c[1] = 15;
+                       if (is_haploid && (bitcnt_table[c[0]] > 1 || bitcnt_table[c[1]] > 1)) is_upper = 0;
+                       if (is_intersect) {
+                               c[0] = c[0] & c[1];
+                               if (c[0] == 0) is_upper = 0;
+                       } else if (is_mask) {
+                               if (c[0] == 15 || c[1] == 15) is_upper = 0;
+                               c[0] = c[0] & c[1];
+                               if (c[0] == 0) is_upper = 0;
+                       } else c[0] = c[0] | c[1];
+                       c[0] = seq_nt16_rev_table[c[0]];
+                       if (!is_upper) c[0] = tolower(c[0]);
+                       if (l%60 == 0) putchar('\n');
+                       putchar(c[0]);
+               }
+               putchar('\n');
+       }
+       return 0;
+}
+
+int stk_famask(int argc, char *argv[])
+{
+       gzFile fp[2];
+       kseq_t *seq[2];
+       int i, l;
+       if (argc < 3) {
+               fprintf(pysamerr, "Usage: seqtk famask <src.fa> <mask.fa>\n");
+               return 1;
+       }
+       for (i = 0; i < 2; ++i) {
+               fp[i] = strcmp(argv[optind+i], "-")? gzopen(argv[optind+i], "r") : gzdopen(fileno(stdin), "r");
+               seq[i] = kseq_init(fp[i]);
+       }
+       while (kseq_read(seq[0]) >= 0) {
+               int min_l, c[2];
+               kseq_read(seq[1]);
+               if (strcmp(seq[0]->name.s, seq[1]->name.s))
+                       fprintf(pysamerr, "[%s] Different sequence names: %s != %s\n", __func__, seq[0]->name.s, seq[1]->name.s);
+               if (seq[0]->seq.l != seq[1]->seq.l)
+                       fprintf(pysamerr, "[%s] Unequal sequence length: %ld != %ld\n", __func__, seq[0]->seq.l, seq[1]->seq.l);
+               min_l = seq[0]->seq.l < seq[1]->seq.l? seq[0]->seq.l : seq[1]->seq.l;
+               printf(">%s", seq[0]->name.s);
+               for (l = 0; l < min_l; ++l) {
+                       c[0] = seq[0]->seq.s[l]; c[1] = seq[1]->seq.s[l];
+                       if (c[1] == 'x') c[0] = tolower(c[0]);
+                       else if (c[1] != 'X') c[0] = c[1];
+                       if (l%60 == 0) putchar('\n');
+                       putchar(c[0]);
+               }
+               putchar('\n');
+       }
+       return 0;
+}
+
+int stk_mutfa(int argc, char *argv[])
+{
+       khash_t(reg) *h = kh_init(reg);
+       gzFile fp;
+       kseq_t *seq;
+       kstream_t *ks;
+       int l, i, dret;
+       kstring_t *str;
+       khint_t k;
+       if (argc < 3) {
+               fprintf(pysamerr, "Usage: seqtk mutfa <in.fa> <in.snp>\n\n");
+               fprintf(pysamerr, "Note: <in.snp> contains at least four columns per line which are:\n");
+               fprintf(pysamerr, "      'chr  1-based-pos  any  base-changed-to'.\n");
+               return 1;
+       }
+       // read the list
+       str = calloc(1, sizeof(kstring_t));
+       fp = strcmp(argv[2], "-")? gzopen(argv[2], "r") : gzdopen(fileno(stdin), "r");
+       ks = ks_init(fp);
+       while (ks_getuntil(ks, 0, str, &dret) >= 0) {
+               char *s = strdup(str->s);
+               int beg = 0, ret;
+               reglist_t *p;
+               k = kh_get(reg, h, s);
+               if (k == kh_end(h)) {
+                       k = kh_put(reg, h, s, &ret);
+                       memset(&kh_val(h, k), 0, sizeof(reglist_t));
+               }
+               p = &kh_val(h, k);
+               if (ks_getuntil(ks, 0, str, &dret) > 0) beg = atol(str->s) - 1; // 2nd col
+               ks_getuntil(ks, 0, str, &dret); // 3rd col
+               ks_getuntil(ks, 0, str, &dret); // 4th col
+               // skip the rest of the line
+               if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n');
+               if (isalpha(str->s[0]) && str->l == 1) {
+                       if (p->n == p->m) {
+                               p->m = p->m? p->m<<1 : 4;
+                               p->a = realloc(p->a, p->m * 8);
+                       }
+                       p->a[p->n++] = (uint64_t)beg<<32 | str->s[0];
+               }
+       }
+       ks_destroy(ks);
+       gzclose(fp);
+       free(str->s); free(str);
+       // mutfa
+       fp = strcmp(argv[1], "-")? gzopen(argv[1], "r") : gzdopen(fileno(stdin), "r");
+       seq = kseq_init(fp);
+       while ((l = kseq_read(seq)) >= 0) {
+               reglist_t *p;
+               k = kh_get(reg, h, seq->name.s);
+               if (k != kh_end(h)) {
+                       p = &kh_val(h, k);
+                       for (i = 0; i < p->n; ++i) {
+                               int beg = p->a[i]>>32;
+                               if (beg < seq->seq.l)
+                                       seq->seq.s[beg] = (int)p->a[i];
+                       }
+               }
+               printf(">%s", seq->name.s);
+               for (i = 0; i < l; ++i) {
+                       if (i%60 == 0) putchar('\n');
+                       putchar(seq->seq.s[i]);
+               }
+               putchar('\n');
+       }
+       // free
+       kseq_destroy(seq);
+       gzclose(fp);
+       for (k = 0; k < kh_end(h); ++k) {
+               if (kh_exist(h, k)) {
+                       free(kh_val(h, k).a);
+                       free((char*)kh_key(h, k));
+               }
+       }
+       kh_destroy(reg, h);
+       return 0;
+}
+
+int stk_listhet(int argc, char *argv[])
+{
+       gzFile fp;
+       kseq_t *seq;
+       int i, l;
+       if (argc == 1) {
+               fprintf(pysamerr, "Usage: seqtk listhet <in.fa>\n");
+               return 1;
+       }
+       fp = (strcmp(argv[1], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[1], "r");
+       seq = kseq_init(fp);
+       while ((l = kseq_read(seq)) >= 0) {
+               for (i = 0; i < l; ++i) {
+                       int b = seq->seq.s[i];
+                       if (bitcnt_table[seq_nt16_table[b]] == 2)
+                               printf("%s\t%d\t%c\n", seq->name.s, i+1, b);
+               }
+       }
+       kseq_destroy(seq);
+       gzclose(fp);
+       return 0;
+}
+
+/* cutN */
+static int cutN_min_N_tract = 1000;
+static int cutN_nonN_penalty = 10;
+
+static int find_next_cut(const kseq_t *ks, int k, int *begin, int *end)
+{
+       int i, b, e;
+       while (k < ks->seq.l) {
+               if (seq_nt16_table[(int)ks->seq.s[k]] == 15) {
+                       int score, max;
+                       score = 0; e = max = -1;
+                       for (i = k; i < ks->seq.l && score >= 0; ++i) { /* forward */
+                               if (seq_nt16_table[(int)ks->seq.s[i]] == 15) ++score;
+                               else score -= cutN_nonN_penalty;
+                               if (score > max) max = score, e = i;
+                       }
+                       score = 0; b = max = -1;
+                       for (i = e; i >= 0 && score >= 0; --i) { /* backward */
+                               if (seq_nt16_table[(int)ks->seq.s[i]] == 15) ++score;
+                               else score -= cutN_nonN_penalty;
+                               if (score > max) max = score, b = i;
+                       }
+                       if (e + 1 - b >= cutN_min_N_tract) {
+                               *begin = b;
+                               *end = e + 1;
+                               return *end;
+                       }
+                       k = e + 1;
+               } else ++k;
+       }
+       return -1;
+}
+static void print_seq(FILE *fpout, const kseq_t *ks, int begin, int end)
+{
+       int i;
+       if (begin >= end) return; // FIXME: why may this happen? Understand it!
+       fprintf(fpout, ">%s:%d-%d", ks->name.s, begin+1, end);
+       for (i = begin; i < end && i < ks->seq.l; ++i) {
+               if ((i - begin)%60 == 0) fputc('\n', fpout);
+               fputc(ks->seq.s[i], fpout);
+       }
+       fputc('\n', fpout);
+}
+int stk_cutN(int argc, char *argv[])
+{
+       int c, l, gap_only = 0;
+       gzFile fp;
+       kseq_t *ks;
+       while ((c = getopt(argc, argv, "n:p:g")) >= 0) {
+               switch (c) {
+               case 'n': cutN_min_N_tract = atoi(optarg); break;
+               case 'p': cutN_nonN_penalty = atoi(optarg); break;
+               case 'g': gap_only = 1; break;
+               default: return 1;
+               }
+       }
+       if (argc == optind) {
+               fprintf(pysamerr, "\n");
+               fprintf(pysamerr, "Usage:   seqtk cutN [options] <in.fa>\n\n");
+               fprintf(pysamerr, "Options: -n INT    min size of N tract [%d]\n", cutN_min_N_tract);
+               fprintf(pysamerr, "         -p INT    penalty for a non-N [%d]\n", cutN_nonN_penalty);
+               fprintf(pysamerr, "         -g        print gaps only, no sequence\n\n");
+               return 1;
+       }
+       fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r");
+       ks = kseq_init(fp);
+       while ((l = kseq_read(ks)) >= 0) {
+               int k = 0, begin = 0, end = 0;
+               while (find_next_cut(ks, k, &begin, &end) >= 0) {
+                       if (begin != 0) {
+                               if (gap_only) printf("%s\t%d\t%d\n", ks->name.s, begin, end);
+                               else print_seq(stdout, ks, k, begin);
+                       }
+                       k = end;
+               }
+               if (!gap_only) print_seq(stdout, ks, k, l);
+       }
+       kseq_destroy(ks);
+       gzclose(fp);
+       return 0;
+}
+
+/* main function */
+static int usage()
+{
+       fprintf(pysamerr, "\n");
+       fprintf(pysamerr, "Usage:   seqtk <command> <arguments>\n\n");
+       fprintf(pysamerr, "Command: comp      get the nucleotide composite of FASTA/Q\n");
+       fprintf(pysamerr, "         hety      regional heterozygosity\n");
+       fprintf(pysamerr, "         fq2fa     convert FASTQ to FASTA\n");
+       fprintf(pysamerr, "         subseq    extract subsequences from FASTA/Q\n");
+       fprintf(pysamerr, "         maskseq   mask sequences\n");
+       fprintf(pysamerr, "         mutfa     point mutate FASTA at specified positions\n");
+       fprintf(pysamerr, "         mergefa   merge two FASTA/Q files\n");
+       fprintf(pysamerr, "         randbase  choose a random base from hets\n");
+       fprintf(pysamerr, "         cutN      cut sequence at long N\n");
+       fprintf(pysamerr, "         listhet   extract the position of each het\n");
+       fprintf(pysamerr, "\n");
+       return 1;
+}
+
+int main(int argc, char *argv[])
+{
+       if (argc == 1) return usage();
+       if (strcmp(argv[1], "comp") == 0) stk_comp(argc-1, argv+1);
+       else if (strcmp(argv[1], "hety") == 0) stk_hety(argc-1, argv+1);
+       else if (strcmp(argv[1], "fq2fa") == 0) stk_fq2fa(argc-1, argv+1);
+       else if (strcmp(argv[1], "subseq") == 0) stk_subseq(argc-1, argv+1);
+       else if (strcmp(argv[1], "maskseq") == 0) stk_maskseq(argc-1, argv+1);
+       else if (strcmp(argv[1], "mutfa") == 0) stk_mutfa(argc-1, argv+1);
+       else if (strcmp(argv[1], "mergefa") == 0) stk_mergefa(argc-1, argv+1);
+       else if (strcmp(argv[1], "randbase") == 0) stk_randbase(argc-1, argv+1);
+       else if (strcmp(argv[1], "cutN") == 0) stk_cutN(argc-1, argv+1);
+       else if (strcmp(argv[1], "listhet") == 0) stk_listhet(argc-1, argv+1);
+       else if (strcmp(argv[1], "famask") == 0) stk_famask(argc-1, argv+1);
+       else {
+               fprintf(pysamerr, "[main] unrecognized commad '%s'. Abort!\n", argv[1]);
+               return 1;
+       }
+       return 0;
+}
diff --git a/samtools/msvc_compat.h b/samtools/msvc_compat.h
deleted file mode 100644 (file)
index 624cc99..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// Windows-specific code, include with:\r
-// #ifdef _MSC_VER\r
-// #include <msvc_compat.h>\r
-// #endif\r
-\r
-//#define _CRT_SECURE_NO_WARNINGS\r
-#ifndef MSVC_COMPAT_H\r
-#define MSVC_COMPAT_H\r
-\r
-#define inline __inline\r
-#define __func__ __FUNCTION__\r
-\r
-#include <float.h>\r
-#define isnan _isnan\r
-static int isinf(double x) {\r
-    int y = _finite(x);\r
-    if(y == 0) {\r
-       return 0;\r
-    } else {\r
-       return 1;\r
-    }\r
-}\r
-#define alloca _alloca\r
-#define atoll _atoi64\r
-\r
-#define ftello ftell\r
-
-typedef int bool;\r
-\r
-static int R_OK = 4;
-\r
-#ifndef lgamma\r
-/* Log gamma function\r
- * \log{\Gamma(z)}\r
- * AS245, 2nd algorithm, http://lib.stat.cmu.edu/apstat/245\r
- */\r
-static double lgamma(double z)\r
-{\r
-       double x = 0;\r
-       x += 0.1659470187408462e-06 / (z+7);\r
-       x += 0.9934937113930748e-05 / (z+6);\r
-       x -= 0.1385710331296526     / (z+5);\r
-       x += 12.50734324009056      / (z+4);\r
-       x -= 176.6150291498386      / (z+3);\r
-       x += 771.3234287757674      / (z+2);\r
-       x -= 1259.139216722289      / (z+1);\r
-       x += 676.5203681218835      / z;\r
-       x += 0.9999999999995183;\r
-       return log(x) - 5.58106146679532777 - z + (z-0.5) * log(z+6.5);\r
-}\r
-#endif\r
-\r
-#ifndef M_LN10\r
-#define        M_LN10   2.30258509299404568402\r
-#endif\r
-#ifndef M_LN2\r
-#define        M_LN2   0.69314718055994530942\r
-#endif\r
-
-#endif\r
index 2c4736336ee2e27150ce47d15d661e190c580888..05da8e3e5a51dd157b2ffcdb250e4b045f0a7e8c 100644 (file)
@@ -21,39 +21,28 @@ typedef struct {
 
 typedef khash_t(rg) *rghash_t;
 
+// FIXME: we'd better use no global variables...
 static rghash_t g_rghash = 0;
 static int g_min_mapQ = 0, g_flag_on = 0, g_flag_off = 0;
+static float g_subsam = -1;
 static char *g_library, *g_rg;
-static int g_sol2sanger_tbl[128];
 static void *g_bed;
 
 void *bed_read(const char *fn);
 void bed_destroy(void *_h);
 int bed_overlap(const void *_h, const char *chr, int beg, int end);
 
-static void sol2sanger(bam1_t *b)
-{
-       int l;
-       uint8_t *qual = bam1_qual(b);
-       if (g_sol2sanger_tbl[30] == 0) {
-               for (l = 0; l != 128; ++l) {
-                       g_sol2sanger_tbl[l] = (int)(10.0 * log(1.0 + pow(10.0, (l - 64 + 33) / 10.0)) / log(10.0) + .499);
-                       if (g_sol2sanger_tbl[l] >= 93) g_sol2sanger_tbl[l] = 93;
-               }
-       }
-       for (l = 0; l < b->core.l_qseq; ++l) {
-               int q = qual[l];
-               if (q > 127) q = 127;
-               qual[l] = g_sol2sanger_tbl[q];
-       }
-}
-
 static inline int __g_skip_aln(const bam_header_t *h, const bam1_t *b)
 {
        if (b->core.qual < g_min_mapQ || ((b->core.flag & g_flag_on) != g_flag_on) || (b->core.flag & g_flag_off))
                return 1;
        if (g_bed && b->core.tid >= 0 && !bed_overlap(g_bed, h->target_name[b->core.tid], b->core.pos, bam_calend(&b->core, bam1_cigar(b))))
                return 1;
+       if (g_subsam > 0.) {
+               int x = (int)(g_subsam + .499);
+               uint32_t k = __ac_X31_hash_string(bam1_qname(b)) + x;
+               if (k%1024 / 1024.0 >= g_subsam - x) return 1;
+       }
        if (g_rg || g_rghash) {
                uint8_t *s = bam_aux_get(b, "RG");
                if (s) {
@@ -123,7 +112,7 @@ static int usage(int is_long_help);
 
 int main_samview(int argc, char *argv[])
 {
-       int c, is_header = 0, is_header_only = 0, is_bamin = 1, ret = 0, compress_level = -1, is_bamout = 0, slx2sngr = 0, is_count = 0;
+       int c, is_header = 0, is_header_only = 0, is_bamin = 1, ret = 0, compress_level = -1, is_bamout = 0, is_count = 0;
        int of_type = BAM_OFDEC, is_long_help = 0;
        int count = 0;
        samfile_t *in = 0, *out = 0;
@@ -131,10 +120,10 @@ int main_samview(int argc, char *argv[])
 
        /* parse command-line options */
        strcpy(in_mode, "r"); strcpy(out_mode, "w");
-       while ((c = getopt(argc, argv, "Sbct:h1Ho:q:f:F:ul:r:xX?T:CR:L:")) >= 0) {
+       while ((c = getopt(argc, argv, "Sbct:h1Ho:q:f:F:ul:r:xX?T:R:L:s:")) >= 0) {
                switch (c) {
+               case 's': g_subsam = atof(optarg); break;
                case 'c': is_count = 1; break;
-               case 'C': slx2sngr = 1; break;
                case 'S': is_bamin = 0; break;
                case 'b': is_bamout = 1; break;
                case 't': fn_list = strdup(optarg); is_bamin = 0; break;
@@ -218,7 +207,6 @@ int main_samview(int argc, char *argv[])
                int r;
                while ((r = samread(in, b)) >= 0) { // read one alignment from `in'
                        if (!__g_skip_aln(in->header, b)) {
-                               if (slx2sngr) sol2sanger(b);
                                if (!is_count) samwrite(out, b); // write the alignment to `out'
                                count++;
                        }
@@ -301,6 +289,7 @@ static int usage(int is_long_help)
        fprintf(pysamerr, "         -q INT   minimum mapping quality [0]\n");
        fprintf(pysamerr, "         -l STR   only output reads in library STR [null]\n");
        fprintf(pysamerr, "         -r STR   only output reads in read group STR [null]\n");
+       fprintf(pysamerr, "         -s FLOAT fraction of templates to subsample; integer part as seed [-1]\n");
        fprintf(pysamerr, "         -?       longer help\n");
        fprintf(pysamerr, "\n");
        if (is_long_help)
@@ -351,3 +340,69 @@ int main_import(int argc, char *argv[])
        free(argv2);
        return ret;
 }
+
+int8_t seq_comp_table[16] = { 0, 8, 4, 12, 2, 10, 9, 14, 1, 6, 5, 13, 3, 11, 7, 15 };
+
+int main_bam2fq(int argc, char *argv[])
+{
+       bamFile fp;
+       bam_header_t *h;
+       bam1_t *b;
+       int8_t *buf;
+       int max_buf;
+       if (argc == 1) {
+               fprintf(pysamerr, "Usage: samtools bam2fq <in.bam>\n");
+               return 1;
+       }
+       fp = strcmp(argv[1], "-")? bam_open(argv[1], "r") : bam_dopen(fileno(stdin), "r");
+       if (fp == 0) return 1;
+       h = bam_header_read(fp);
+       b = bam_init1();
+       buf = 0;
+       max_buf = 0;
+       while (bam_read1(fp, b) >= 0) {
+               int i, qlen = b->core.l_qseq;
+               uint8_t *seq;
+               putchar('@'); fputs(bam1_qname(b), stdout);
+               if ((b->core.flag & 0x40) && !(b->core.flag & 0x80)) puts("/1");
+               else if ((b->core.flag & 0x80) && !(b->core.flag & 0x40)) puts("/2");
+               else putchar('\n');
+               if (max_buf < qlen + 1) {
+                       max_buf = qlen + 1;
+                       kroundup32(max_buf);
+                       buf = realloc(buf, max_buf);
+               }
+               buf[qlen] = 0;
+               seq = bam1_seq(b);
+               for (i = 0; i < qlen; ++i)
+                       buf[i] = bam1_seqi(seq, i);
+               if (b->core.flag & 16) { // reverse complement
+                       for (i = 0; i < qlen>>1; ++i) {
+                               int8_t t = seq_comp_table[buf[qlen - 1 - i]];
+                               buf[qlen - 1 - i] = seq_comp_table[buf[i]];
+                               buf[i] = t;
+                       }
+                       if (qlen&1) buf[i] = seq_comp_table[buf[i]];
+               }
+               for (i = 0; i < qlen; ++i)
+                       buf[i] = bam_nt16_rev_table[buf[i]];
+               puts((char*)buf);
+               puts("+");
+               seq = bam1_qual(b);
+               for (i = 0; i < qlen; ++i)
+                       buf[i] = 33 + seq[i];
+               if (b->core.flag & 16) { // reverse
+                       for (i = 0; i < qlen>>1; ++i) {
+                               int8_t t = buf[qlen - 1 - i];
+                               buf[qlen - 1 - i] = buf[i];
+                               buf[i] = t;
+                       }
+               }
+               puts((char*)buf);
+       }
+       free(buf);
+       bam_destroy1(b);
+       bam_header_destroy(h);
+       bam_close(fp);
+       return 0;
+}
index dc8e627ec5382382d77ac3860c401d88253cf3af..5f3d655e21a969e8d0c43fb9f122e1bfab75d11d 100644 (file)
@@ -54,10 +54,15 @@ static void add_pair(bam_sample_t *sm, khash_t(sm) *sm2id, const char *key, cons
 int bam_smpl_add(bam_sample_t *sm, const char *fn, const char *txt)
 {
        const char *p = txt, *q, *r;
-       kstring_t buf;
+       kstring_t buf, first_sm;
        int n = 0;
        khash_t(sm) *sm2id = (khash_t(sm)*)sm->sm2id;
+       if (txt == 0) {
+               add_pair(sm, sm2id, fn, fn);
+               return 0;
+       }
        memset(&buf, 0, sizeof(kstring_t));
+    memset(&first_sm, 0, sizeof(kstring_t));
        while ((q = strstr(p, "@RG")) != 0) {
                p = q + 3;
                r = q = 0;
@@ -71,12 +76,21 @@ int bam_smpl_add(bam_sample_t *sm, const char *fn, const char *txt)
                        oq = *u; or = *v; *u = *v = '\0';
                        buf.l = 0; kputs(fn, &buf); kputc('/', &buf); kputs(q, &buf);
                        add_pair(sm, sm2id, buf.s, r);
+            if ( !first_sm.s )
+                kputs(r,&first_sm); 
                        *u = oq; *v = or;
                } else break;
                p = q > r? q : r;
                ++n;
        }
        if (n == 0) add_pair(sm, sm2id, fn, fn);
+    // If there is only one RG tag present in the header and reads are not annotated, don't refuse to work but
+    //  use the tag instead.
+    else if ( n==1 && first_sm.s )
+        add_pair(sm,sm2id,fn,first_sm.s);
+    if ( first_sm.s )
+        free(first_sm.s);
+
 //     add_pair(sm, sm2id, fn, fn);
        free(buf.s);
        return 0;
index 4f9b15a8dfa6e3b46ffa3141fc9fd7b0a9d7d305..0f060721e01acc0900c100060855eac084584aa6 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,6 @@ import version
 version = version.__version__
 
 samtools_exclude = ( "bamtk.c", "razip.c", "bgzip.c", 
-                     "bam_reheader.c", 
                      "main.c", "calDepth.c", "bam2bed.c",
                      "wgsim.c", "md5fa.c", "maq2sam.c",)
 samtools_dest = os.path.abspath( "samtools" )
diff --git a/tabix/msvc_compat.h b/tabix/msvc_compat.h
deleted file mode 100644 (file)
index 624cc99..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// Windows-specific code, include with:\r
-// #ifdef _MSC_VER\r
-// #include <msvc_compat.h>\r
-// #endif\r
-\r
-//#define _CRT_SECURE_NO_WARNINGS\r
-#ifndef MSVC_COMPAT_H\r
-#define MSVC_COMPAT_H\r
-\r
-#define inline __inline\r
-#define __func__ __FUNCTION__\r
-\r
-#include <float.h>\r
-#define isnan _isnan\r
-static int isinf(double x) {\r
-    int y = _finite(x);\r
-    if(y == 0) {\r
-       return 0;\r
-    } else {\r
-       return 1;\r
-    }\r
-}\r
-#define alloca _alloca\r
-#define atoll _atoi64\r
-\r
-#define ftello ftell\r
-
-typedef int bool;\r
-\r
-static int R_OK = 4;
-\r
-#ifndef lgamma\r
-/* Log gamma function\r
- * \log{\Gamma(z)}\r
- * AS245, 2nd algorithm, http://lib.stat.cmu.edu/apstat/245\r
- */\r
-static double lgamma(double z)\r
-{\r
-       double x = 0;\r
-       x += 0.1659470187408462e-06 / (z+7);\r
-       x += 0.9934937113930748e-05 / (z+6);\r
-       x -= 0.1385710331296526     / (z+5);\r
-       x += 12.50734324009056      / (z+4);\r
-       x -= 176.6150291498386      / (z+3);\r
-       x += 771.3234287757674      / (z+2);\r
-       x -= 1259.139216722289      / (z+1);\r
-       x += 676.5203681218835      / z;\r
-       x += 0.9999999999995183;\r
-       return log(x) - 5.58106146679532777 - z + (z-0.5) * log(z+6.5);\r
-}\r
-#endif\r
-\r
-#ifndef M_LN10\r
-#define        M_LN10   2.30258509299404568402\r
-#endif\r
-#ifndef M_LN2\r
-#define        M_LN2   0.69314718055994530942\r
-#endif\r
-
-#endif\r
index a1ca7a019b3df50703d1978d24ec3db89c56d90d..473158ee0a885ae50c451d05ead03b79b1226e06 100644 (file)
@@ -1,4 +1,11 @@
-import sys
+## This script contains some example code 
+## illustrating ways to to use the pysam 
+## interface to samtools.
+##
+## The unit tests in the script pysam_test.py
+## contain more examples.
+##
+
 import pysam
 
 samfile = pysam.Samfile( "ex1.bam", "rb" )
@@ -34,20 +41,8 @@ print "########## pileup with callback ################"
 def my_pileup_callback( column ): print str(column)
 samfile.pileup( region="chr1:10-200", callback=my_pileup_callback )
 
-print "##########iterator row #################"
-iter = pysam.IteratorRow( samfile, 0, 10, 200)
-for x in iter: print str(x)
-
-print "##########iterator col #################"
-iter = pysam.IteratorColumn( samfile, 0, 10, 200 )
-for x in iter: print str(x)
-
-print "#########row all##################"
-iter = pysam.IteratorRowAll( samfile )
-for x in iter: print str(x)
 
-
-print "###################"
+print "########### Using a callback object ###### "
 
 class Counter:
     mCounts = 0
@@ -55,61 +50,24 @@ class Counter:
         self.mCounts += 1
 
 c = Counter()
-samfile.fetch( "chr1:10-200", c )
+samfile.fetch( region = "chr1:10-200", callback = c )
 print "counts=", c.mCounts
 
-sys.exit(0)
-print samfile.getTarget( 0 )
-print samfile.getTarget( 1 )
+print "########### Calling a samtools command line function ############"
 
-for p in pysam.pileup( "-c", "ex1.bam" ):
+for p in pysam.mpileup( "-c", "ex1.bam" ):
     print str(p)
 
-print pysam.pileup.getMessages()
-
-for p in pysam.pileup( "-c", "ex1.bam", raw=True ):
-    print str(p),
-
-
-
-print "###########################"
-
-samfile = pysam.Samfile( "ex2.sam.gz", "r" )
-
-print "num targets=", samfile.getNumTargets()
-
-iter = pysam.IteratorRowAll( samfile )
-for x in iter: print str(x)
-
-samfile.close()
-
-print "###########################"
-samfile = pysam.Samfile( "ex2.sam.gz", "r" )
-def my_fetch_callback( alignment ):
-    print str(alignment)
-
-try:
-    samfile.fetch( "chr1:10-20", my_fetch_callback )
-except AssertionError:
-    print "caught fetch exception"
-
-samfile.close()
+print pysam.mpileup.getMessages()
 
-print "###########################"
-samfile = pysam.Samfile( "ex2.sam.gz", "r" )
-def my_pileup_callback( pileups ):
-    print str(pileups)
-try:
-    samfile.pileup( "chr1:10-20", my_pileup_callback )
-except NotImplementedError:
-    print "caught pileup exception"
+print "########### Investigating headers #######################"
 
 # playing arount with headers
 samfile = pysam.Samfile( "ex3.sam", "r" )
-print samfile.targets
+print samfile.references
 print samfile.lengths
 print samfile.text
-print samdile.header
+print samfile.header
 header = samfile.header
 samfile.close()
 
index d2bf4150de58551accb107f1822e85912c7c58d5..6938a977130436534a5dcbd80383a29053c3b0c4 100755 (executable)
@@ -12,7 +12,9 @@ import itertools, collections
 import subprocess
 import shutil
 import logging
+
 SAMTOOLS="samtools"
+WORKDIR="pysam_test_work"
 
 def checkBinaryEqual( filename1, filename2 ):
     '''return true if the two files are binary equal.'''
@@ -65,56 +67,131 @@ class BinaryTest(unittest.TestCase):
     first_time = True
 
     # a list of commands to test
-    mCommands = \
-        { "faidx" : \
-        ( 
-            ("ex1.fa.fai", "faidx ex1.fa"), 
-            ("pysam_ex1.fa.fai", (pysam.faidx, "ex1.fa") ),
-            ),
-          "import" :
+    commands = \
+        { 
+          "view" :
               (
-                ("ex1.bam", "import ex1.fa.fai ex1.sam.gz ex1.bam" ),
-                ("pysam_ex1.bam", (pysam.samimport, "ex1.fa.fai ex1.sam.gz pysam_ex1.bam") ),
+                ("ex1.view", "view ex1.bam > ex1.view"),
+                ("pysam_ex1.view", (pysam.view, "ex1.bam" ) ),
+                ),
+          "view2" :
+              (
+                ("ex1.view", "view -bT ex1.fa -o ex1.view2 ex1.sam"),
+                # note that -o ex1.view2 throws exception.
+                ("pysam_ex1.view", (pysam.view, "-bT ex1.fa -oex1.view2 ex1.sam" ) ),
+                ),
+          "sort" :
+              (
+                ( "ex1.sort.bam", "sort ex1.bam ex1.sort" ),
+                ( "pysam_ex1.sort.bam", (pysam.sort, "ex1.bam pysam_ex1.sort" ) ),
+                ),
+          "mpileup" :
+              (
+                ("ex1.pileup", "mpileup ex1.bam > ex1.pileup" ),
+                ("pysam_ex1.mpileup", (pysam.mpileup, "ex1.bam" ) ),
+                ),
+          "depth" :
+              (
+                ("ex1.depth", "depth ex1.bam > ex1.depth" ),
+                ("pysam_ex1.depth", (pysam.depth, "ex1.bam" ) ),
+                ),
+          "faidx" : 
+              ( 
+                ("ex1.fa.fai", "faidx ex1.fa"), 
+                ("pysam_ex1.fa.fai", (pysam.faidx, "ex1.fa") ),
                 ),
           "index":
               (
                 ("ex1.bam.bai", "index ex1.bam" ),
                 ("pysam_ex1.bam.bai", (pysam.index, "pysam_ex1.bam" ) ),
                 ),
-          "pileup1" :
-          (
-                ("ex1.pileup", "pileup -cf ex1.fa ex1.bam > ex1.pileup" ),
-                ("pysam_ex1.pileup", (pysam.pileup, "-c -f ex1.fa ex1.bam" ) )
+          "idxstats" :
+              ( 
+                ("ex1.idxstats", "idxstats ex1.bam > ex1.idxstats" ),
+                ("pysam_ex1.idxstats", (pysam.idxstats, "pysam_ex1.bam" ) ),
                 ),
-          "pileup2" :
-          (
-                ("ex1.glf", "pileup -gf ex1.fa ex1.bam > ex1.glf" ),
-                ("pysam_ex1.glf", (pysam.pileup, "-g -f ex1.fa ex1.bam" ) )
+          "fixmate" :
+              (
+                ("ex1.fixmate", "fixmate ex1.bam ex1.fixmate" ),
+                ("pysam_ex1.fixmate", (pysam.fixmate, "pysam_ex1.bam pysam_ex1.fixmate") ),
                 ),
-          "glfview" :
-        (
-                ("ex1.glfview", "glfview ex1.glf > ex1.glfview"),
-                ("pysam_ex1.glfview", (pysam.glfview, "ex1.glf" ) ),
+          "flagstat" :
+              (
+                ("ex1.flagstat", "flagstat ex1.bam > ex1.flagstat" ),
+                ("pysam_ex1.flagstat", (pysam.flagstat, "pysam_ex1.bam") ),
                 ),
-          "view" :
-        (
-                ("ex1.view", "view ex1.bam > ex1.view"),
-                ("pysam_ex1.view", (pysam.view, "ex1.bam" ) ),
+          "calmd" :
+              (
+                ("ex1.calmd", "calmd ex1.bam ex1.fa > ex1.calmd" ),
+                ("pysam_ex1.calmd", (pysam.calmd, "pysam_ex1.bam ex1.fa") ),
                 ),
-          "view2" :
-        (
-                ("ex1.view", "view -bT ex1.fa -o ex1.view2 ex1.sam"),
-                # note that -o ex1.view2 throws exception.
-                ("pysam_ex1.view", (pysam.view, "-bT ex1.fa -oex1.view2 ex1.sam" ) ),
+          "merge" :
+              (
+                ("ex1.merge", "merge -f ex1.merge ex1.bam ex1.bam" ),
+                # -f option does not work - following command will cause the subsequent
+                # command to fail
+                ("pysam_ex1.merge", (pysam.merge, "pysam_ex1.merge pysam_ex1.bam pysam_ex1.bam") ),
+                ),
+          "rmdup" :
+              (
+                ("ex1.rmdup", "rmdup ex1.bam ex1.rmdup" ),
+                ("pysam_ex1.rmdup", (pysam.rmdup, "pysam_ex1.bam pysam_ex1.rmdup" )),
+                ),
+          "reheader" :
+              (
+                ( "ex1.reheader", "reheader ex1.bam ex1.bam > ex1.reheader"),
+                ( "pysam_ex1.reheader", (pysam.reheader, "ex1.bam ex1.bam" ) ),
+                ),
+          "cat":
+              (
+                ( "ex1.cat", "cat ex1.bam ex1.bam > ex1.cat"),
+                ( "pysam_ex1.cat", (pysam.cat, "ex1.bam ex1.bam" ) ),
+                ),
+          "targetcut":
+              (
+                ("ex1.targetcut", "targetcut ex1.bam > ex1.targetcut" ),
+                ("pysam_ex1.targetcut", (pysam.targetcut, "pysam_ex1.bam") ),
+                ),
+          "phase":
+              (
+                ("ex1.phase", "phase ex1.bam > ex1.phase" ),
+                ("pysam_ex1.phase", (pysam.phase, "pysam_ex1.bam") ),
+                ),
+          "import" :
+              (
+                ("ex1.bam", "import ex1.fa.fai ex1.sam.gz ex1.bam" ),
+                ("pysam_ex1.bam", (pysam.samimport, "ex1.fa.fai ex1.sam.gz pysam_ex1.bam") ),
+                ),
+          "bam2fq":
+              (
+                ("ex1.bam2fq", "bam2fq ex1.bam > ex1.bam2fq" ),
+                ("pysam_ex1.bam2fq", (pysam.bam2fq, "pysam_ex1.bam") ),
                 ),
         }
 
     # some tests depend on others. The order specifies in which order
     # the samtools commands are executed.
-    mOrder = ('faidx', 'import', 'index', 
-              'pileup1', 'pileup2', 
+    # The first three (faidx, import, index) need to be in that order, 
+    # the rest is arbitrary.
+    order = ('faidx', 'import', 'index', 
+              # 'pileup1', 'pileup2', deprecated
               # 'glfview', deprecated
-              'view', 'view2' )
+              'view', 'view2',
+              'sort',
+              'mpileup',
+              'depth',
+              'idxstats',
+              'fixmate',
+              'flagstat',
+              # 'calmd',
+              'merge',
+              'rmdup',
+              'reheader',
+              'cat',
+              'targetcut',
+              'phase',
+              'bam2fq',
+              )
 
     def setUp( self ):
         '''setup tests. 
@@ -124,25 +201,51 @@ class BinaryTest(unittest.TestCase):
         files.
         '''
         if BinaryTest.first_time:
-            # copy the source 
-            shutil.copy( "ex1.fa", "pysam_ex1.fa" )
 
-            for label in self.mOrder:
-                command = self.mCommands[label]
+            # remove previous files
+            if os.path.exists( WORKDIR ):
+                shutil.rmtree( WORKDIR )
+                
+            # copy the source files to WORKDIR
+            os.makedirs( WORKDIR )
+
+            shutil.copy( "ex1.fa", os.path.join( WORKDIR, "pysam_ex1.fa" ) )
+            shutil.copy( "ex1.fa", os.path.join( WORKDIR, "ex1.fa" ) )
+            shutil.copy( "ex1.sam.gz", os.path.join( WORKDIR, "ex1.sam.gz" ) )
+            shutil.copy( "ex1.sam", os.path.join( WORKDIR, "ex1.sam" ) )
+
+            # cd to workdir
+            savedir = os.getcwd()
+            os.chdir( WORKDIR )
+            
+            for label in self.order:
+                command = self.commands[label]
                 samtools_target, samtools_command = command[0]
-                pysam_target, pysam_command = command[1]
+                try:
+                    pysam_target, pysam_command = command[1]
+                except ValueError, msg:
+                    raise ValueError( "error while setting up %s=%s: %s" %\
+                                          (label, command, msg) )
                 runSamtools( " ".join( (SAMTOOLS, samtools_command )))
                 pysam_method, pysam_options = pysam_command
-                output = pysam_method( *pysam_options.split(" "), raw=True)
+                try:
+                    output = pysam_method( *pysam_options.split(" "), raw=True)
+                except pysam.SamtoolsError, msg:
+                    raise pysam.SamtoolsError( "error while executing %s: options=%s: msg=%s" %\
+                                                   (label, pysam_options, msg) )
                 if ">" in samtools_command:
                     outfile = open( pysam_target, "wb" )
                     for line in output: outfile.write( line )
                     outfile.close()
-
+                    
+            os.chdir( savedir )
             BinaryTest.first_time = False
 
+            
+
         samtools_version = getSamtoolsVersion()
 
+        
         def _r( s ):
             # patch - remove any of the alpha/beta suffixes, i.e., 0.1.12a -> 0.1.12
             if s.count('-') > 0: s = s[0:s.find('-')]
@@ -155,7 +258,9 @@ class BinaryTest(unittest.TestCase):
 
     def checkCommand( self, command ):
         if command:
-            samtools_target, pysam_target = self.mCommands[command][0][0], self.mCommands[command][1][0]
+            samtools_target, pysam_target = self.commands[command][0][0], self.commands[command][1][0]
+            samtools_target = os.path.join( WORKDIR, samtools_target )
+            pysam_target = os.path.join( WORKDIR, pysam_target )
             self.assertTrue( checkBinaryEqual( samtools_target, pysam_target ), 
                              "%s failed: files %s and %s are not the same" % (command, samtools_target, pysam_target) )
             
@@ -164,12 +269,51 @@ class BinaryTest(unittest.TestCase):
 
     def testIndex( self ):
         self.checkCommand( "index" )
+
+    def testSort( self ):
+        self.checkCommand( "sort" )
+
+    def testMpileup( self ):
+        self.checkCommand( "mpileup" )
+
+    def testDepth( self ):
+        self.checkCommand( "depth" )
+
+    def testIdxstats( self ):
+        self.checkCommand( "idxstats" )
+
+    def testFixmate( self ):
+        self.checkCommand( "fixmate" )
+
+    def testFlagstat( self ):
+        self.checkCommand( "flagstat" )
         
-    def testPileup1( self ):
-        self.checkCommand( "pileup1" )
+    def testMerge( self ):
+        self.checkCommand( "merge" )
+
+    def testRmdup( self ):
+        self.checkCommand( "rmdup" )
+
+    def testReheader( self ):
+        self.checkCommand( "reheader" )
+
+    def testCat( self ):
+        self.checkCommand( "cat" )
+
+    def testTargetcut( self ):
+        self.checkCommand( "targetcut" )
+
+    def testPhase( self ):
+        self.checkCommand( "phase" )
+
+    def testBam2fq( self ):
+        self.checkCommand( "bam2fq" )
+
+    # def testPileup1( self ):
+    #     self.checkCommand( "pileup1" )
     
-    def testPileup2( self ):
-        self.checkCommand( "pileup2" )
+    def testPileup2( self ):
+        self.checkCommand( "pileup2" )
 
     # deprecated
     # def testGLFView( self ):
@@ -182,27 +326,24 @@ class BinaryTest(unittest.TestCase):
         self.assertRaises( IOError, pysam.index, "exdoesntexist.bam" )
 
     def __del__(self):
-        return
-        for label, command in self.mCommands.iteritems():
-            samtools_target, samtools_command = command[0]
-            pysam_target, pysam_command = command[1]
-            if os.path.exists( samtools_target): os.remove( samtools_target )
-            if os.path.exists( pysam_target): os.remove( pysam_target )
-        if os.path.exists( "pysam_ex1.fa" ): os.remove( "pysam_ex1.fa" )
+        if os.path.exists( WORKDIR ):
+            shutil.rmtree( WORKDIR )
 
 class IOTest(unittest.TestCase):
     '''check if reading samfile and writing a samfile are consistent.'''
 
     def checkEcho( self, input_filename, reference_filename, 
                    output_filename, 
-                   input_mode, output_mode, use_template = True):
+                   input_mode, output_mode, use_template = True ):
         '''iterate through *input_filename* writing to *output_filename* and
         comparing the output to *reference_filename*. 
         
         The files are opened according to the *input_mode* and *output_mode*.
 
         If *use_template* is set, the header is copied from infile using the
-        template mechanism, otherwise target names and lengths are passed explicitely. 
+        template mechanism, otherwise target names and lengths are passed 
+        explicitely. 
+
         '''
 
         infile = pysam.Samfile( input_filename, input_mode )
@@ -211,7 +352,8 @@ class IOTest(unittest.TestCase):
         else:
             outfile = pysam.Samfile( output_filename, output_mode, 
                                      referencenames = infile.references,
-                                     referencelengths = infile.lengths )
+                                     referencelengths = infile.lengths,
+                                     add_sq_text = False )
 
         iter = infile.fetch()
         for x in iter: outfile.write( x )
@@ -257,6 +399,18 @@ class IOTest(unittest.TestCase):
         self.checkEcho( input_filename, reference_filename, output_filename,
                         "r", "w" )
 
+    def testReadSamWithoutHeaderWriteSamWithoutHeader( self ):
+        
+        input_filename = "ex1.sam"
+        output_filename = "pysam_ex1.sam"
+        reference_filename = "ex1.sam"
+
+        # disabled - reading from a samfile without header
+        # is not implemented.
+        
+        # self.checkEcho( input_filename, reference_filename, output_filename,
+        #                 "r", "w" )
+
     def testFetchFromClosedFile( self ):
 
         samfile = pysam.Samfile( "ex1.bam", "rb" )
@@ -283,14 +437,22 @@ class IOTest(unittest.TestCase):
         self.assertEqual( 0, samfile.write(None) )
 
     def testAutoDetection( self ):
-        samfile = pysam.Samfile( "ex3.bam" )
-        samfile.fetch()
+        '''test if autodetection works.'''
+
+        samfile = pysam.Samfile( "ex3.sam" )
+        self.assertRaises( ValueError, samfile.fetch, 'chr1' )
         samfile.close()
 
-        samfile = pysam.Samfile( "ex3.sam")
-        samfile.fetch()
+        samfile = pysam.Samfile( "ex3.bam" )
+        samfile.fetch('chr1')
         samfile.close()
 
+    def testReadingFromSamFileWithoutHeader( self ):
+        '''read from samfile without header.
+        '''
+        samfile = pysam.Samfile( "ex7.sam" )
+        self.assertRaises( NotImplementedError, samfile.__iter__ )
+
     def testReadingFromFileWithoutIndex( self ):
         '''read from bam file without index.'''
 
@@ -299,6 +461,67 @@ class IOTest(unittest.TestCase):
         self.assertRaises( ValueError, samfile.fetch )
         self.assertEqual( len(list( samfile.fetch(until_eof = True) )), 3270 )
 
+    def testReadingUniversalFileMode( self ):
+        '''read from samfile without header.
+        '''
+
+        input_filename = "ex2.sam"
+        output_filename = "pysam_ex2.sam"
+        reference_filename = "ex1.sam"
+
+        self.checkEcho( input_filename, reference_filename, output_filename,
+                        "rU", "w" )
+
+class TestFloatTagBug( unittest.TestCase ):
+    '''see issue 71'''
+
+    def testFloatTagBug( self ): 
+        '''a float tag before another exposed a parsing bug in bam_aux_get - expected to fail
+
+        This test is expected to fail until samtools is fixed.
+        '''
+        samfile = pysam.Samfile("tag_bug.bam")
+        read = samfile.fetch(until_eof=True).next()
+        self.assertTrue( ('XC',1) in read.tags )
+        self.assertEqual(read.opt('XC'), 1)
+
+class TestTagParsing( unittest.TestCase ):
+    '''tests checking the accuracy of tag setting and retrieval.'''
+
+    def makeRead( self ):
+        a = pysam.AlignedRead()
+        a.qname = "read_12345"
+        a.tid = 0
+        a.seq="ACGT" * 3
+        a.flag = 0
+        a.rname = 0
+        a.pos = 1
+        a.mapq = 20
+        a.cigar = ( (0,10), (2,1), (0,25) )
+        a.mrnm = 0
+        a.mpos=200
+        a.isize = 0
+       a.qual ="1234" * 3
+        # todo: create tags
+        return a
+
+    def testNegativeIntegers( self ):
+        x = -2
+        aligned_read = self.makeRead()
+        aligned_read.tags = [("XD", int(x) ) ]
+        print aligned_read.tags
+
+    def testNegativeIntegers2( self ):
+        x = -2
+        r = self.makeRead()
+        r.tags = [("XD", int(x) ) ]
+        outfile = pysam.Samfile( "test.bam",
+                                 "wb",
+                                 referencenames = ("chr1",),
+                                 referencelengths = (1000,) )
+        outfile.write (r )
+        outfile.close()
+
 class TestIteratorRow(unittest.TestCase):
 
     def setUp(self):
@@ -441,14 +664,20 @@ class TestAlignedReadFromBam(unittest.TestCase):
     def testARmrnm(self):
         self.assertEqual( self.reads[0].mrnm, 0, "mate reference sequence name mismatch in read 1: %s != %s" % (self.reads[0].mrnm, 0) )
         self.assertEqual( self.reads[1].mrnm, 1, "mate reference sequence name mismatch in read 2: %s != %s" % (self.reads[1].mrnm, 1) )
+        self.assertEqual( self.reads[0].rnext, 0, "mate reference sequence name mismatch in read 1: %s != %s" % (self.reads[0].rnext, 0) )
+        self.assertEqual( self.reads[1].rnext, 1, "mate reference sequence name mismatch in read 2: %s != %s" % (self.reads[1].rnext, 1) )
 
     def testARmpos(self):
         self.assertEqual( self.reads[0].mpos, 200-1, "mate mapping position mismatch in read 1: %s != %s" % (self.reads[0].mpos, 200-1) )
         self.assertEqual( self.reads[1].mpos, 500-1, "mate mapping position mismatch in read 2: %s != %s" % (self.reads[1].mpos, 500-1) )
+        self.assertEqual( self.reads[0].pnext, 200-1, "mate mapping position mismatch in read 1: %s != %s" % (self.reads[0].pnext, 200-1) )
+        self.assertEqual( self.reads[1].pnext, 500-1, "mate mapping position mismatch in read 2: %s != %s" % (self.reads[1].pnext, 500-1) )
 
     def testARisize(self):
         self.assertEqual( self.reads[0].isize, 167, "insert size mismatch in read 1: %s != %s" % (self.reads[0].isize, 167) )
         self.assertEqual( self.reads[1].isize, 412, "insert size mismatch in read 2: %s != %s" % (self.reads[1].isize, 412) )
+        self.assertEqual( self.reads[0].tlen, 167, "insert size mismatch in read 1: %s != %s" % (self.reads[0].tlen, 167) )
+        self.assertEqual( self.reads[1].tlen, 412, "insert size mismatch in read 2: %s != %s" % (self.reads[1].tlen, 412) )
 
     def testARseq(self):
         self.assertEqual( self.reads[0].seq, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG", "sequence mismatch in read 1: %s != %s" % (self.reads[0].seq, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG") )
@@ -671,10 +900,16 @@ class TestWrongFormat(unittest.TestCase):
         self.assertRaises( ValueError, pysam.Samfile, 'ex1.sam', 'rb' )
 
     def testOpenBamAsSam( self ):
-        self.assertRaises( ValueError, pysam.Samfile, 'ex1.bam', 'r' )
+        # test fails, needs to be implemented.
+        # sam.fetch() fails on reading, not on opening
+        # self.assertRaises( ValueError, pysam.Samfile, 'ex1.bam', 'r' )
+        pass
 
     def testOpenFastaAsSam( self ):
-        self.assertRaises( ValueError, pysam.Samfile, 'ex1.fa', 'r' )
+        # test fails, needs to be implemented.
+        # sam.fetch() fails on reading, not on opening
+        # self.assertRaises( ValueError, pysam.Samfile, 'ex1.fa', 'r' )
+        pass
 
     def testOpenFastaAsBam( self ):
         self.assertRaises( ValueError, pysam.Samfile, 'ex1.fa', 'rb' )
@@ -753,7 +988,7 @@ class TestAlignedRead(unittest.TestCase):
         self.assertEqual( a.rname, 0 )
         self.assertEqual( a.mapq, 0 )
         self.assertEqual( a.cigar, None )
-        self.assertEqual( a.tags, None )
+        self.assertEqual( a.tags, [] )
         self.assertEqual( a.mrnm, 0 )
         self.assertEqual( a.mpos, 0 )
         self.assertEqual( a.isize, 0 )
@@ -1088,107 +1323,107 @@ class TestLargeOptValues( unittest.TestCase ):
         samfile = pysam.Samfile("ex10.bam", "rb")
         self.check( samfile )
 
-class TestSNPCalls( unittest.TestCase ):
-    '''test pysam SNP calling ability.'''
-
-    def checkEqual( self, a, b ):
-        for x in ("reference_base", 
-                  "pos",
-                  "genotype",
-                  "consensus_quality",
-                  "snp_quality",
-                  "mapping_quality",
-                  "coverage" ):
-            self.assertEqual( getattr(a, x), getattr(b,x), "%s mismatch: %s != %s\n%s\n%s" % 
-                              (x, getattr(a, x), getattr(b,x), str(a), str(b)))
-
-    def testAllPositionsViaIterator( self ):
-        samfile = pysam.Samfile( "ex1.bam", "rb")  
-        fastafile = pysam.Fastafile( "ex1.fa" )
-        try: 
-            refs = [ x for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ) if x.reference_base != "*"]
-        except pysam.SamtoolsError:
-            pass
-
-        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
-        calls = list(pysam.IteratorSNPCalls(i))
-        for x,y in zip( refs, calls ):
-            self.checkEqual( x, y )
-
-    def testPerPositionViaIterator( self ):
-        # test pileup for each position. This is a slow operation
-        # so this test is disabled 
-        return
-        samfile = pysam.Samfile( "ex1.bam", "rb")  
-        fastafile = pysam.Fastafile( "ex1.fa" )
-        for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ):
-            if x.reference_base == "*": continue
-            i = samfile.pileup( x.chromosome, x.pos, x.pos+1,
-                                fastafile = fastafile,
-                                stepper = "samtools" )
-            z = [ zz for zz in pysam.IteratorSamtools(i) if zz.pos == x.pos ]
-            self.assertEqual( len(z), 1 )
-            self.checkEqual( x, z[0] )
-
-    def testPerPositionViaCaller( self ):
-        # test pileup for each position. This is a fast operation
-        samfile = pysam.Samfile( "ex1.bam", "rb")  
-        fastafile = pysam.Fastafile( "ex1.fa" )
-        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
-        caller = pysam.SNPCaller( i )
-
-        for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ):
-            if x.reference_base == "*": continue
-            call = caller.call( x.chromosome, x.pos )
-            self.checkEqual( x, call )
-
-class TestIndelCalls( unittest.TestCase ):
-    '''test pysam indel calling.'''
-
-    def checkEqual( self, a, b ):
-
-        for x in ("pos",
-                  "genotype",
-                  "consensus_quality",
-                  "snp_quality",
-                  "mapping_quality",
-                  "coverage",
-                  "first_allele",
-                  "second_allele",
-                  "reads_first",
-                  "reads_second",
-                  "reads_diff"):
-            if b.genotype == "*/*" and x == "second_allele":
-                # ignore test for second allele (positions chr2:439 and chr2:1512)
-                continue
-            self.assertEqual( getattr(a, x), getattr(b,x), "%s mismatch: %s != %s\n%s\n%s" % 
-                              (x, getattr(a, x), getattr(b,x), str(a), str(b)))
-
-    def testAllPositionsViaIterator( self ):
-
-        samfile = pysam.Samfile( "ex1.bam", "rb")  
-        fastafile = pysam.Fastafile( "ex1.fa" )
-        try: 
-            refs = [ x for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ) if x.reference_base == "*"]
-        except pysam.SamtoolsError:
-            pass
-
-        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
-        calls = [ x for x in list(pysam.IteratorIndelCalls(i)) if x != None ]
-        for x,y in zip( refs, calls ):
-            self.checkEqual( x, y )
-
-    def testPerPositionViaCaller( self ):
-        # test pileup for each position. This is a fast operation
-        samfile = pysam.Samfile( "ex1.bam", "rb")  
-        fastafile = pysam.Fastafile( "ex1.fa" )
-        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
-        caller = pysam.IndelCaller( i )
-
-        for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ):
-            if x.reference_base != "*": continue
-            call = caller.call( x.chromosome, x.pos )
-            self.checkEqual( x, call )
+class TestSNPCalls( unittest.TestCase ):
+    '''test pysam SNP calling ability.'''
+
+    def checkEqual( self, a, b ):
+        for x in ("reference_base", 
+                  "pos",
+                  "genotype",
+                  "consensus_quality",
+                  "snp_quality",
+                  "mapping_quality",
+                  "coverage" ):
+            self.assertEqual( getattr(a, x), getattr(b,x), "%s mismatch: %s != %s\n%s\n%s" % 
+                              (x, getattr(a, x), getattr(b,x), str(a), str(b)))
+
+    def testAllPositionsViaIterator( self ):
+        samfile = pysam.Samfile( "ex1.bam", "rb")  
+        fastafile = pysam.Fastafile( "ex1.fa" )
+        try: 
+            refs = [ x for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ) if x.reference_base != "*"]
+        except pysam.SamtoolsError:
+            pass
+
+        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
+        calls = list(pysam.IteratorSNPCalls(i))
+        for x,y in zip( refs, calls ):
+            self.checkEqual( x, y )
+
+    def testPerPositionViaIterator( self ):
+        # test pileup for each position. This is a slow operation
+        # so this test is disabled 
+        return
+        samfile = pysam.Samfile( "ex1.bam", "rb")  
+        fastafile = pysam.Fastafile( "ex1.fa" )
+        for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ):
+            if x.reference_base == "*": continue
+            i = samfile.pileup( x.chromosome, x.pos, x.pos+1,
+                                fastafile = fastafile,
+                                stepper = "samtools" )
+            z = [ zz for zz in pysam.IteratorSamtools(i) if zz.pos == x.pos ]
+            self.assertEqual( len(z), 1 )
+            self.checkEqual( x, z[0] )
+
+    def testPerPositionViaCaller( self ):
+        # test pileup for each position. This is a fast operation
+        samfile = pysam.Samfile( "ex1.bam", "rb")  
+        fastafile = pysam.Fastafile( "ex1.fa" )
+        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
+        caller = pysam.SNPCaller( i )
+
+        for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ):
+            if x.reference_base == "*": continue
+            call = caller.call( x.chromosome, x.pos )
+            self.checkEqual( x, call )
+
+class TestIndelCalls( unittest.TestCase ):
+    '''test pysam indel calling.'''
+
+    def checkEqual( self, a, b ):
+
+        for x in ("pos",
+                  "genotype",
+                  "consensus_quality",
+                  "snp_quality",
+                  "mapping_quality",
+                  "coverage",
+                  "first_allele",
+                  "second_allele",
+                  "reads_first",
+                  "reads_second",
+                  "reads_diff"):
+            if b.genotype == "*/*" and x == "second_allele":
+                # ignore test for second allele (positions chr2:439 and chr2:1512)
+                continue
+            self.assertEqual( getattr(a, x), getattr(b,x), "%s mismatch: %s != %s\n%s\n%s" % 
+                              (x, getattr(a, x), getattr(b,x), str(a), str(b)))
+
+    def testAllPositionsViaIterator( self ):
+
+        samfile = pysam.Samfile( "ex1.bam", "rb")  
+        fastafile = pysam.Fastafile( "ex1.fa" )
+        try: 
+            refs = [ x for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ) if x.reference_base == "*"]
+        except pysam.SamtoolsError:
+            pass
+
+        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
+        calls = [ x for x in list(pysam.IteratorIndelCalls(i)) if x != None ]
+        for x,y in zip( refs, calls ):
+            self.checkEqual( x, y )
+
+    def testPerPositionViaCaller( self ):
+        # test pileup for each position. This is a fast operation
+        samfile = pysam.Samfile( "ex1.bam", "rb")  
+        fastafile = pysam.Fastafile( "ex1.fa" )
+        i = samfile.pileup( stepper = "samtools", fastafile = fastafile )
+        caller = pysam.IndelCaller( i )
+
+        for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ):
+            if x.reference_base != "*": continue
+            call = caller.call( x.chromosome, x.pos )
+            self.checkEqual( x, call )
 
 class TestLogging( unittest.TestCase ):
     '''test around bug issue 42,
@@ -1271,6 +1506,13 @@ class TestSamfileUtilityFunctions( unittest.TestCase ):
                     self.assertEqual( read.pos, mate.mpos )
                     self.assertEqual( read.mpos, mate.pos )
 
+    def testIndexStats( self ):
+        '''test if total number of mapped/unmapped reads is correct.'''
+
+        samfile = pysam.Samfile( "ex1.bam", "rb" )
+        self.assertEqual( samfile.mapped, 3235 )
+        self.assertEqual( samfile.unmapped, 35 )
+
 class TestSamtoolsProxy( unittest.TestCase ):
     '''tests for sanity checking access to samtools functions.'''
 
index 207a59c6c125360655ac77192f43640903fc1c1d..2caa628660f74a4389a23bf8b09c8c9e55266dee 100644 (file)
@@ -127,7 +127,6 @@ class TestIteration( unittest.TestCase ):
                                  b.difference(a) ))
 
         for x, d in enumerate( zip( result, ref )):
-            
             self.assertEqual( d[0], d[1],
                               "unexpected results in pair %i: '%s', expected '%s'" % \
                                   (x, 
@@ -204,6 +203,17 @@ class TestIteration( unittest.TestCase ):
         header = list( self.tabix.header )
         self.assertEqual( ref, header )
 
+    def testReopening( self ):
+        '''test repeated opening of the same file.'''
+        def func1():
+            # opens any tabix file
+            inf = pysam.Tabixfile(self.filename)
+            return
+
+        for i in range(10000):
+            func1()
+
+
 class TestParser( unittest.TestCase ):
 
     filename = "example.gtf.gz" 
@@ -219,9 +229,16 @@ class TestParser( unittest.TestCase ):
             self.assertEqual( self.compare[x], list(r) )
             self.assertEqual( len(self.compare[x]), len(r) )
 
+            # test indexing
             for c in range(0,len(r)):
                 self.assertEqual( self.compare[x][c], r[c] )
 
+            # test slicing access
+            for c in range(0, len(r)-1):
+                for cc in range(c+1, len(r)):
+                    self.assertEqual( self.compare[x][c:cc],
+                                      r[c:cc] )
+
     def testWrite( self ):
         
         for x, r in enumerate(self.tabix.fetch( parser = pysam.asTuple() )):
@@ -250,10 +267,18 @@ class TestParser( unittest.TestCase ):
                 self.assertEqual( "\t".join(e), str(r) )
 
 class TestGTF( TestParser ):
+
     def testRead( self ):
 
         for x, r in enumerate(self.tabix.fetch( parser = pysam.asGTF() )):
-            self.assertEqual( "\t".join( self.compare[x]), str(r) )
+            c =  self.compare[x]
+            
+            self.assertEqual( len(c), len(r) )
+            self.assertEqual( "\t".join(c), str(r) )
+            self.assertTrue( r.gene_id.startswith("ENSG") )
+            if r.feature != "gene":
+                self.assertTrue( r.transcript_id.startswith("ENST") )
+            self.assertEqual( c[0], r.contig )
 
 class TestBed( unittest.TestCase ):
     filename = "example.bed.gz"
@@ -307,8 +332,8 @@ class TestVCF( TestParser ):
             c = self.compare[x]
             for y, field in enumerate( self.columns ):
                 if field == "pos":
-                    self.assertEqual( int(c[y])-1, getattr( r, field ) )
-                    self.assertEqual( int(c[y])-1, r.pos )
+                    self.assertEqual( int(c[y]) - 1, getattr( r, field ) )
+                    self.assertEqual( int(c[y]) - 1, r.pos )
                 else:
                     self.assertEqual( c[y], getattr( r, field ), 
                                       "mismatch in field %s: %s != %s" %\
@@ -323,12 +348,24 @@ class TestVCF( TestParser ):
         ncolumns = len(self.columns) 
 
         for x, r in enumerate(self.tabix.fetch( parser = pysam.asVCF() )):
+
             c = self.compare[x]
+
+            # check unmodified string
+            ref_string = "\t".join( c )
+            cmp_string = str(r)
+            self.assertEqual( ref_string, cmp_string )
+
+            # set fields and compare field-wise
             for y, field in enumerate( self.columns ):
                 if field == "pos":
-                    r.pos += 1
-                    self.assertEqual( int(c[y]), getattr( r, field ) )
-                    self.assertEqual( int(c[y]), r.pos )
+                    rpos = getattr( r, field )
+                    self.assertEqual( int(c[y]) - 1, rpos )
+                    self.assertEqual( int(c[y]) - 1, r.pos )
+                    # increment pos by 1
+                    setattr( r, field, rpos + 1 )
+                    self.assertEqual( getattr( r, field ), rpos + 1 )
+                    c[y] = str(int(c[y]) + 1 ) 
                 else:
                     setattr( r, field, "test_%i" % y)
                     c[y] = "test_%i" % y
@@ -342,7 +379,23 @@ class TestVCF( TestParser ):
                 c[ncolumns+y] = "test_%i" % y
                 r[y] = "test_%i" % y
                 self.assertEqual( c[ncolumns+y], r[y] )
+
+class TestVCF( TestParser ):
+
+    filename = "example.vcf40.gz"
+
+    def testOpening( self ):
+        while 1:
+            infile = pysam.Tabixfile( self.filename )
+            infile.close()
+
                 
+            # check strings
+            ref_string = "\t".join( c )
+            cmp_string = str(r)
+            
+            self.assertEqual( ref_string, cmp_string )
+
 if __name__ == "__main__":
 
     unittest.main()