[med-svn] [pysam] 05/13: Imported Upstream version 0.7.3

Charles Plessy plessy at alioth.debian.org
Fri Aug 9 09:47:29 UTC 2013


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch master
in repository pysam.

commit 14c14ac0fd1811c9ee22b51f501a5a66b279e509
Author: Charles Plessy <plessy at debian.org>
Date:   Fri Aug 9 18:34:33 2013 +0900

    Imported Upstream version 0.7.3
---
 MANIFEST.in                  |    5 +-
 PKG-INFO                     |    6 +-
 distribute_setup.py          |  107 +-
 pysam.egg-info/PKG-INFO      |    6 +-
 pysam.egg-info/SOURCES.txt   |    8 +
 pysam.egg-info/requires.txt  |    2 +-
 pysam.egg-info/top_level.txt |    4 -
 pysam/__init__.py            |    5 +-
 pysam/alternatives.py        |   82 +
 pysam/ctabix.c               | 3822 +++++++--------
 pysam/ctabix.pyx             |    2 +-
 pysam/cvcf.c                 |10447 +++++++++++++++++++++++-------------------
 pysam/cvcf.pyx               |    4 +-
 pysam/version.py             |    2 +-
 setup.py                     |   36 +-
 tabix/bedidx.c               |  156 +
 tabix/bgzf.c                 |  555 +++
 tabix/bgzip.c                |  206 +
 tabix/index.c                |  967 ++++
 tabix/knetfile.c             |  632 +++
 tabix/kstring.c              |  165 +
 tests/example_btag.bam       |  Bin 0 -> 771 bytes
 tests/pysam_test.py          |   10 +
 23 files changed, 10486 insertions(+), 6743 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index f613856..a0c9889 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -21,9 +21,12 @@ include pysam/TabProxies.pxd
 include pysam/cvcf.pyx
 include pysam/cvcf.pxd
 include pysam/cvcf.c
+include pysam/*.c
+include pysam/*.h
 include pysam/pysam_util.h
 include samtools/*.h
 include samtools/*/*.h
+include tabix/*.c
 include tabix/*.h
 
 # pysam tests
@@ -44,6 +47,7 @@ include tests/example.py
 include tests/pysam_test.py
 include tests/segfault_tests.py
 include tests/example_*.sam
+include tests/example_btag.bam
 include tests/tag_bug.bam
 include tests/example.vcf40
 include tests/example_empty_header.bam
@@ -56,4 +60,3 @@ include tests/example.gtf.gz.tbi
 include tests/example.bed.gz
 include tests/example.bed.gz.tbi
 include tests/vcf-examples/*.vcf
-
diff --git a/PKG-INFO b/PKG-INFO
index cc28edb..905bd25 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.7.2
+Version: 0.7.3
 Summary: pysam
 Home-page: http://code.google.com/p/pysam/
 Author: Andreas Heger
@@ -11,8 +11,6 @@ Description:
         pysam
         *****
         
-        For more information, see http://code.google.com/p/pysam.
-        
         
 Platform: ALL
-Requires: cython (>=0.16)
+Requires: cython (>=0.17)
diff --git a/distribute_setup.py b/distribute_setup.py
index b204902..a1cc2a1 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -14,11 +14,14 @@ the appropriate options to ``use_setuptools()``.
 This file can also be run as a script to install or upgrade setuptools.
 """
 import os
+import shutil
 import sys
 import time
 import fnmatch
 import tempfile
 import tarfile
+import optparse
+
 from distutils import log
 
 try:
@@ -46,7 +49,7 @@ except ImportError:
             args = [quote(arg) for arg in args]
         return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
 
-DEFAULT_VERSION = "0.6.24"
+DEFAULT_VERSION = "0.6.34"
 DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
 SETUPTOOLS_FAKED_VERSION = "0.6c11"
 
@@ -63,7 +66,7 @@ Description: xxx
 """ % SETUPTOOLS_FAKED_VERSION
 
 
-def _install(tarball):
+def _install(tarball, install_args=()):
     # extracting the tarball
     tmpdir = tempfile.mkdtemp()
     log.warn('Extracting in %s', tmpdir)
@@ -81,11 +84,14 @@ def _install(tarball):
 
         # installing
         log.warn('Installing Distribute')
-        if not _python_cmd('setup.py', 'install'):
+        if not _python_cmd('setup.py', 'install', *install_args):
             log.warn('Something went wrong during the installation.')
             log.warn('See the error message above.')
+            # exitcode will be 2
+            return 2
     finally:
         os.chdir(old_wd)
+        shutil.rmtree(tmpdir)
 
 
 def _build_egg(egg, tarball, to_dir):
@@ -110,6 +116,7 @@ def _build_egg(egg, tarball, to_dir):
 
     finally:
         os.chdir(old_wd)
+        shutil.rmtree(tmpdir)
     # returning the result
     log.warn(egg)
     if not os.path.exists(egg):
@@ -144,7 +151,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
         except ImportError:
             return _do_download(version, download_base, to_dir, download_delay)
         try:
-            pkg_resources.require("distribute>="+version)
+            pkg_resources.require("distribute>=" + version)
             return
         except pkg_resources.VersionConflict:
             e = sys.exc_info()[1]
@@ -167,6 +174,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
         if not no_fake:
             _create_fake_setuptools_pkg_info(to_dir)
 
+
 def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
                         to_dir=os.curdir, delay=15):
     """Download distribute from a specified location and return its filename
@@ -203,6 +211,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
                 dst.close()
     return os.path.realpath(saveto)
 
+
 def _no_sandbox(function):
     def __no_sandbox(*args, **kw):
         try:
@@ -227,9 +236,12 @@ def _no_sandbox(function):
 
     return __no_sandbox
 
+
 def _patch_file(path, content):
     """Will backup the file then patch it"""
-    existing_content = open(path).read()
+    f = open(path)
+    existing_content = f.read()
+    f.close()
     if existing_content == content:
         # already patched
         log.warn('Already patched.')
@@ -245,15 +257,21 @@ def _patch_file(path, content):
 
 _patch_file = _no_sandbox(_patch_file)
 
+
 def _same_content(path, content):
-    return open(path).read() == content
+    f = open(path)
+    existing_content = f.read()
+    f.close()
+    return existing_content == content
+
 
 def _rename_path(path):
     new_name = path + '.OLD.%s' % time.time()
-    log.warn('Renaming %s into %s', path, new_name)
+    log.warn('Renaming %s to %s', path, new_name)
     os.rename(path, new_name)
     return new_name
 
+
 def _remove_flat_installation(placeholder):
     if not os.path.isdir(placeholder):
         log.warn('Unkown installation at %s', placeholder)
@@ -267,7 +285,7 @@ def _remove_flat_installation(placeholder):
         log.warn('Could not locate setuptools*.egg-info')
         return
 
-    log.warn('Removing elements out of the way...')
+    log.warn('Moving elements out of the way...')
     pkg_info = os.path.join(placeholder, file)
     if os.path.isdir(pkg_info):
         patched = _patch_egg_dir(pkg_info)
@@ -289,11 +307,13 @@ def _remove_flat_installation(placeholder):
 
 _remove_flat_installation = _no_sandbox(_remove_flat_installation)
 
+
 def _after_install(dist):
     log.warn('After install bootstrap.')
     placeholder = dist.get_command_obj('install').install_purelib
     _create_fake_setuptools_pkg_info(placeholder)
 
+
 def _create_fake_setuptools_pkg_info(placeholder):
     if not placeholder or not os.path.exists(placeholder):
         log.warn('Could not find the install location')
@@ -307,7 +327,11 @@ def _create_fake_setuptools_pkg_info(placeholder):
         return
 
     log.warn('Creating %s', pkg_info)
-    f = open(pkg_info, 'w')
+    try:
+        f = open(pkg_info, 'w')
+    except EnvironmentError:
+        log.warn("Don't have permissions to write %s, skipping", pkg_info)
+        return
     try:
         f.write(SETUPTOOLS_PKG_INFO)
     finally:
@@ -321,7 +345,10 @@ def _create_fake_setuptools_pkg_info(placeholder):
     finally:
         f.close()
 
-_create_fake_setuptools_pkg_info = _no_sandbox(_create_fake_setuptools_pkg_info)
+_create_fake_setuptools_pkg_info = _no_sandbox(
+    _create_fake_setuptools_pkg_info
+)
+
 
 def _patch_egg_dir(path):
     # let's check if it's already patched
@@ -343,6 +370,7 @@ def _patch_egg_dir(path):
 
 _patch_egg_dir = _no_sandbox(_patch_egg_dir)
 
+
 def _before_install():
     log.warn('Before install bootstrap.')
     _fake_setuptools()
@@ -351,7 +379,7 @@ def _before_install():
 def _under_prefix(location):
     if 'install' not in sys.argv:
         return True
-    args = sys.argv[sys.argv.index('install')+1:]
+    args = sys.argv[sys.argv.index('install') + 1:]
     for index, arg in enumerate(args):
         for option in ('--root', '--prefix'):
             if arg.startswith('%s=' % option):
@@ -359,7 +387,7 @@ def _under_prefix(location):
                 return location.startswith(top_dir)
             elif arg == option:
                 if len(args) > index:
-                    top_dir = args[index+1]
+                    top_dir = args[index + 1]
                     return location.startswith(top_dir)
         if arg == '--user' and USER_SITE is not None:
             return location.startswith(USER_SITE)
@@ -376,11 +404,14 @@ def _fake_setuptools():
         return
     ws = pkg_resources.working_set
     try:
-        setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools',
-                                  replacement=False))
+        setuptools_dist = ws.find(
+            pkg_resources.Requirement.parse('setuptools', replacement=False)
+            )
     except TypeError:
         # old distribute API
-        setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools'))
+        setuptools_dist = ws.find(
+            pkg_resources.Requirement.parse('setuptools')
+        )
 
     if setuptools_dist is None:
         log.warn('No setuptools distribution found')
@@ -414,7 +445,7 @@ def _fake_setuptools():
         res = _patch_egg_dir(setuptools_location)
         if not res:
             return
-    log.warn('Patched done.')
+    log.warn('Patching complete.')
     _relaunch()
 
 
@@ -422,7 +453,9 @@ def _relaunch():
     log.warn('Relaunching...')
     # we have to relaunch the process
     # pip marker to avoid a relaunch bug
-    if sys.argv[:3] == ['-c', 'install', '--single-version-externally-managed']:
+    _cmd1 = ['-c', 'install', '--single-version-externally-managed']
+    _cmd2 = ['-c', 'install', '--record']
+    if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
         sys.argv[0] = 'setup.py'
     args = [sys.executable] + sys.argv
     sys.exit(subprocess.call(args))
@@ -448,7 +481,7 @@ def _extractall(self, path=".", members=None):
             # Extract directories with a safe mode.
             directories.append(tarinfo)
             tarinfo = copy.copy(tarinfo)
-            tarinfo.mode = 448 # decimal for oct 0700
+            tarinfo.mode = 448  # decimal for oct 0700
         self.extract(tarinfo, path)
 
     # Reverse sort directories.
@@ -475,11 +508,39 @@ def _extractall(self, path=".", members=None):
                 self._dbg(1, "tarfile: %s" % e)
 
 
-def main(argv, version=DEFAULT_VERSION):
+def _build_install_args(options):
+    """
+    Build the arguments to 'python setup.py install' on the distribute package
+    """
+    install_args = []
+    if options.user_install:
+        if sys.version_info < (2, 6):
+            log.warn("--user requires Python 2.6 or later")
+            raise SystemExit(1)
+        install_args.append('--user')
+    return install_args
+
+def _parse_args():
+    """
+    Parse the command line for options
+    """
+    parser = optparse.OptionParser()
+    parser.add_option(
+        '--user', dest='user_install', action='store_true', default=False,
+        help='install in user site package (requires Python 2.6 or later)')
+    parser.add_option(
+        '--download-base', dest='download_base', metavar="URL",
+        default=DEFAULT_URL,
+        help='alternative URL from where to download the distribute package')
+    options, args = parser.parse_args()
+    # positional arguments are ignored
+    return options
+
+def main(version=DEFAULT_VERSION):
     """Install or upgrade setuptools and EasyInstall"""
-    tarball = download_setuptools()
-    _install(tarball)
-
+    options = _parse_args()
+    tarball = download_setuptools(download_base=options.download_base)
+    return _install(tarball, _build_install_args(options))
 
 if __name__ == '__main__':
-    main(sys.argv[1:])
+    sys.exit(main())
diff --git a/pysam.egg-info/PKG-INFO b/pysam.egg-info/PKG-INFO
index cc28edb..905bd25 100644
--- a/pysam.egg-info/PKG-INFO
+++ b/pysam.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.7.2
+Version: 0.7.3
 Summary: pysam
 Home-page: http://code.google.com/p/pysam/
 Author: Andreas Heger
@@ -11,8 +11,6 @@ Description:
         pysam
         *****
         
-        For more information, see http://code.google.com/p/pysam.
-        
         
 Platform: ALL
-Requires: cython (>=0.16)
+Requires: cython (>=0.17)
diff --git a/pysam.egg-info/SOURCES.txt b/pysam.egg-info/SOURCES.txt
index b59e914..8a914d5 100644
--- a/pysam.egg-info/SOURCES.txt
+++ b/pysam.egg-info/SOURCES.txt
@@ -12,6 +12,7 @@ pysam/TabProxies.pxd
 pysam/TabProxies.pyx
 pysam/VCF.py
 pysam/__init__.py
+pysam/alternatives.py
 pysam/csamtools.c
 pysam/csamtools.pxd
 pysam/csamtools.pyx
@@ -108,16 +109,22 @@ samtools/win32/xcurses.h
 samtools/win32/zconf.h
 samtools/win32/zlib.h
 tabix/bam_endian.h
+tabix/bedidx.c
 tabix/bedidx.c.pysam.c
+tabix/bgzf.c
 tabix/bgzf.c.pysam.c
 tabix/bgzf.h
+tabix/bgzip.c
 tabix/bgzip.c.pysam.c
+tabix/index.c
 tabix/index.c.pysam.c
 tabix/khash.h
+tabix/knetfile.c
 tabix/knetfile.c.pysam.c
 tabix/knetfile.h
 tabix/kseq.h
 tabix/ksort.h
+tabix/kstring.c
 tabix/kstring.c.pysam.c
 tabix/kstring.h
 tabix/pysam.h
@@ -141,6 +148,7 @@ tests/example.gtf.gz
 tests/example.gtf.gz.tbi
 tests/example.py
 tests/example.vcf40
+tests/example_btag.bam
 tests/example_btag.sam
 tests/example_empty_header.bam
 tests/example_unmapped_reads_no_sq.sam
diff --git a/pysam.egg-info/requires.txt b/pysam.egg-info/requires.txt
index 3c6d9e8..9410b7b 100644
--- a/pysam.egg-info/requires.txt
+++ b/pysam.egg-info/requires.txt
@@ -1 +1 @@
-cython>=0.16
\ No newline at end of file
+cython>=0.17
\ No newline at end of file
diff --git a/pysam.egg-info/top_level.txt b/pysam.egg-info/top_level.txt
index b030ff1..23f03da 100644
--- a/pysam.egg-info/top_level.txt
+++ b/pysam.egg-info/top_level.txt
@@ -1,5 +1 @@
-pysam/Pileup
 pysam
-pysam/__init__
-pysam/version
-pysam/namedtuple
diff --git a/pysam/__init__.py b/pysam/__init__.py
index c3a1266..e1d87ee 100644
--- a/pysam/__init__.py
+++ b/pysam/__init__.py
@@ -125,11 +125,10 @@ __all__ = \
     [ "SamtoolsError", "SamtoolsDispatcher" ] + list(SAMTOOLS_DISPATCH) +\
     ["Pileup" ] 
 
-from version import __version__, __samtools_version__
+from pysam.version import __version__, __samtools_version__
 
 def get_include():
-    base = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'include'))
-    return [os.path.join(base, 'samtools'), os.path.join(base, 'pysam')]
+    return [os.path.abspath(os.path.join(os.path.dirname(__file__), 'include'))]
 
 def get_defines():
     return [('_FILE_OFFSET_BITS','64'), ('_USE_KNETFILE','')]
diff --git a/pysam/alternatives.py b/pysam/alternatives.py
new file mode 100644
index 0000000..fd76802
--- /dev/null
+++ b/pysam/alternatives.py
@@ -0,0 +1,82 @@
+# This file contains an alternative implementation
+# to call samtools functions. These are direct calls.
+# Plus: less overhead
+# Minus: more trouble in maintaining
+
+#in csamtools.pxd
+    # samtools toolkit functions
+    ctypedef int (*pysam_samtools_f)(int argc, char *argv[])
+
+    int bam_taf2baf(int argc, char *argv[])
+    int bam_pileup(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_rmdupse(int argc, char *argv[])
+    int bam_flagstat(int argc, char *argv[])
+    int bam_fillmd(int argc, char *argv[])
+    int main_samview(int argc, char *argv[])
+    int main_import(int argc, char *argv[])
+    int faidx_main(int argc, char *argv[])
+    int glf3_view_main(int argc, char *argv[])
+
+
+## Alternative code in csamtools.pyx
+cdef class SamtoolsWrapper:
+    '''generic wrapper around samtools functions'''
+    cdef pysam_samtools_f f 
+
+    def __init__(self): self.f = NULL
+
+    def call(self, *args ):
+
+        if self.f == NULL: raise NotImplementedError("invalid call to base class" )
+
+        cdef char ** cargs
+        cdef int i, n, retval
+        n = len(args)
+        # allocate one more for first (dummy) argument (contains command)
+        cargs = <char**>calloc( n+1, sizeof( char *) )
+        cargs[0] = "method"
+        for i from 0 <= i < n:
+            cargs[i+1] = args[i]
+        for i from 0 <= i < n+1:
+            print cargs[i]
+        retval = self.f(n+1, cargs)
+        free( cargs )
+        return retval
+
+cdef class SamtoolsWrapperImport( SamtoolsWrapper ):
+    def __init__(self): self.f = main_import
+cdef class SamtoolsWrapperPileup( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_pileup
+cdef class SamtoolsWrapperMerge( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_merge
+cdef class SamtoolsWrapperSort( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_sort
+cdef class SamtoolsWrapperIndex( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_index
+cdef class SamtoolsWrapperFaidx( SamtoolsWrapper ):
+    def __init__(self): self.f = faidx_main
+cdef class SamtoolsWrapperFixMate( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_mating
+cdef class SamtoolsWrapperRmDup( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_rmdup
+cdef class SamtoolsWrapperRmDupSe( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_rmdupse
+cdef class SamtoolsWrapperGlf3Viwen( SamtoolsWrapper ):
+    def __init__(self): self.f = glf3_view_main
+cdef class SamtoolsWrapperFlagStat( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_flagstat
+cdef class SamtoolsWrapperFillMd( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_fillmd
+cdef class SamtoolsWrapperCalMd( SamtoolsWrapper ):
+    def __init__(self): self.f = bam_fillmd
+
+automatic creation of these functions does not work 
+due to pyrex/cython
+
+def sort( *args, **kwargs ): return SamtoolsWrapperSort().call(*args, **kwargs)
diff --git a/pysam/ctabix.c b/pysam/ctabix.c
index 8ed84fc..2a1ce55 100644
--- a/pysam/ctabix.c
+++ b/pysam/ctabix.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Fri Nov 30 11:02:40 2012 */
+/* Generated by Cython 0.17.4 on Wed Jan 23 22:59:29 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -11,7 +11,6 @@
 #ifndef offsetof
 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
 #endif
-
 #if !defined(WIN32) && !defined(MS_WINDOWS)
   #ifndef __stdcall
     #define __stdcall
@@ -23,22 +22,18 @@
     #define __fastcall
   #endif
 #endif
-
 #ifndef DL_IMPORT
   #define DL_IMPORT(t) t
 #endif
 #ifndef DL_EXPORT
   #define DL_EXPORT(t) t
 #endif
-
 #ifndef PY_LONG_LONG
   #define PY_LONG_LONG LONG_LONG
 #endif
-
 #ifndef Py_HUGE_VAL
   #define Py_HUGE_VAL HUGE_VAL
 #endif
-
 #ifdef PYPY_VERSION
 #define CYTHON_COMPILING_IN_PYPY 1
 #define CYTHON_COMPILING_IN_CPYTHON 0
@@ -46,28 +41,28 @@
 #define CYTHON_COMPILING_IN_PYPY 0
 #define CYTHON_COMPILING_IN_CPYTHON 1
 #endif
-
-#if CYTHON_COMPILING_IN_PYPY
-  #define __Pyx_PyCFunction_Call PyObject_Call
-#else
-  #define __Pyx_PyCFunction_Call PyCFunction_Call
-#endif
-
 #if PY_VERSION_HEX < 0x02050000
   typedef int Py_ssize_t;
   #define PY_SSIZE_T_MAX INT_MAX
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
+  #define CYTHON_FORMAT_SSIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
-  #define PyNumber_Index(o)    PyNumber_Int(o)
-  #define PyIndex_Check(o)     PyNumber_Check(o)
+  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
+                                (PyErr_Format(PyExc_TypeError, \
+                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
+                                 (PyObject*)0))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
+  #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
-
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
@@ -75,7 +70,6 @@
   #define PyVarObject_HEAD_INIT(type, size) \
           PyObject_HEAD_INIT(type) size,
   #define PyType_Modified(t)
-
   typedef struct {
      void *buf;
      PyObject *obj;
@@ -89,7 +83,6 @@
      Py_ssize_t *suboffsets;
      void *internal;
   } Py_buffer;
-
   #define PyBUF_SIMPLE 0
   #define PyBUF_WRITABLE 0x0001
   #define PyBUF_FORMAT 0x0004
@@ -101,11 +94,9 @@
   #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
   #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
   #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
-
   typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
   typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
 #endif
-
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
@@ -115,31 +106,30 @@
   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #endif
-
 #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
   #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define Py_TPFLAGS_CHECKTYPES 0
   #define Py_TPFLAGS_HAVE_INDEX 0
 #endif
-
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-
-
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
+                                              0 : _PyUnicode_Ready((PyObject *)(op)))
+  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
 #else
   #define CYTHON_PEP393_ENABLED 0
-  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+  #define __Pyx_PyUnicode_READY(op)       (0)
+  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
@@ -147,7 +137,6 @@
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
 #endif
-
 #if PY_VERSION_HEX < 0x02060000
   #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
@@ -166,7 +155,6 @@
   #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)
@@ -174,9 +162,7 @@
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
-
 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
-
 #if PY_MAJOR_VERSION >= 3
   #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
@@ -193,11 +179,9 @@
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyBoolObject                 PyLongObject
 #endif
-
 #if PY_VERSION_HEX < 0x03020000
   typedef long Py_hash_t;
   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
@@ -206,7 +190,6 @@
   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #endif
-
 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
   #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
   #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
@@ -225,11 +208,9 @@
         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
-
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
@@ -239,7 +220,6 @@
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 #endif
-
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_NAMESTR(n) ((char *)(n))
   #define __Pyx_DOCSTR(n)  ((char *)(n))
@@ -248,6 +228,7 @@
   #define __Pyx_DOCSTR(n)  (n)
 #endif
 
+
 #if PY_MAJOR_VERSION >= 3
   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
@@ -268,8 +249,8 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
-#define __PYX_HAVE__ctabix
-#define __PYX_HAVE_API__ctabix
+#define __PYX_HAVE__pysam__ctabix
+#define __PYX_HAVE_API__pysam__ctabix
 #include "string.h"
 #include "stdlib.h"
 #include "stdio.h"
@@ -336,7 +317,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
+#if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
 
 #ifdef __GNUC__
@@ -366,51 +351,28 @@ static const char *__pyx_filename;
 static const char *__pyx_f[] = {
   "ctabix.pyx",
   "TabProxies.pxd",
+  "type.pxd",
   "bool.pxd",
   "complex.pxd",
 };
 
 /*--- Type declarations ---*/
-struct __pyx_obj_6ctabix_Parser;
-struct __pyx_obj_6ctabix_asVCF;
-struct __pyx_obj_10TabProxies_TupleProxy;
-struct __pyx_obj_10TabProxies_NamedTupleProxy;
-struct __pyx_obj_10TabProxies_BedProxy;
-struct __pyx_obj_6ctabix_tabix_copy_iterator;
-struct __pyx_obj_10TabProxies_VCFProxy;
-struct __pyx_obj_10TabProxies_GTFProxy;
-struct __pyx_obj_6ctabix_TabixIterator;
-struct __pyx_obj_6ctabix_TabixIteratorParsed;
-struct __pyx_obj_6ctabix_TabixHeaderIterator;
-struct __pyx_obj_6ctabix_Tabixfile;
-struct __pyx_obj_6ctabix_asGTF;
-struct __pyx_obj_6ctabix_asBed;
-struct __pyx_obj_6ctabix_tabix_inplace_iterator;
-struct __pyx_obj_6ctabix_asTuple;
-
-/* "ctabix.pxd":190
- *     cdef tabix_t * tabixfile
- * 
- * cdef class Parser:             # <<<<<<<<<<<<<<
- *      pass
- * 
- */
-struct __pyx_obj_6ctabix_Parser {
-  PyObject_HEAD
-};
-
-
-/* "ctabix.pxd":202
- *      pass
- * 
- * cdef class asVCF(Parser):             # <<<<<<<<<<<<<<
- *      pass
- * 
- */
-struct __pyx_obj_6ctabix_asVCF {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
-};
-
+struct __pyx_obj_5pysam_10TabProxies_TupleProxy;
+struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy;
+struct __pyx_obj_5pysam_10TabProxies_BedProxy;
+struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator;
+struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed;
+struct __pyx_obj_5pysam_6ctabix_TabixIterator;
+struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator;
+struct __pyx_obj_5pysam_6ctabix_Parser;
+struct __pyx_obj_5pysam_6ctabix_asTuple;
+struct __pyx_obj_5pysam_6ctabix_asVCF;
+struct __pyx_obj_5pysam_6ctabix_Tabixfile;
+struct __pyx_obj_5pysam_6ctabix_asBed;
+struct __pyx_obj_5pysam_6ctabix_asGTF;
+struct __pyx_obj_5pysam_10TabProxies_VCFProxy;
+struct __pyx_obj_5pysam_10TabProxies_GTFProxy;
+struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator;
 
 /* "TabProxies.pxd":41
  *   ctypedef int uint64_t
@@ -419,9 +381,9 @@ struct __pyx_obj_6ctabix_asVCF {
  * 
  *     cdef:
  */
-struct __pyx_obj_10TabProxies_TupleProxy {
+struct __pyx_obj_5pysam_10TabProxies_TupleProxy {
   PyObject_HEAD
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab;
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy *__pyx_vtab;
   char *data;
   char **fields;
   int nfields;
@@ -439,8 +401,8 @@ struct __pyx_obj_10TabProxies_TupleProxy {
  *     pass
  * 
  */
-struct __pyx_obj_10TabProxies_NamedTupleProxy {
-  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
+struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy {
+  struct __pyx_obj_5pysam_10TabProxies_TupleProxy __pyx_base;
 };
 
 
@@ -451,8 +413,8 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
  * 
  *     cdef:
  */
-struct __pyx_obj_10TabProxies_BedProxy {
-  struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_obj_5pysam_10TabProxies_BedProxy {
+  struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
   char *contig;
   uint32_t start;
   uint32_t end;
@@ -460,100 +422,110 @@ struct __pyx_obj_10TabProxies_BedProxy {
 };
 
 
-/* "ctabix.pxd":218
- *     cdef __cnext__(self)
+/* "pysam/ctabix.pxd":186
+ *     cdef tabix_t * tabixfile
  * 
- * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef Parser parser
+ * cdef class TabixHeaderIterator:             # <<<<<<<<<<<<<<
+ *     cdef ti_iter_t iterator
+ *     cdef tabix_t * tabixfile
  */
-struct __pyx_obj_6ctabix_tabix_copy_iterator {
+struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator {
   PyObject_HEAD
-  struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtab;
-  FILE *infile;
-  struct __pyx_obj_6ctabix_Parser *parser;
-};
-
-
-/* "TabProxies.pxd":83
- *     cdef update( self, char * buffer, size_t nbytes )
- * 
- * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
- * 
- *     cdef:
- */
-struct __pyx_obj_10TabProxies_VCFProxy {
-  struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
-  char *contig;
-  uint32_t pos;
+  ti_iter_t iterator;
+  tabix_t *tabixfile;
 };
 
 
-/* "TabProxies.pxd":60
- *     cdef update( self, char * buffer, size_t nbytes )
- * 
- * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
+/* "pysam/ctabix.pxd":205
+ *      pass
  * 
- *     cdef:
+ * cdef class TabixIteratorParsed:             # <<<<<<<<<<<<<<
+ *     cdef ti_iter_t iterator
+ *     cdef tabix_t * tabixfile
  */
-struct __pyx_obj_10TabProxies_GTFProxy {
-  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
-  char *_attributes;
-  int hasOwnAttributes;
+struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed {
+  PyObject_HEAD
+  ti_iter_t iterator;
+  tabix_t *tabixfile;
+  struct __pyx_obj_5pysam_6ctabix_Parser *parser;
 };
 
 
-/* "ctabix.pxd":182
+/* "pysam/ctabix.pxd":182
  *     cdef char * _filename
  * 
  * cdef class TabixIterator:             # <<<<<<<<<<<<<<
  *     cdef ti_iter_t iterator
  *     cdef tabix_t * tabixfile
  */
-struct __pyx_obj_6ctabix_TabixIterator {
+struct __pyx_obj_5pysam_6ctabix_TabixIterator {
   PyObject_HEAD
   ti_iter_t iterator;
   tabix_t *tabixfile;
 };
 
 
-/* "ctabix.pxd":205
- *      pass
+/* "pysam/ctabix.pxd":210
+ *     cdef Parser parser
  * 
- * cdef class TabixIteratorParsed:             # <<<<<<<<<<<<<<
- *     cdef ti_iter_t iterator
- *     cdef tabix_t * tabixfile
+ * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef char * buffer
  */
-struct __pyx_obj_6ctabix_TabixIteratorParsed {
+struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator {
   PyObject_HEAD
-  ti_iter_t iterator;
-  tabix_t *tabixfile;
-  struct __pyx_obj_6ctabix_Parser *parser;
+  struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator *__pyx_vtab;
+  FILE *infile;
+  char *buffer;
+  size_t size;
+  struct __pyx_obj_5pysam_6ctabix_Parser *parser;
 };
 
 
-/* "ctabix.pxd":186
+/* "pysam/ctabix.pxd":190
  *     cdef tabix_t * tabixfile
  * 
- * cdef class TabixHeaderIterator:             # <<<<<<<<<<<<<<
- *     cdef ti_iter_t iterator
- *     cdef tabix_t * tabixfile
+ * cdef class Parser:             # <<<<<<<<<<<<<<
+ *      pass
+ * 
  */
-struct __pyx_obj_6ctabix_TabixHeaderIterator {
+struct __pyx_obj_5pysam_6ctabix_Parser {
   PyObject_HEAD
-  ti_iter_t iterator;
-  tabix_t *tabixfile;
 };
 
 
-/* "ctabix.pxd":172
+/* "pysam/ctabix.pxd":193
+ *      pass
+ * 
+ * cdef class asTuple(Parser):             # <<<<<<<<<<<<<<
+ *      pass
+ * 
+ */
+struct __pyx_obj_5pysam_6ctabix_asTuple {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
+};
+
+
+/* "pysam/ctabix.pxd":202
+ *      pass
+ * 
+ * cdef class asVCF(Parser):             # <<<<<<<<<<<<<<
+ *      pass
+ * 
+ */
+struct __pyx_obj_5pysam_6ctabix_asVCF {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
+};
+
+
+/* "pysam/ctabix.pxd":172
  *   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
  * 
  * cdef class Tabixfile:             # <<<<<<<<<<<<<<
  * 
  *     # pointer to tabixfile
  */
-struct __pyx_obj_6ctabix_Tabixfile {
+struct __pyx_obj_5pysam_6ctabix_Tabixfile {
   PyObject_HEAD
   tabix_t *tabixfile;
   int isremote;
@@ -561,72 +533,72 @@ struct __pyx_obj_6ctabix_Tabixfile {
 };
 
 
-/* "ctabix.pxd":196
+/* "pysam/ctabix.pxd":199
  *      pass
  * 
- * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
+ * cdef class asBed(Parser):             # <<<<<<<<<<<<<<
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asGTF {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_6ctabix_asBed {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
 };
 
 
-/* "ctabix.pxd":199
+/* "pysam/ctabix.pxd":196
  *      pass
  * 
- * cdef class asBed(Parser):             # <<<<<<<<<<<<<<
+ * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asBed {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_6ctabix_asGTF {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
 };
 
 
-/* "ctabix.pxd":210
- *     cdef Parser parser
+/* "TabProxies.pxd":83
+ *     cdef update( self, char * buffer, size_t nbytes )
  * 
- * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef char * buffer
+ * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * 
+ *     cdef:
  */
-struct __pyx_obj_6ctabix_tabix_inplace_iterator {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtab;
-  FILE *infile;
-  char *buffer;
-  size_t size;
-  struct __pyx_obj_6ctabix_Parser *parser;
+struct __pyx_obj_5pysam_10TabProxies_VCFProxy {
+  struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
+  char *contig;
+  uint32_t pos;
 };
 
 
-/* "ctabix.pxd":193
- *      pass
+/* "TabProxies.pxd":60
+ *     cdef update( self, char * buffer, size_t nbytes )
  * 
- * cdef class asTuple(Parser):             # <<<<<<<<<<<<<<
- *      pass
+ * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
  * 
+ *     cdef:
  */
-struct __pyx_obj_6ctabix_asTuple {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_10TabProxies_GTFProxy {
+  struct __pyx_obj_5pysam_10TabProxies_TupleProxy __pyx_base;
+  char *_attributes;
+  int hasOwnAttributes;
 };
 
 
-
-/* "ctabix.pyx":771
- *         return self.__cnext__()
+/* "pysam/ctabix.pxd":218
+ *     cdef __cnext__(self)
  * 
  * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
- *     '''iterate over ``infile``.
- * 
+ *     cdef FILE * infile
+ *     cdef Parser parser
  */
-
-struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator {
-  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_copy_iterator *);
+struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator *__pyx_vtab;
+  FILE *infile;
+  struct __pyx_obj_5pysam_6ctabix_Parser *parser;
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabix_tabix_copy_iterator;
+
 
 
 /* "TabProxies.pxd":41
@@ -637,14 +609,14 @@ static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabi
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_TupleProxy {
-  int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t);
-  PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
-  PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
-  PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
-  PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
+struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy {
+  int (*getMaxFields)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, size_t);
+  PyObject *(*take)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
+  PyObject *(*present)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
+  PyObject *(*copy)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
+  PyObject *(*update)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
 };
-static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy *__pyx_vtabptr_5pysam_10TabProxies_TupleProxy;
 
 
 /* "TabProxies.pxd":69
@@ -655,10 +627,10 @@ static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxi
  * 
  */
 
-struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy *__pyx_vtabptr_5pysam_10TabProxies_NamedTupleProxy;
 
 
 /* "TabProxies.pxd":83
@@ -669,10 +641,24 @@ static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10Tab
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_VCFProxy {
-  struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy *__pyx_vtabptr_5pysam_10TabProxies_VCFProxy;
+
+
+/* "pysam/ctabix.pyx":709
+ * ## Iterators for parsing through unindexed files.
+ * #########################################################
+ * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
+ *     '''iterate over ``infile``.
+ * 
+ */
+
+struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator {
+  PyObject *(*__pyx___cnext__)(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *);
+};
+static struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator;
 
 
 /* "TabProxies.pxd":60
@@ -683,39 +669,39 @@ static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_GTFProxy {
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
-  char *(*getAttributes)(struct __pyx_obj_10TabProxies_GTFProxy *);
+struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy __pyx_base;
+  char *(*getAttributes)(struct __pyx_obj_5pysam_10TabProxies_GTFProxy *);
 };
-static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy *__pyx_vtabptr_5pysam_10TabProxies_GTFProxy;
 
 
-/* "TabProxies.pxd":72
- *     pass
+/* "pysam/ctabix.pyx":771
+ *         return self.__cnext__()
  * 
- * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
+ *     '''iterate over ``infile``.
  * 
- *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_BedProxy {
-  struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator {
+  PyObject *(*__pyx___cnext__)(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *);
 };
-static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
+static struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator *__pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator;
 
 
-/* "ctabix.pyx":709
- * ## Iterators for parsing through unindexed files.
- * #########################################################
- * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
- *     '''iterate over ``infile``.
+/* "TabProxies.pxd":72
+ *     pass
+ * 
+ * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
  * 
+ *     cdef:
  */
 
-struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator {
-  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *);
+struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ctabix_tabix_inplace_iterator;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy *__pyx_vtabptr_5pysam_10TabProxies_BedProxy;
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
@@ -772,6 +758,11 @@ static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ct
 
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+         const char* encoding, const char* errors,
+         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
+
 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*/
 
@@ -799,42 +790,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
                                                     __Pyx_GetItemInt_List_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-    if (likely(o != Py_None)) {
-        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, i);
-            Py_INCREF(r);
-            return r;
-        }
-        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-            Py_INCREF(r);
-            return r;
-        }
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
 }
 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-    if (likely(o != Py_None)) {
-        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, i);
-            Py_INCREF(r);
-            return r;
-        }
-        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-            Py_INCREF(r);
-            return r;
-        }
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
 }
 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
     if (PyList_CheckExact(o)) {
         Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
         if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
@@ -850,34 +846,39 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
             Py_INCREF(r);
             return r;
         }
-    }
-    else if (likely(i >= 0)) {
+    } else {  /* inlined PySequence_GetItem() */
         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
         if (likely(m && m->sq_item)) {
+            if (unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (unlikely(l < 0)) return NULL;
+                i += l;
+            }
             return m->sq_item(o, i);
         }
     }
+#else
+    if (PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
 
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
-static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
-
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
-    if (unlikely(d == Py_None)) {
-        __Pyx_RaiseNoneIndexingError();
-        return NULL;
-    }
     value = PyDict_GetItemWithError(d, key);
     if (unlikely(!value)) {
         if (!PyErr_Occurred())
@@ -945,16 +946,6 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                             PyObject *tuple);
 static int __Pyx_CyFunction_init(void);
 
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
-
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
-
-#if PY_MAJOR_VERSION >= 3
-#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
-#else
-#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
-#endif
-
 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
 
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
@@ -1001,10 +992,10 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 #endif
 #endif
 
-static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/
-
 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/
+
 static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
 
 typedef struct {
@@ -1027,12 +1018,14 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 
-/* Module declarations from 'TabProxies' */
-static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0;
+/* Module declarations from 'pysam' */
+
+/* Module declarations from 'pysam.TabProxies' */
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_TupleProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_GTFProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_NamedTupleProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_BedProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_VCFProxy = 0;
 
 /* Module declarations from 'cpython.version' */
 
@@ -1058,7 +1051,10 @@ static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0;
 
 /* Module declarations from 'cpython.iterator' */
 
+/* Module declarations from '__builtin__' */
+
 /* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
 
 /* Module declarations from 'cpython.number' */
 
@@ -1112,26 +1108,26 @@ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
 
 /* Module declarations from 'cpython' */
 
-/* Module declarations from 'ctabix' */
-static PyTypeObject *__pyx_ptype_6ctabix_Tabixfile = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_TabixIterator = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_TabixHeaderIterator = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_Parser = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asTuple = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asGTF = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asBed = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asVCF = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_TabixIteratorParsed = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_tabix_inplace_iterator = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_tabix_copy_iterator = 0;
-static PyObject *__pyx_v_6ctabix__FILENAME_ENCODING = 0;
-static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *); /*proto*/
-static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *); /*proto*/
-static PyObject *__pyx_f_6ctabix__charptr_to_str(char *); /*proto*/
-#define __Pyx_MODULE_NAME "ctabix"
-int __pyx_module_is_main_ctabix = 0;
-
-/* Implementation of 'ctabix' */
+/* Module declarations from 'pysam.ctabix' */
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_Tabixfile = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_TabixIterator = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_TabixHeaderIterator = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_Parser = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asTuple = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asGTF = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asBed = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asVCF = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_TabixIteratorParsed = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_tabix_inplace_iterator = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_tabix_copy_iterator = 0;
+static PyObject *__pyx_v_5pysam_6ctabix__FILENAME_ENCODING = 0;
+static PyObject *__pyx_f_5pysam_6ctabix__my_encodeFilename(PyObject *); /*proto*/
+static PyObject *__pyx_f_5pysam_6ctabix__force_bytes(PyObject *); /*proto*/
+static PyObject *__pyx_f_5pysam_6ctabix__charptr_to_str(char *); /*proto*/
+#define __Pyx_MODULE_NAME "pysam.ctabix"
+int __pyx_module_is_main_pysam__ctabix = 0;
+
+/* Implementation of 'pysam.ctabix' */
 static PyObject *__pyx_builtin_TypeError;
 static PyObject *__pyx_builtin_NotImplementedError;
 static PyObject *__pyx_builtin_IOError;
@@ -1141,46 +1137,46 @@ static PyObject *__pyx_builtin_OSError;
 static PyObject *__pyx_builtin_ord;
 static PyObject *__pyx_builtin_KeyError;
 static PyObject *__pyx_builtin_MemoryError;
-static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_parser); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
-static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
-static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end); /* proto */
-static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self); /* proto */
-static void __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self); /* proto */
-static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile); /* proto */
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
-static void __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asTuple *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
-static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asGTF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
-static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asBed *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
-static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asVCF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
-static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser); /* proto */
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
-static void __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_in, PyObject *__pyx_v_filename_out, PyObject *__pyx_v_force); /* proto */
-static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_force, PyObject *__pyx_v_seq_col, PyObject *__pyx_v_start_col, PyObject *__pyx_v_end_col, PyObject *__pyx_v_preset, PyObject *__pyx_v_meta_char, PyObject *__pyx_v_zerobased); /* proto */
-static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self, PyObject *__pyx_v_infile, int __pyx_v_buffer_size); /* proto */
-static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
-static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
-static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self, PyObject *__pyx_v_infile, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser); /* proto */
-static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser); /* proto */
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser); /* proto */
+static int __pyx_pf_5pysam_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_parser); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_10close(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self); /* proto */
+static void __pyx_pf_5pysam_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self); /* proto */
+static int __pyx_pf_5pysam_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self, struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self); /* proto */
+static void __pyx_pf_5pysam_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self); /* proto */
+static int __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self, struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
+static void __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asTuple *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asGTF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asBed *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asVCF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
+static int __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self, struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
+static void __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_in, PyObject *__pyx_v_filename_out, PyObject *__pyx_v_force); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_force, PyObject *__pyx_v_seq_col, PyObject *__pyx_v_start_col, PyObject *__pyx_v_end_col, PyObject *__pyx_v_preset, PyObject *__pyx_v_meta_char, PyObject *__pyx_v_zerobased); /* proto */
+static int __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self, PyObject *__pyx_v_infile, int __pyx_v_buffer_size); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
+static void __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
+static int __pyx_pf_5pysam_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self, PyObject *__pyx_v_infile, struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser); /* proto */
 static char __pyx_k_1[] = "Argument must be string or unicode.";
 static char __pyx_k_3[] = "Argument must be string, bytes or unicode.";
 static char __pyx_k_5[] = "invalid file opening mode `%s`";
@@ -1218,8 +1214,9 @@ static char __pyx_k_60[] = "the file header.\n          \n        .. note::\n
 static char __pyx_k_61[] = "chromosome names";
 static char __pyx_k_62[] = "getfilesystemencoding";
 static char __pyx_k_65[] = "/ifs/devel/pysam/pysam/ctabix.pyx";
-static char __pyx_k_76[] = "iterate over ``infile``.\n    \n    Permits the use of file-like objects for example from the gzip module.\n    ";
-static char __pyx_k_79[] = "tabix_inplace_iterator";
+static char __pyx_k_66[] = "pysam.ctabix";
+static char __pyx_k_77[] = "iterate over ``infile``.\n    \n    Permits the use of file-like objects for example from the gzip module.\n    ";
+static char __pyx_k_80[] = "tabix_inplace_iterator";
 static char __pyx_k__b[] = "b";
 static char __pyx_k__c[] = "c";
 static char __pyx_k__r[] = "r";
@@ -1259,7 +1256,6 @@ static char __pyx_k__types[] = "types";
 static char __pyx_k__Parser[] = "Parser";
 static char __pyx_k__buffer[] = "buffer";
 static char __pyx_k__closed[] = "closed";
-static char __pyx_k__ctabix[] = "ctabix";
 static char __pyx_k__ctypes[] = "ctypes";
 static char __pyx_k__decode[] = "decode";
 static char __pyx_k__encode[] = "encode";
@@ -1350,9 +1346,10 @@ static PyObject *__pyx_n_s_58;
 static PyObject *__pyx_kp_s_6;
 static PyObject *__pyx_n_s_62;
 static PyObject *__pyx_kp_s_65;
+static PyObject *__pyx_n_s_66;
 static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_kp_s_76;
-static PyObject *__pyx_n_s_79;
+static PyObject *__pyx_kp_s_77;
+static PyObject *__pyx_n_s_80;
 static PyObject *__pyx_kp_s_9;
 static PyObject *__pyx_n_s__IOError;
 static PyObject *__pyx_n_s__KeyError;
@@ -1391,7 +1388,6 @@ static PyObject *__pyx_n_s__closed;
 static PyObject *__pyx_n_s__conf;
 static PyObject *__pyx_n_s__conf_data;
 static PyObject *__pyx_n_s__cpy;
-static PyObject *__pyx_n_s__ctabix;
 static PyObject *__pyx_n_s__ctypes;
 static PyObject *__pyx_n_s__decode;
 static PyObject *__pyx_n_s__encode;
@@ -1491,21 +1487,21 @@ static PyObject *__pyx_k_tuple_55;
 static PyObject *__pyx_k_tuple_56;
 static PyObject *__pyx_k_tuple_57;
 static PyObject *__pyx_k_tuple_63;
-static PyObject *__pyx_k_tuple_66;
-static PyObject *__pyx_k_tuple_68;
-static PyObject *__pyx_k_tuple_70;
-static PyObject *__pyx_k_tuple_72;
-static PyObject *__pyx_k_tuple_74;
-static PyObject *__pyx_k_tuple_77;
+static PyObject *__pyx_k_tuple_67;
+static PyObject *__pyx_k_tuple_69;
+static PyObject *__pyx_k_tuple_71;
+static PyObject *__pyx_k_tuple_73;
+static PyObject *__pyx_k_tuple_75;
+static PyObject *__pyx_k_tuple_78;
 static PyObject *__pyx_k_codeobj_64;
-static PyObject *__pyx_k_codeobj_67;
-static PyObject *__pyx_k_codeobj_69;
-static PyObject *__pyx_k_codeobj_71;
-static PyObject *__pyx_k_codeobj_73;
-static PyObject *__pyx_k_codeobj_75;
-static PyObject *__pyx_k_codeobj_78;
-
-/* "ctabix.pyx":19
+static PyObject *__pyx_k_codeobj_68;
+static PyObject *__pyx_k_codeobj_70;
+static PyObject *__pyx_k_codeobj_72;
+static PyObject *__pyx_k_codeobj_74;
+static PyObject *__pyx_k_codeobj_76;
+static PyObject *__pyx_k_codeobj_79;
+
+/* "pysam/ctabix.pyx":19
  * from cpython.version cimport PY_MAJOR_VERSION
  * 
  * cdef from_string_and_size(char* s, size_t length):             # <<<<<<<<<<<<<<
@@ -1513,7 +1509,7 @@ static PyObject *__pyx_k_codeobj_78;
  *         return s[:length]
  */
 
-static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __pyx_v_length) {
+static PyObject *__pyx_f_5pysam_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __pyx_v_length) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -1523,7 +1519,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("from_string_and_size", 0);
 
-  /* "ctabix.pyx":20
+  /* "pysam/ctabix.pyx":20
  * 
  * cdef from_string_and_size(char* s, size_t length):
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -1533,7 +1529,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":21
+    /* "pysam/ctabix.pyx":21
  * cdef from_string_and_size(char* s, size_t length):
  *     if PY_MAJOR_VERSION < 3:
  *         return s[:length]             # <<<<<<<<<<<<<<
@@ -1541,7 +1537,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
  *         return s[:length].decode("ascii")
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromStringAndSize(((const char*)__pyx_v_s) + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -1550,7 +1546,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
   }
   /*else*/ {
 
-    /* "ctabix.pyx":23
+    /* "pysam/ctabix.pyx":23
  *         return s[:length]
  *     else:
  *         return s[:length].decode("ascii")             # <<<<<<<<<<<<<<
@@ -1558,7 +1554,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
  * # filename encoding (copied from lxml.etree.pyx)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, __pyx_v_length, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_length, NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -1570,7 +1566,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -1578,7 +1574,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
   return __pyx_r;
 }
 
-/* "ctabix.pyx":36
+/* "pysam/ctabix.pyx":36
  * #_C_FILENAME_ENCODING = <char*>_FILENAME_ENCODING
  * 
  * cdef bytes _my_encodeFilename(object filename):             # <<<<<<<<<<<<<<
@@ -1586,7 +1582,7 @@ static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __
  *     """
  */
 
-static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename) {
+static PyObject *__pyx_f_5pysam_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -1598,7 +1594,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_my_encodeFilename", 0);
 
-  /* "ctabix.pyx":39
+  /* "pysam/ctabix.pyx":39
  *     u"""Make sure a filename is 8-bit encoded (or None).
  *     """
  *     if filename is None:             # <<<<<<<<<<<<<<
@@ -1608,7 +1604,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   __pyx_t_1 = (__pyx_v_filename == Py_None);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":40
+    /* "pysam/ctabix.pyx":40
  *     """
  *     if filename is None:
  *         return None             # <<<<<<<<<<<<<<
@@ -1622,7 +1618,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
     goto __pyx_L3;
   }
 
-  /* "ctabix.pyx":41
+  /* "pysam/ctabix.pyx":41
  *     if filename is None:
  *         return None
  *     elif PyBytes_Check(filename):             # <<<<<<<<<<<<<<
@@ -1632,7 +1628,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   __pyx_t_1 = PyBytes_Check(__pyx_v_filename);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":42
+    /* "pysam/ctabix.pyx":42
  *         return None
  *     elif PyBytes_Check(filename):
  *         return filename             # <<<<<<<<<<<<<<
@@ -1647,7 +1643,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
     goto __pyx_L3;
   }
 
-  /* "ctabix.pyx":43
+  /* "pysam/ctabix.pyx":43
  *     elif PyBytes_Check(filename):
  *         return filename
  *     elif PyUnicode_Check(filename):             # <<<<<<<<<<<<<<
@@ -1657,7 +1653,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   __pyx_t_1 = PyUnicode_Check(__pyx_v_filename);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":44
+    /* "pysam/ctabix.pyx":44
  *         return filename
  *     elif PyUnicode_Check(filename):
  *         return filename.encode(_FILENAME_ENCODING)             # <<<<<<<<<<<<<<
@@ -1669,9 +1665,9 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
-    __Pyx_GIVEREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
+    __Pyx_INCREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
+    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
+    __Pyx_GIVEREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
     __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -1684,7 +1680,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   }
   /*else*/ {
 
-    /* "ctabix.pyx":46
+    /* "pysam/ctabix.pyx":46
  *         return filename.encode(_FILENAME_ENCODING)
  *     else:
  *         raise TypeError, u"Argument must be string or unicode."             # <<<<<<<<<<<<<<
@@ -1702,7 +1698,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("ctabix._my_encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix._my_encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -1710,7 +1706,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
   return __pyx_r;
 }
 
-/* "ctabix.pyx":48
+/* "pysam/ctabix.pyx":48
  *         raise TypeError, u"Argument must be string or unicode."
  * 
  * cdef bytes _force_bytes(object s):             # <<<<<<<<<<<<<<
@@ -1718,7 +1714,7 @@ static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename)
  *     """
  */
 
-static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
+static PyObject *__pyx_f_5pysam_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -1729,7 +1725,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_force_bytes", 0);
 
-  /* "ctabix.pyx":51
+  /* "pysam/ctabix.pyx":51
  *     u"""convert string or unicode object to bytes, assuming ascii encoding.
  *     """
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -1739,7 +1735,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":52
+    /* "pysam/ctabix.pyx":52
  *     """
  *     if PY_MAJOR_VERSION < 3:
  *         return s             # <<<<<<<<<<<<<<
@@ -1754,7 +1750,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
     goto __pyx_L3;
   }
 
-  /* "ctabix.pyx":53
+  /* "pysam/ctabix.pyx":53
  *     if PY_MAJOR_VERSION < 3:
  *         return s
  *     elif s is None:             # <<<<<<<<<<<<<<
@@ -1764,7 +1760,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = (__pyx_v_s == Py_None);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":54
+    /* "pysam/ctabix.pyx":54
  *         return s
  *     elif s is None:
  *         return None             # <<<<<<<<<<<<<<
@@ -1778,7 +1774,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
     goto __pyx_L3;
   }
 
-  /* "ctabix.pyx":55
+  /* "pysam/ctabix.pyx":55
  *     elif s is None:
  *         return None
  *     elif PyBytes_Check(s):             # <<<<<<<<<<<<<<
@@ -1788,7 +1784,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = PyBytes_Check(__pyx_v_s);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":56
+    /* "pysam/ctabix.pyx":56
  *         return None
  *     elif PyBytes_Check(s):
  *         return s             # <<<<<<<<<<<<<<
@@ -1803,7 +1799,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
     goto __pyx_L3;
   }
 
-  /* "ctabix.pyx":57
+  /* "pysam/ctabix.pyx":57
  *     elif PyBytes_Check(s):
  *         return s
  *     elif PyUnicode_Check(s):             # <<<<<<<<<<<<<<
@@ -1813,7 +1809,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":58
+    /* "pysam/ctabix.pyx":58
  *         return s
  *     elif PyUnicode_Check(s):
  *         return s.encode('ascii')             # <<<<<<<<<<<<<<
@@ -1834,7 +1830,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   }
   /*else*/ {
 
-    /* "ctabix.pyx":60
+    /* "pysam/ctabix.pyx":60
  *         return s.encode('ascii')
  *     else:
  *         raise TypeError, u"Argument must be string, bytes or unicode."             # <<<<<<<<<<<<<<
@@ -1851,7 +1847,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("ctabix._force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix._force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -1859,7 +1855,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
   return __pyx_r;
 }
 
-/* "ctabix.pyx":62
+/* "pysam/ctabix.pyx":62
  *         raise TypeError, u"Argument must be string, bytes or unicode."
  * 
  * cdef inline bytes _force_cmdline_bytes(object s):             # <<<<<<<<<<<<<<
@@ -1867,7 +1863,7 @@ static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
  * 
  */
 
-static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__pyx_v_s) {
+static CYTHON_INLINE PyObject *__pyx_f_5pysam_6ctabix__force_cmdline_bytes(PyObject *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -1876,7 +1872,7 @@ static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_force_cmdline_bytes", 0);
 
-  /* "ctabix.pyx":63
+  /* "pysam/ctabix.pyx":63
  * 
  * cdef inline bytes _force_cmdline_bytes(object s):
  *     return _force_bytes(s)             # <<<<<<<<<<<<<<
@@ -1884,7 +1880,7 @@ static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__
  * cdef _charptr_to_str(char* s):
  */
   __Pyx_XDECREF(((PyObject *)__pyx_r));
-  __pyx_t_1 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_6ctabix__force_bytes(__pyx_v_s)); 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_r = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -1894,7 +1890,7 @@ static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix._force_cmdline_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix._force_cmdline_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -1902,7 +1898,7 @@ static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__
   return __pyx_r;
 }
 
-/* "ctabix.pyx":65
+/* "pysam/ctabix.pyx":65
  *     return _force_bytes(s)
  * 
  * cdef _charptr_to_str(char* s):             # <<<<<<<<<<<<<<
@@ -1910,7 +1906,7 @@ static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__
  *         return s
  */
 
-static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
+static PyObject *__pyx_f_5pysam_6ctabix__charptr_to_str(char *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -1920,7 +1916,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_charptr_to_str", 0);
 
-  /* "ctabix.pyx":66
+  /* "pysam/ctabix.pyx":66
  * 
  * cdef _charptr_to_str(char* s):
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -1930,7 +1926,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":67
+    /* "pysam/ctabix.pyx":67
  * cdef _charptr_to_str(char* s):
  *     if PY_MAJOR_VERSION < 3:
  *         return s             # <<<<<<<<<<<<<<
@@ -1947,7 +1943,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
   }
   /*else*/ {
 
-    /* "ctabix.pyx":69
+    /* "pysam/ctabix.pyx":69
  *         return s
  *     else:
  *         return s.decode("ascii")             # <<<<<<<<<<<<<<
@@ -1955,7 +1951,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
  * cdef _force_str(object s):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, strlen(__pyx_v_s), NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -1967,7 +1963,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix._charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix._charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -1975,7 +1971,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
   return __pyx_r;
 }
 
-/* "ctabix.pyx":71
+/* "pysam/ctabix.pyx":71
  *         return s.decode("ascii")
  * 
  * cdef _force_str(object s):             # <<<<<<<<<<<<<<
@@ -1983,7 +1979,7 @@ static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
  *     if s is None:
  */
 
-static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
+static PyObject *__pyx_f_5pysam_6ctabix__force_str(PyObject *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -1994,7 +1990,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_force_str", 0);
 
-  /* "ctabix.pyx":73
+  /* "pysam/ctabix.pyx":73
  * cdef _force_str(object s):
  *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
  *     if s is None:             # <<<<<<<<<<<<<<
@@ -2004,7 +2000,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   __pyx_t_1 = (__pyx_v_s == Py_None);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":74
+    /* "pysam/ctabix.pyx":74
  *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
  *     if s is None:
  *         return None             # <<<<<<<<<<<<<<
@@ -2019,7 +2015,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":75
+  /* "pysam/ctabix.pyx":75
  *     if s is None:
  *         return None
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -2029,7 +2025,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":76
+    /* "pysam/ctabix.pyx":76
  *         return None
  *     if PY_MAJOR_VERSION < 3:
  *         return s             # <<<<<<<<<<<<<<
@@ -2043,7 +2039,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
     goto __pyx_L4;
   }
 
-  /* "ctabix.pyx":77
+  /* "pysam/ctabix.pyx":77
  *     if PY_MAJOR_VERSION < 3:
  *         return s
  *     elif PyBytes_Check(s):             # <<<<<<<<<<<<<<
@@ -2053,7 +2049,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   __pyx_t_1 = PyBytes_Check(__pyx_v_s);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":78
+    /* "pysam/ctabix.pyx":78
  *         return s
  *     elif PyBytes_Check(s):
  *         return s.decode('ascii')             # <<<<<<<<<<<<<<
@@ -2073,7 +2069,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   }
   /*else*/ {
 
-    /* "ctabix.pyx":81
+    /* "pysam/ctabix.pyx":81
  *     else:
  *         # assume unicode
  *         return s             # <<<<<<<<<<<<<<
@@ -2092,7 +2088,7 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("ctabix._force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix._force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -2101,13 +2097,12 @@ static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
 }
 
 /* Python wrapper */
-static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_5pysam_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_mode = 0;
   PyObject *__pyx_v_args = 0;
   PyObject *__pyx_v_kwargs = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -2125,6 +2120,7 @@ static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObje
     __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
   }
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
     PyObject* values[2] = {0,0};
     values[1] = ((PyObject *)__pyx_n_s__r);
     if (unlikely(__pyx_kwds)) {
@@ -2139,8 +2135,7 @@ static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -2171,18 +2166,18 @@ static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObje
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
-  __Pyx_AddTraceback("ctabix.Tabixfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile___cinit__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_args, __pyx_v_kwargs);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile___cinit__(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_args, __pyx_v_kwargs);
   __Pyx_XDECREF(__pyx_v_args);
   __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":90
+/* "pysam/ctabix.pyx":90
  *     index (*filename* + ".tbi") will raise an exception.
  *     '''
  *     def __cinit__(self, filename, mode = 'r', *args, **kwargs ):             # <<<<<<<<<<<<<<
@@ -2190,7 +2185,7 @@ static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObje
  *         self._open( filename, mode, *args, **kwargs )
  */
 
-static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
+static int __pyx_pf_5pysam_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -2202,7 +2197,7 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixf
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":91
+  /* "pysam/ctabix.pyx":91
  *     '''
  *     def __cinit__(self, filename, mode = 'r', *args, **kwargs ):
  *         self.tabixfile = NULL             # <<<<<<<<<<<<<<
@@ -2211,7 +2206,7 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixf
  */
   __pyx_v_self->tabixfile = NULL;
 
-  /* "ctabix.pyx":92
+  /* "pysam/ctabix.pyx":92
  *     def __cinit__(self, filename, mode = 'r', *args, **kwargs ):
  *         self.tabixfile = NULL
  *         self._open( filename, mode, *args, **kwargs )             # <<<<<<<<<<<<<<
@@ -2250,7 +2245,7 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixf
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("ctabix.Tabixfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -2258,18 +2253,18 @@ static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixf
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile_2_isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_9Tabixfile_2_isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened.";
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_isOpen (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_2_isOpen(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_2_isOpen(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":94
+/* "pysam/ctabix.pyx":94
  *         self._open( filename, mode, *args, **kwargs )
  * 
  *     def _isOpen( self ):             # <<<<<<<<<<<<<<
@@ -2277,7 +2272,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CY
  *         return self.tabixfile != NULL
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -2286,7 +2281,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_T
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_isOpen", 0);
 
-  /* "ctabix.pyx":96
+  /* "pysam/ctabix.pyx":96
  *     def _isOpen( self ):
  *         '''return true if samfile has been opened.'''
  *         return self.tabixfile != NULL             # <<<<<<<<<<<<<<
@@ -2304,7 +2299,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_T
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.Tabixfile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -2313,16 +2308,16 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_T
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile_4_open[] = "Tabixfile._open(self, filename, mode='r')\nopen a :term:`tabix file` for reading.\n        ";
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_9Tabixfile_4_open[] = "Tabixfile._open(self, filename, mode='r')\nopen a :term:`tabix file` for reading.\n        ";
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_mode = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_open (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
     PyObject* values[2] = {0,0};
     values[1] = ((PyObject *)__pyx_n_s__r);
     if (unlikely(__pyx_kwds)) {
@@ -2337,8 +2332,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -2364,16 +2358,16 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyOb
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_4_open(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":98
+/* "pysam/ctabix.pyx":98
  *         return self.tabixfile != NULL
  * 
  *     def _open( self,             # <<<<<<<<<<<<<<
@@ -2381,14 +2375,14 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyOb
  *                mode ='r',
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode) {
   PyObject *__pyx_v_filename_index = NULL;
   CYTHON_UNUSED PyObject *__pyx_v_bmode = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   int __pyx_t_5;
   char *__pyx_t_6;
@@ -2400,7 +2394,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
   __Pyx_RefNannySetupContext("_open", 0);
   __Pyx_INCREF(__pyx_v_filename);
 
-  /* "ctabix.pyx":105
+  /* "pysam/ctabix.pyx":105
  *         '''
  * 
  *         assert mode in ( "r",), "invalid file opening mode `%s`" % mode             # <<<<<<<<<<<<<<
@@ -2410,9 +2404,11 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
   #ifndef CYTHON_WITHOUT_ASSERTIONS
   __Pyx_INCREF(__pyx_v_mode);
   __pyx_t_1 = __pyx_v_mode;
-  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __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;
-  if (unlikely(!((int)__pyx_t_2))) {
+  if (unlikely(!((int)__pyx_t_3))) {
     __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
@@ -2421,26 +2417,26 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
   }
   #endif
 
-  /* "ctabix.pyx":108
+  /* "pysam/ctabix.pyx":108
  * 
  *         # close a previously opened file
  *         if self.tabixfile != NULL: self.close()             # <<<<<<<<<<<<<<
  *         self.tabixfile = NULL
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->tabixfile != NULL);
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_v_self->tabixfile != NULL);
+  if (__pyx_t_3) {
     __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __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 = 108; __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_L3;
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":109
+  /* "pysam/ctabix.pyx":109
  *         # close a previously opened file
  *         if self.tabixfile != NULL: self.close()
  *         self.tabixfile = NULL             # <<<<<<<<<<<<<<
@@ -2449,105 +2445,105 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
   __pyx_v_self->tabixfile = NULL;
 
-  /* "ctabix.pyx":111
+  /* "pysam/ctabix.pyx":111
  *         self.tabixfile = NULL
  * 
  *         filename_index = filename + ".tbi"             # <<<<<<<<<<<<<<
  *         self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" )
  * 
  */
-  __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_filename_index = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_2 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_v_filename_index = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":112
+  /* "pysam/ctabix.pyx":112
  * 
  *         filename_index = filename + ".tbi"
  *         self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" )             # <<<<<<<<<<<<<<
  * 
  *         # encode all the strings
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (!__pyx_t_2) {
+  __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!__pyx_t_3) {
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = __pyx_t_4;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = __pyx_t_4;
     __pyx_t_4 = 0;
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_2 = __pyx_t_1;
     __pyx_t_1 = 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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_self->isremote = __pyx_t_5;
 
-  /* "ctabix.pyx":115
+  /* "pysam/ctabix.pyx":115
  * 
  *         # encode all the strings
  *         filename = _my_encodeFilename(filename)             # <<<<<<<<<<<<<<
  *         filename_index = _my_encodeFilename(filename_index)
  *         cdef bytes bmode = mode.encode('ascii')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename)); 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_v_filename);
-  __pyx_v_filename = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_filename = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":116
+  /* "pysam/ctabix.pyx":116
  *         # encode all the strings
  *         filename = _my_encodeFilename(filename)
  *         filename_index = _my_encodeFilename(filename_index)             # <<<<<<<<<<<<<<
  *         cdef bytes bmode = mode.encode('ascii')
  * 
  */
-  __pyx_t_3 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename_index)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename_index)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_filename_index);
-  __pyx_v_filename_index = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_v_filename_index = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":117
+  /* "pysam/ctabix.pyx":117
  *         filename = _my_encodeFilename(filename)
  *         filename_index = _my_encodeFilename(filename_index)
  *         cdef bytes bmode = mode.encode('ascii')             # <<<<<<<<<<<<<<
  * 
  *         if self._filename != NULL: free(self._filename )
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_mode, __pyx_n_s__encode); 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_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_mode, __pyx_n_s__encode); 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_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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;
   if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_bmode = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":119
+  /* "pysam/ctabix.pyx":119
  *         cdef bytes bmode = mode.encode('ascii')
  * 
  *         if self._filename != NULL: free(self._filename )             # <<<<<<<<<<<<<<
  * 
  *         self._filename = strdup(filename)
  */
-  __pyx_t_2 = (__pyx_v_self->_filename != NULL);
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_v_self->_filename != NULL);
+  if (__pyx_t_3) {
     free(__pyx_v_self->_filename);
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":121
+  /* "pysam/ctabix.pyx":121
  *         if self._filename != NULL: free(self._filename )
  * 
  *         self._filename = strdup(filename)             # <<<<<<<<<<<<<<
@@ -2557,7 +2553,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
   __pyx_t_6 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_self->_filename = strdup(__pyx_t_6);
 
-  /* "ctabix.pyx":123
+  /* "pysam/ctabix.pyx":123
  *         self._filename = strdup(filename)
  * 
  *         if mode[0] == 'w':             # <<<<<<<<<<<<<<
@@ -2566,49 +2562,53 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_3) {
 
-    /* "ctabix.pyx":125
+    /* "pysam/ctabix.pyx":125
  *         if mode[0] == 'w':
  *             # open file for writing
  *             raise NotImplementedError("writing to tabix files not implemented" )             # <<<<<<<<<<<<<<
  * 
  *         elif mode[0] == "r":
  */
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_13), NULL); 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_Raise(__pyx_t_1, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_13), 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_Raise(__pyx_t_2, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
 
-  /* "ctabix.pyx":127
+  /* "pysam/ctabix.pyx":127
  *             raise NotImplementedError("writing to tabix files not implemented" )
  * 
  *         elif mode[0] == "r":             # <<<<<<<<<<<<<<
  *             # open file for reading
  * 
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __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 = 127; __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); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  if (__pyx_t_3) {
 
-    /* "ctabix.pyx":130
+    /* "pysam/ctabix.pyx":130
  *             # open file for reading
  * 
  *             if not self.isremote:             # <<<<<<<<<<<<<<
  *                 if not os.path.exists( filename ):
  *                     raise IOError( "file `%s` not found" % filename)
  */
-    __pyx_t_2 = (!__pyx_v_self->isremote);
-    if (__pyx_t_2) {
+    __pyx_t_3 = (!__pyx_v_self->isremote);
+    if (__pyx_t_3) {
 
-      /* "ctabix.pyx":131
+      /* "pysam/ctabix.pyx":131
  * 
  *             if not self.isremote:
  *                 if not os.path.exists( filename ):             # <<<<<<<<<<<<<<
@@ -2617,27 +2617,27 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
       __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); 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);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __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_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __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 = 131; __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 = 131; __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_filename);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
       __Pyx_GIVEREF(__pyx_v_filename);
-      __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 = 131; __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_7 = (!__pyx_t_2);
+      __pyx_t_7 = (!__pyx_t_3);
       if (__pyx_t_7) {
 
-        /* "ctabix.pyx":132
+        /* "pysam/ctabix.pyx":132
  *             if not self.isremote:
  *                 if not os.path.exists( filename ):
  *                     raise IOError( "file `%s` not found" % filename)             # <<<<<<<<<<<<<<
@@ -2646,14 +2646,14 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
         __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        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, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __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 = 132; __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_Raise(__pyx_t_4, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2661,7 +2661,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
       }
       __pyx_L7:;
 
-      /* "ctabix.pyx":134
+      /* "pysam/ctabix.pyx":134
  *                     raise IOError( "file `%s` not found" % filename)
  * 
  *                 if not os.path.exists( filename_index ):             # <<<<<<<<<<<<<<
@@ -2670,27 +2670,27 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
       __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __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 = 134; __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 = 134; __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_filename_index);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __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, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __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 = 134; __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_3)); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_2 = (!__pyx_t_7);
-      if (__pyx_t_2) {
+      __pyx_t_3 = (!__pyx_t_7);
+      if (__pyx_t_3) {
 
-        /* "ctabix.pyx":135
+        /* "pysam/ctabix.pyx":135
  * 
  *                 if not os.path.exists( filename_index ):
  *                     raise IOError( "index `%s` not found" % filename_index)             # <<<<<<<<<<<<<<
@@ -2699,14 +2699,14 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
         __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
+        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2717,7 +2717,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":138
+    /* "pysam/ctabix.pyx":138
  * 
  *             # open file and load index
  *             self.tabixfile = ti_open( filename, filename_index )             # <<<<<<<<<<<<<<
@@ -2731,17 +2731,17 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
   }
   __pyx_L5:;
 
-  /* "ctabix.pyx":140
+  /* "pysam/ctabix.pyx":140
  *             self.tabixfile = ti_open( filename, filename_index )
  * 
  *         if self.tabixfile == NULL:             # <<<<<<<<<<<<<<
  *             raise IOError("could not open file `%s`" % filename )
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->tabixfile == NULL);
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_v_self->tabixfile == NULL);
+  if (__pyx_t_3) {
 
-    /* "ctabix.pyx":141
+    /* "pysam/ctabix.pyx":141
  * 
  *         if self.tabixfile == NULL:
  *             raise IOError("could not open file `%s`" % filename )             # <<<<<<<<<<<<<<
@@ -2750,14 +2750,14 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
  */
     __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2769,9 +2769,9 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_filename_index);
@@ -2783,21 +2783,21 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tab
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile_6_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_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_9Tabixfile_6_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_pw_5pysam_6ctabix_9Tabixfile_7_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;
   PyObject *__pyx_v_region = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_parseRegion (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "ctabix.pyx":144
+    /* "pysam/ctabix.pyx":144
  * 
  *     def _parseRegion( self,
  *                       reference = None,             # <<<<<<<<<<<<<<
@@ -2806,7 +2806,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_sel
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":145
+    /* "pysam/ctabix.pyx":145
  *     def _parseRegion( self,
  *                       reference = None,
  *                       start = None,             # <<<<<<<<<<<<<<
@@ -2815,7 +2815,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_sel
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":146
+    /* "pysam/ctabix.pyx":146
  *                       reference = None,
  *                       start = None,
  *                       end = None,             # <<<<<<<<<<<<<<
@@ -2824,7 +2824,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_sel
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":147
+    /* "pysam/ctabix.pyx":147
  *                       start = None,
  *                       end = None,
  *                       region = None ):             # <<<<<<<<<<<<<<
@@ -2888,16 +2888,16 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_sel
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_6_parseRegion(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_6_parseRegion(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":143
+/* "pysam/ctabix.pyx":143
  *             raise IOError("could not open file `%s`" % filename )
  * 
  *     def _parseRegion( self,             # <<<<<<<<<<<<<<
@@ -2905,7 +2905,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_sel
  *                       start = None,
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
   int __pyx_v_rtid;
   int __pyx_v_rstart;
   int __pyx_v_rend;
@@ -2926,7 +2926,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   __Pyx_RefNannySetupContext("_parseRegion", 0);
   __Pyx_INCREF(__pyx_v_region);
 
-  /* "ctabix.pyx":158
+  /* "pysam/ctabix.pyx":158
  *         Note that regions are 1-based, while start,end are python coordinates.
  *         '''
  *         ti_lazy_index_load( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -2935,7 +2935,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
  */
   ti_lazy_index_load(__pyx_v_self->tabixfile);
 
-  /* "ctabix.pyx":164
+  /* "pysam/ctabix.pyx":164
  *         cdef int rend
  *         cdef int max_pos
  *         max_pos = 2 << 29             # <<<<<<<<<<<<<<
@@ -2944,7 +2944,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
  */
   __pyx_v_max_pos = 1073741824;
 
-  /* "ctabix.pyx":166
+  /* "pysam/ctabix.pyx":166
  *         max_pos = 2 << 29
  * 
  *         rtid = rstart = rend = 0             # <<<<<<<<<<<<<<
@@ -2955,7 +2955,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   __pyx_v_rstart = 0;
   __pyx_v_rend = 0;
 
-  /* "ctabix.pyx":169
+  /* "pysam/ctabix.pyx":169
  * 
  *         # translate to a region
  *         if reference:             # <<<<<<<<<<<<<<
@@ -2965,20 +2965,18 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":170
+    /* "pysam/ctabix.pyx":170
  *         # 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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __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 = 170; __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_4 = __pyx_t_3;
@@ -2987,7 +2985,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     if (__pyx_t_4) {
 
-      /* "ctabix.pyx":171
+      /* "pysam/ctabix.pyx":171
  *         if reference:
  *             if start != None and end != None:
  *                 region = "%s:%i-%i" % (reference, start+1, end)             # <<<<<<<<<<<<<<
@@ -3016,20 +3014,18 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
       goto __pyx_L4;
     }
 
-    /* "ctabix.pyx":172
+    /* "pysam/ctabix.pyx":172
  *             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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 172; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_3 = __pyx_t_1;
@@ -3038,7 +3034,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     if (__pyx_t_3) {
 
-      /* "ctabix.pyx":173
+      /* "pysam/ctabix.pyx":173
  *                 region = "%s:%i-%i" % (reference, start+1, end)
  *             elif start == None and end != None:
  *                 region = "%s:%i-%i" % (reference, 1, end)             # <<<<<<<<<<<<<<
@@ -3065,20 +3061,18 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
       goto __pyx_L4;
     }
 
-    /* "ctabix.pyx":174
+    /* "pysam/ctabix.pyx":174
  *             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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __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 = 174; __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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_1 = __pyx_t_4;
@@ -3087,7 +3081,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     if (__pyx_t_1) {
 
-      /* "ctabix.pyx":175
+      /* "pysam/ctabix.pyx":175
  *                 region = "%s:%i-%i" % (reference, 1, end)
  *             elif end == None and start != None:
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)             # <<<<<<<<<<<<<<
@@ -3119,7 +3113,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     /*else*/ {
 
-      /* "ctabix.pyx":177
+      /* "pysam/ctabix.pyx":177
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)
  *             else:
  *                 region = reference             # <<<<<<<<<<<<<<
@@ -3135,7 +3129,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":179
+  /* "pysam/ctabix.pyx":179
  *                 region = reference
  * 
  *         if region:             # <<<<<<<<<<<<<<
@@ -3145,20 +3139,20 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":180
+    /* "pysam/ctabix.pyx":180
  * 
  *         if region:
  *             region = _force_bytes(region)             # <<<<<<<<<<<<<<
  *             ti_parse_region( self.tabixfile.idx, region,
  *                              &rtid, &rstart, &rend)
  */
-    __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_region)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_6ctabix__force_bytes(__pyx_v_region)); 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_v_region);
     __pyx_v_region = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "ctabix.pyx":181
+    /* "pysam/ctabix.pyx":181
  *         if region:
  *             region = _force_bytes(region)
  *             ti_parse_region( self.tabixfile.idx, region,             # <<<<<<<<<<<<<<
@@ -3167,7 +3161,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
  */
     __pyx_t_7 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "ctabix.pyx":182
+    /* "pysam/ctabix.pyx":182
  *             region = _force_bytes(region)
  *             ti_parse_region( self.tabixfile.idx, region,
  *                              &rtid, &rstart, &rend)             # <<<<<<<<<<<<<<
@@ -3176,7 +3170,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
  */
     ti_parse_region(__pyx_v_self->tabixfile->idx, __pyx_t_7, (&__pyx_v_rtid), (&__pyx_v_rstart), (&__pyx_v_rend));
 
-    /* "ctabix.pyx":183
+    /* "pysam/ctabix.pyx":183
  *             ti_parse_region( self.tabixfile.idx, region,
  *                              &rtid, &rstart, &rend)
  *             if rtid < 0: raise ValueError( "invalid region `%s`" % region )             # <<<<<<<<<<<<<<
@@ -3202,7 +3196,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":184
+    /* "pysam/ctabix.pyx":184
  *                              &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) )             # <<<<<<<<<<<<<<
@@ -3241,7 +3235,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":185
+    /* "pysam/ctabix.pyx":185
  *             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 )             # <<<<<<<<<<<<<<
@@ -3274,7 +3268,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":186
+    /* "pysam/ctabix.pyx":186
  *             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 )             # <<<<<<<<<<<<<<
@@ -3310,7 +3304,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   }
   __pyx_L5:;
 
-  /* "ctabix.pyx":188
+  /* "pysam/ctabix.pyx":188
  *             if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
  * 
  *         return region, rtid, rstart, rend             # <<<<<<<<<<<<<<
@@ -3349,7 +3343,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_region);
@@ -3359,22 +3353,22 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6cta
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile_8fetch[] = "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, [...]
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_9Tabixfile_8fetch[] = "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*  [...]
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_9fetch(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;
   PyObject *__pyx_v_region = 0;
   PyObject *__pyx_v_parser = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__parser,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__parser,0};
     PyObject* values[5] = {0,0,0,0,0};
 
-    /* "ctabix.pyx":191
+    /* "pysam/ctabix.pyx":191
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -3383,7 +3377,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyOb
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":192
+    /* "pysam/ctabix.pyx":192
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -3392,7 +3386,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyOb
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":193
+    /* "pysam/ctabix.pyx":193
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -3401,7 +3395,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyOb
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":194
+    /* "pysam/ctabix.pyx":194
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -3410,7 +3404,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyOb
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":195
+    /* "pysam/ctabix.pyx":195
  *                end = None,
  *                region = None,
  *                parser = None ):             # <<<<<<<<<<<<<<
@@ -3482,16 +3476,16 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyOb
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.Tabixfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_8fetch(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_parser);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_8fetch(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_parser);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":190
+/* "pysam/ctabix.pyx":190
  *         return region, rtid, rstart, rend
  * 
  *     def fetch( self,             # <<<<<<<<<<<<<<
@@ -3499,7 +3493,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyOb
  *                start = None,
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_parser) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_parser) {
   PyObject *__pyx_v_rtid = NULL;
   PyObject *__pyx_v_rstart = NULL;
   PyObject *__pyx_v_rend = NULL;
@@ -3520,7 +3514,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   __Pyx_RefNannySetupContext("fetch", 0);
   __Pyx_INCREF(__pyx_v_region);
 
-  /* "ctabix.pyx":209
+  /* "pysam/ctabix.pyx":209
  *         data (see for example :meth:`asTuple` and :meth:`asGTF`).
  *         '''
  *         ti_lazy_index_load( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -3529,7 +3523,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
  */
   ti_lazy_index_load(__pyx_v_self->tabixfile);
 
-  /* "ctabix.pyx":211
+  /* "pysam/ctabix.pyx":211
  *         ti_lazy_index_load( self.tabixfile )
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
@@ -3546,7 +3540,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "ctabix.pyx":212
+    /* "pysam/ctabix.pyx":212
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -3562,7 +3556,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":214
+  /* "pysam/ctabix.pyx":214
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
@@ -3591,22 +3585,23 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
     PyObject* sequence = __pyx_t_5;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    Py_ssize_t size = Py_SIZE(sequence);
+    #else
+    Py_ssize_t size = PySequence_Size(sequence);
+    #endif
+    if (unlikely(size != 4)) {
+      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
+      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
-      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
-        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
-        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
     } else {
-      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
-        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
-        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
@@ -3616,28 +3611,36 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
     __Pyx_INCREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_t_7);
+    #else
+    Py_ssize_t i;
+    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
+    for (i=0; i < 4; i++) {
+      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      *(temps[i]) = item;
+    }
+    #endif
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  } else {
+  } else
+  {
     Py_ssize_t index = -1;
+    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
     __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_1);
-    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_2);
-    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_6);
-    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_7);
+    for (index=0; index < 4; index++) {
+      PyObject* item = __pyx_t_9(__pyx_t_8); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
+      __Pyx_GOTREF(item);
+      *(temps[index]) = item;
+    }
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = NULL;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+    __pyx_t_9 = NULL;
+    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
@@ -3651,20 +3654,19 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   __pyx_v_rend = __pyx_t_7;
   __pyx_t_7 = 0;
 
-  /* "ctabix.pyx":216
+  /* "pysam/ctabix.pyx":216
  *         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 = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __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 = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   if (__pyx_t_4) {
 
-    /* "ctabix.pyx":217
+    /* "pysam/ctabix.pyx":217
  * 
  *         if parser == None:
  *             if region:             # <<<<<<<<<<<<<<
@@ -3674,7 +3676,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
 
-      /* "ctabix.pyx":218
+      /* "pysam/ctabix.pyx":218
  *         if parser == None:
  *             if region:
  *                 return TabixIterator( self, rtid, rstart, rend )             # <<<<<<<<<<<<<<
@@ -3696,7 +3698,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
       __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)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __pyx_r = __pyx_t_7;
@@ -3706,7 +3708,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
     }
     /*else*/ {
 
-      /* "ctabix.pyx":220
+      /* "pysam/ctabix.pyx":220
  *                 return TabixIterator( self, rtid, rstart, rend )
  *             else:
  *                 return TabixIterator( self, -1, 0, 0 )             # <<<<<<<<<<<<<<
@@ -3728,7 +3730,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
       __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)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __pyx_r = __pyx_t_5;
@@ -3740,7 +3742,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   }
   /*else*/ {
 
-    /* "ctabix.pyx":222
+    /* "pysam/ctabix.pyx":222
  *                 return TabixIterator( self, -1, 0, 0 )
  *         else:
  *             if region:             # <<<<<<<<<<<<<<
@@ -3750,7 +3752,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
 
-      /* "ctabix.pyx":223
+      /* "pysam/ctabix.pyx":223
  *         else:
  *             if region:
  *                 return TabixIteratorParsed( self, rtid, rstart, rend, parser )             # <<<<<<<<<<<<<<
@@ -3775,7 +3777,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
       __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)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __pyx_r = __pyx_t_7;
@@ -3785,7 +3787,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
     }
     /*else*/ {
 
-      /* "ctabix.pyx":225
+      /* "pysam/ctabix.pyx":225
  *                 return TabixIteratorParsed( self, rtid, rstart, rend, parser )
  *             else:
  *                 return TabixIteratorParsed( self, -1, 0, 0, parser )             # <<<<<<<<<<<<<<
@@ -3810,7 +3812,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
       __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)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __pyx_r = __pyx_t_5;
@@ -3830,7 +3832,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("ctabix.Tabixfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_rtid);
@@ -3843,17 +3845,17 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tab
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_8filename___get__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_8filename___get__(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":234
+/* "pysam/ctabix.pyx":234
  *     property filename:
  *         '''filename associated with this object.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -3861,7 +3863,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_
  *             return self._filename
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3873,7 +3875,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "ctabix.pyx":235
+  /* "pysam/ctabix.pyx":235
  *         '''filename associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -3898,7 +3900,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":236
+  /* "pysam/ctabix.pyx":236
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self._filename             # <<<<<<<<<<<<<<
@@ -3917,7 +3919,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.Tabixfile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3926,17 +3928,17 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_6header___get__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_6header___get__(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":246
+/* "pysam/ctabix.pyx":246
  *         '''
  * 
  *         def __get__( self ):             # <<<<<<<<<<<<<<
@@ -3944,7 +3946,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3954,7 +3956,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6c
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "ctabix.pyx":247
+  /* "pysam/ctabix.pyx":247
  * 
  *         def __get__( self ):
  *             return TabixHeaderIterator( self )             # <<<<<<<<<<<<<<
@@ -3967,7 +3969,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6c
   __Pyx_INCREF(((PyObject *)__pyx_v_self));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
-  __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 = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_6ctabix_TabixHeaderIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -3979,7 +3981,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6c
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.Tabixfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3988,17 +3990,17 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6c
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_7contigs___get__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_7contigs___get__(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":251
+/* "pysam/ctabix.pyx":251
  *     property contigs:
  *         '''chromosome names'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -4006,7 +4008,7 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v
  *             cdef int nsequences
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self) {
   char **__pyx_v_sequences;
   int __pyx_v_nsequences;
   int __pyx_v_x;
@@ -4021,7 +4023,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "ctabix.pyx":255
+  /* "pysam/ctabix.pyx":255
  *             cdef int nsequences
  * 
  *             ti_lazy_index_load( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -4030,7 +4032,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
  */
   ti_lazy_index_load(__pyx_v_self->tabixfile);
 
-  /* "ctabix.pyx":256
+  /* "pysam/ctabix.pyx":256
  * 
  *             ti_lazy_index_load( self.tabixfile )
  *             sequences = ti_seqname( self.tabixfile.idx, &nsequences )             # <<<<<<<<<<<<<<
@@ -4039,7 +4041,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
  */
   __pyx_v_sequences = ti_seqname(__pyx_v_self->tabixfile->idx, (&__pyx_v_nsequences));
 
-  /* "ctabix.pyx":258
+  /* "pysam/ctabix.pyx":258
  *             sequences = ti_seqname( self.tabixfile.idx, &nsequences )
  *             cdef int x
  *             result = []             # <<<<<<<<<<<<<<
@@ -4051,7 +4053,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
   __pyx_v_result = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":259
+  /* "pysam/ctabix.pyx":259
  *             cdef int x
  *             result = []
  *             for x from 0 <= x < nsequences:             # <<<<<<<<<<<<<<
@@ -4061,7 +4063,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
   __pyx_t_2 = __pyx_v_nsequences;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
 
-    /* "ctabix.pyx":260
+    /* "pysam/ctabix.pyx":260
  *             result = []
  *             for x from 0 <= x < nsequences:
  *                 result.append( sequences[x] )             # <<<<<<<<<<<<<<
@@ -4074,7 +4076,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   }
 
-  /* "ctabix.pyx":261
+  /* "pysam/ctabix.pyx":261
  *             for x from 0 <= x < nsequences:
  *                 result.append( sequences[x] )
  *             return result             # <<<<<<<<<<<<<<
@@ -4090,7 +4092,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.Tabixfile.contigs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.Tabixfile.contigs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_result);
@@ -4100,18 +4102,18 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_6ctabix_9Tabixfile_10close[] = "Tabixfile.close(self)\n\n        closes the :class:`pysam.Tabixfile`.";
-static PyObject *__pyx_pw_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_9Tabixfile_10close[] = "Tabixfile.close(self)\n\n        closes the :class:`pysam.Tabixfile`.";
+static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("close (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_9Tabixfile_10close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_9Tabixfile_10close(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":263
+/* "pysam/ctabix.pyx":263
  *             return result
  * 
  *     def close( self ):             # <<<<<<<<<<<<<<
@@ -4119,13 +4121,13 @@ static PyObject *__pyx_pw_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYT
  *         closes the :class:`pysam.Tabixfile`.'''
  */
 
-static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_10close(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("close", 0);
 
-  /* "ctabix.pyx":266
+  /* "pysam/ctabix.pyx":266
  *         '''
  *         closes the :class:`pysam.Tabixfile`.'''
  *         if self.tabixfile != NULL:             # <<<<<<<<<<<<<<
@@ -4135,7 +4137,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Ta
   __pyx_t_1 = (__pyx_v_self->tabixfile != NULL);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":267
+    /* "pysam/ctabix.pyx":267
  *         closes the :class:`pysam.Tabixfile`.'''
  *         if self.tabixfile != NULL:
  *             ti_close( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -4144,7 +4146,7 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Ta
  */
     ti_close(__pyx_v_self->tabixfile);
 
-    /* "ctabix.pyx":268
+    /* "pysam/ctabix.pyx":268
  *         if self.tabixfile != NULL:
  *             ti_close( self.tabixfile )
  *             self.tabixfile = NULL             # <<<<<<<<<<<<<<
@@ -4163,15 +4165,15 @@ static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Ta
 }
 
 /* Python wrapper */
-static void __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_5pysam_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_5pysam_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
+  __pyx_pf_5pysam_6ctabix_9Tabixfile_12__dealloc__(((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ctabix.pyx":270
+/* "pysam/ctabix.pyx":270
  *             self.tabixfile = NULL
  * 
  *     def __dealloc__( self ):             # <<<<<<<<<<<<<<
@@ -4179,12 +4181,12 @@ static void __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self) {
  *         # note: no doc string
  */
 
-static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
+static void __pyx_pf_5pysam_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ctabix.pyx":274
+  /* "pysam/ctabix.pyx":274
  *         # note: no doc string
  *         # note: __del__ is not called.
  *         if self.tabixfile != NULL:             # <<<<<<<<<<<<<<
@@ -4194,7 +4196,7 @@ static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_T
   __pyx_t_1 = (__pyx_v_self->tabixfile != NULL);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":275
+    /* "pysam/ctabix.pyx":275
  *         # note: __del__ is not called.
  *         if self.tabixfile != NULL:
  *             ti_close( self.tabixfile )             # <<<<<<<<<<<<<<
@@ -4203,7 +4205,7 @@ static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_T
  */
     ti_close(__pyx_v_self->tabixfile);
 
-    /* "ctabix.pyx":276
+    /* "pysam/ctabix.pyx":276
  *         if self.tabixfile != NULL:
  *             ti_close( self.tabixfile )
  *             self.tabixfile = NULL             # <<<<<<<<<<<<<<
@@ -4215,7 +4217,7 @@ static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_T
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":277
+  /* "pysam/ctabix.pyx":277
  *             ti_close( self.tabixfile )
  *             self.tabixfile = NULL
  *         if self._filename != NULL: free( self._filename )             # <<<<<<<<<<<<<<
@@ -4233,17 +4235,17 @@ static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_T
 }
 
 /* Python wrapper */
-static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
+static int __pyx_pw_5pysam_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
   int __pyx_v_tid;
   int __pyx_v_start;
   int __pyx_v_end;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
     PyObject* values[4] = {0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -4259,24 +4261,20 @@ static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __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--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __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--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -4292,7 +4290,7 @@ static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, P
       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
     }
-    __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
+    __pyx_v_tabixfile = ((struct __pyx_obj_5pysam_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 = 285; __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 = 285; __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 = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
@@ -4301,12 +4299,12 @@ static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, P
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __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 = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_6ctabix_13TabixIterator___cinit__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self), __pyx_v_tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_5pysam_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5pysam_6ctabix_13TabixIterator___cinit__(((struct __pyx_obj_5pysam_6ctabix_TabixIterator *)__pyx_v_self), __pyx_v_tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
   goto __pyx_L0;
   __pyx_L1_error:;
   __pyx_r = -1;
@@ -4315,7 +4313,7 @@ static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, P
   return __pyx_r;
 }
 
-/* "ctabix.pyx":284
+/* "pysam/ctabix.pyx":284
  *     """
  * 
  *     def __cinit__(self, Tabixfile tabixfile,             # <<<<<<<<<<<<<<
@@ -4323,18 +4321,19 @@ static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, P
  * 
  */
 
-static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end) {
+static int __pyx_pf_5pysam_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self, struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
+  tabix_t *__pyx_t_4;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":287
+  /* "pysam/ctabix.pyx":287
  *                   int tid, int start, int end ):
  * 
  *         assert tabixfile._isOpen()             # <<<<<<<<<<<<<<
@@ -4355,16 +4354,17 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   }
   #endif
 
-  /* "ctabix.pyx":291
+  /* "pysam/ctabix.pyx":291
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive.
  *         self.tabixfile = tabixfile.tabixfile             # <<<<<<<<<<<<<<
  * 
  *         if tid < 0:
  */
-  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
+  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
+  __pyx_v_self->tabixfile = __pyx_t_4;
 
-  /* "ctabix.pyx":293
+  /* "pysam/ctabix.pyx":293
  *         self.tabixfile = tabixfile.tabixfile
  * 
  *         if tid < 0:             # <<<<<<<<<<<<<<
@@ -4374,7 +4374,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   __pyx_t_3 = (__pyx_v_tid < 0);
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":296
+    /* "pysam/ctabix.pyx":296
  *             # seek to start of file to ensure iteration is over
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)             # <<<<<<<<<<<<<<
@@ -4383,7 +4383,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
  */
     bgzf_seek(__pyx_v_self->tabixfile->fp, 0, 0);
 
-    /* "ctabix.pyx":297
+    /* "pysam/ctabix.pyx":297
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)
  *             self.iterator = ti_iter_first()             # <<<<<<<<<<<<<<
@@ -4395,7 +4395,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   }
   /*else*/ {
 
-    /* "ctabix.pyx":299
+    /* "pysam/ctabix.pyx":299
  *             self.iterator = ti_iter_first()
  *         else:
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)             # <<<<<<<<<<<<<<
@@ -4406,7 +4406,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":301
+  /* "pysam/ctabix.pyx":301
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)
  * 
  *         if <void*>self.iterator == NULL:             # <<<<<<<<<<<<<<
@@ -4416,7 +4416,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   __pyx_t_3 = (((void *)__pyx_v_self->iterator) == NULL);
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":302
+    /* "pysam/ctabix.pyx":302
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
@@ -4437,7 +4437,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -4445,17 +4445,17 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_13TabixIterator_2__iter__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_13TabixIterator_2__iter__(((struct __pyx_obj_5pysam_6ctabix_TabixIterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":304
+/* "pysam/ctabix.pyx":304
  *             raise ValueError("malformatted query or wrong sequence name.\n")
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -4463,12 +4463,12 @@ static PyObject *__pyx_pw_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":305
+  /* "pysam/ctabix.pyx":305
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -4488,19 +4488,21 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_6ct
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_13TabixIterator_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_6ctabix_13TabixIterator_4__next__;
-static PyObject *__pyx_pw_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_13TabixIterator_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_5pysam_6ctabix_13TabixIterator_4__next__;
+#endif
+static PyObject *__pyx_pw_5pysam_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_13TabixIterator_4__next__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_13TabixIterator_4__next__(((struct __pyx_obj_5pysam_6ctabix_TabixIterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":307
+/* "pysam/ctabix.pyx":307
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -4508,7 +4510,7 @@ static PyObject *__pyx_pw_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self) {
   char *__pyx_v_s;
   int __pyx_v_len;
   PyObject *__pyx_v_retval = NULL;
@@ -4521,7 +4523,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":320
+  /* "pysam/ctabix.pyx":320
  * 
  *         # simply use '#' for now.
  *         while 1:             # <<<<<<<<<<<<<<
@@ -4531,7 +4533,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
   while (1) {
     if (!1) break;
 
-    /* "ctabix.pyx":321
+    /* "pysam/ctabix.pyx":321
  *         # simply use '#' for now.
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)             # <<<<<<<<<<<<<<
@@ -4540,7 +4542,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
  */
     __pyx_v_s = ti_read(__pyx_v_self->tabixfile, __pyx_v_self->iterator, (&__pyx_v_len));
 
-    /* "ctabix.pyx":322
+    /* "pysam/ctabix.pyx":322
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)
  *             if s == NULL: raise StopIteration             # <<<<<<<<<<<<<<
@@ -4555,7 +4557,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":323
+    /* "pysam/ctabix.pyx":323
  *             s = ti_read(self.tabixfile, self.iterator, &len)
  *             if s == NULL: raise StopIteration
  *             if s[0] != '#': break             # <<<<<<<<<<<<<<
@@ -4571,19 +4573,19 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":325
+  /* "pysam/ctabix.pyx":325
  *             if s[0] != '#': break
  * 
  *         retval = _charptr_to_str( s )             # <<<<<<<<<<<<<<
  *         return retval
  * 
  */
-  __pyx_t_2 = __pyx_f_6ctabix__charptr_to_str(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_5pysam_6ctabix__charptr_to_str(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_v_retval = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":326
+  /* "pysam/ctabix.pyx":326
  * 
  *         retval = _charptr_to_str( s )
  *         return retval             # <<<<<<<<<<<<<<
@@ -4599,7 +4601,7 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.TabixIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_retval);
@@ -4609,15 +4611,15 @@ static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ct
 }
 
 /* Python wrapper */
-static void __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_5pysam_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_5pysam_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self));
+  __pyx_pf_5pysam_6ctabix_13TabixIterator_6__dealloc__(((struct __pyx_obj_5pysam_6ctabix_TabixIterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ctabix.pyx":328
+/* "pysam/ctabix.pyx":328
  *         return retval
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -4625,12 +4627,12 @@ static void __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self
  *             ti_iter_destroy(self.iterator)
  */
 
-static void __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self) {
+static void __pyx_pf_5pysam_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_5pysam_6ctabix_TabixIterator *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ctabix.pyx":329
+  /* "pysam/ctabix.pyx":329
  * 
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:             # <<<<<<<<<<<<<<
@@ -4640,7 +4642,7 @@ static void __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_6ctab
   __pyx_t_1 = (((void *)__pyx_v_self->iterator) != NULL);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":330
+    /* "pysam/ctabix.pyx":330
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:
  *             ti_iter_destroy(self.iterator)             # <<<<<<<<<<<<<<
@@ -4656,14 +4658,14 @@ static void __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_6ctab
 }
 
 /* Python wrapper */
-static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0};
+static int __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -4676,8 +4678,7 @@ static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_s
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -4688,18 +4689,18 @@ static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_s
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     }
-    __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
+    __pyx_v_tabixfile = ((struct __pyx_obj_5pysam_6ctabix_Tabixfile *)values[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 = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixHeaderIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __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 = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self), __pyx_v_tabixfile);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_5pysam_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator___cinit__(((struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *)__pyx_v_self), __pyx_v_tabixfile);
   goto __pyx_L0;
   __pyx_L1_error:;
   __pyx_r = -1;
@@ -4708,7 +4709,7 @@ static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "ctabix.pyx":336
+/* "pysam/ctabix.pyx":336
  *     """
  * 
  *     def __cinit__(self, Tabixfile tabixfile ):             # <<<<<<<<<<<<<<
@@ -4716,18 +4717,19 @@ static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_s
  *         assert tabixfile._isOpen()
  */
 
-static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile) {
+static int __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self, struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
+  tabix_t *__pyx_t_4;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":338
+  /* "pysam/ctabix.pyx":338
  *     def __cinit__(self, Tabixfile tabixfile ):
  * 
  *         assert tabixfile._isOpen()             # <<<<<<<<<<<<<<
@@ -4748,16 +4750,17 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
   }
   #endif
 
-  /* "ctabix.pyx":342
+  /* "pysam/ctabix.pyx":342
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive.
  *         self.tabixfile = tabixfile.tabixfile             # <<<<<<<<<<<<<<
  * 
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
  */
-  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
+  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
+  __pyx_v_self->tabixfile = __pyx_t_4;
 
-  /* "ctabix.pyx":344
+  /* "pysam/ctabix.pyx":344
  *         self.tabixfile = tabixfile.tabixfile
  * 
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)             # <<<<<<<<<<<<<<
@@ -4766,7 +4769,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
  */
   __pyx_v_self->iterator = ti_query(__pyx_v_self->tabixfile, NULL, 0, 0);
 
-  /* "ctabix.pyx":346
+  /* "pysam/ctabix.pyx":346
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
  * 
  *         if <void*>self.iterator == NULL:             # <<<<<<<<<<<<<<
@@ -4776,7 +4779,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
   __pyx_t_3 = (((void *)__pyx_v_self->iterator) == NULL);
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":347
+    /* "pysam/ctabix.pyx":347
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("can't open header.\n")             # <<<<<<<<<<<<<<
@@ -4797,7 +4800,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixHeaderIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -4805,17 +4808,17 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_2__iter__(((struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":349
+/* "pysam/ctabix.pyx":349
  *             raise ValueError("can't open header.\n")
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -4823,12 +4826,12 @@ static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":350
+  /* "pysam/ctabix.pyx":350
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -4848,19 +4851,21 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_o
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_19TabixHeaderIterator_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__;
-static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_19TabixHeaderIterator_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_5pysam_6ctabix_19TabixHeaderIterator_4__next__;
+#endif
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_4__next__(((struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":352
+/* "pysam/ctabix.pyx":352
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -4868,7 +4873,7 @@ static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self) {
   char *__pyx_v_s;
   int __pyx_v_len;
   PyObject *__pyx_r = NULL;
@@ -4880,7 +4885,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_o
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":363
+  /* "pysam/ctabix.pyx":363
  *         # 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)             # <<<<<<<<<<<<<<
@@ -4889,7 +4894,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_o
  */
   __pyx_v_s = ti_read(__pyx_v_self->tabixfile, __pyx_v_self->iterator, (&__pyx_v_len));
 
-  /* "ctabix.pyx":364
+  /* "pysam/ctabix.pyx":364
  *         # simply use '#' for now.
  *         s = ti_read(self.tabixfile, self.iterator, &len)
  *         if s == NULL: raise StopIteration             # <<<<<<<<<<<<<<
@@ -4904,7 +4909,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_o
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":366
+  /* "pysam/ctabix.pyx":366
  *         if s == NULL: raise StopIteration
  *         # stop at first non-header line
  *         if s[0] != '#': raise StopIteration             # <<<<<<<<<<<<<<
@@ -4919,7 +4924,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_o
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":368
+  /* "pysam/ctabix.pyx":368
  *         if s[0] != '#': raise StopIteration
  * 
  *         return s             # <<<<<<<<<<<<<<
@@ -4937,7 +4942,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixHeaderIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4946,15 +4951,15 @@ static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_o
 }
 
 /* Python wrapper */
-static void __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self));
+  __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_6__dealloc__(((struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ctabix.pyx":370
+/* "pysam/ctabix.pyx":370
  *         return s
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -4962,12 +4967,12 @@ static void __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_
  *             ti_iter_destroy(self.iterator)
  */
 
-static void __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self) {
+static void __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ctabix.pyx":371
+  /* "pysam/ctabix.pyx":371
  * 
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:             # <<<<<<<<<<<<<<
@@ -4977,7 +4982,7 @@ static void __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj
   __pyx_t_1 = (((void *)__pyx_v_self->iterator) != NULL);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":372
+    /* "pysam/ctabix.pyx":372
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:
  *             ti_iter_destroy(self.iterator)             # <<<<<<<<<<<<<<
@@ -4993,15 +4998,15 @@ static void __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5015,12 +5020,10 @@ static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyO
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5041,16 +5044,16 @@ static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyO
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.asTuple.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asTuple.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_7asTuple___call__(((struct __pyx_obj_6ctabix_asTuple *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_7asTuple___call__(((struct __pyx_obj_5pysam_6ctabix_asTuple *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":386
+/* "pysam/ctabix.pyx":386
  *     Access is by numeric index.
  *     '''
  *     def __call__(self, char * buffer, int len):             # <<<<<<<<<<<<<<
@@ -5058,8 +5061,8 @@ static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyO
  *         r = TabProxies.TupleProxy()
  */
 
-static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asTuple *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
-  struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_r = 0;
+static PyObject *__pyx_pf_5pysam_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asTuple *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
+  struct __pyx_obj_5pysam_10TabProxies_TupleProxy *__pyx_v_r = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5068,30 +5071,30 @@ static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_o
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__call__", 0);
 
-  /* "ctabix.pyx":388
+  /* "pysam/ctabix.pyx":388
  *     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 = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_10TabProxies_TupleProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_t_1);
+  __pyx_v_r = ((struct __pyx_obj_5pysam_10TabProxies_TupleProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":391
+  /* "pysam/ctabix.pyx":391
  *         # 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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":392
+  /* "pysam/ctabix.pyx":392
  *         # persistence issues with "present"
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -5107,7 +5110,7 @@ static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.asTuple.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asTuple.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_r);
@@ -5117,15 +5120,15 @@ static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_o
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5139,12 +5142,10 @@ static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5165,16 +5166,16 @@ static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.asGTF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asGTF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_5asGTF___call__(((struct __pyx_obj_6ctabix_asGTF *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_5asGTF___call__(((struct __pyx_obj_5pysam_6ctabix_asGTF *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":425
+/* "pysam/ctabix.pyx":425
  * 
  *     '''
  *     def __call__(self, char * buffer, int len):             # <<<<<<<<<<<<<<
@@ -5182,8 +5183,8 @@ static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObj
  *         r = TabProxies.GTFProxy()
  */
 
-static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asGTF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
-  struct __pyx_obj_10TabProxies_GTFProxy *__pyx_v_r = 0;
+static PyObject *__pyx_pf_5pysam_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asGTF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
+  struct __pyx_obj_5pysam_10TabProxies_GTFProxy *__pyx_v_r = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5192,30 +5193,30 @@ static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__call__", 0);
 
-  /* "ctabix.pyx":427
+  /* "pysam/ctabix.pyx":427
  *     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 = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_10TabProxies_GTFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); 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);
-  __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_t_1);
+  __pyx_v_r = ((struct __pyx_obj_5pysam_10TabProxies_GTFProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":428
+  /* "pysam/ctabix.pyx":428
  *         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 = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_5pysam_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":429
+  /* "pysam/ctabix.pyx":429
  *         r = TabProxies.GTFProxy()
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -5231,7 +5232,7 @@ static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.asGTF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asGTF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_r);
@@ -5241,15 +5242,15 @@ static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5263,12 +5264,10 @@ static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5289,16 +5288,16 @@ static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.asBed.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asBed.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_5asBed___call__(((struct __pyx_obj_6ctabix_asBed *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_5asBed___call__(((struct __pyx_obj_5pysam_6ctabix_asBed *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":465
+/* "pysam/ctabix.pyx":465
  * 
  *     '''
  *     def __call__(self, char * buffer, int len):             # <<<<<<<<<<<<<<
@@ -5306,8 +5305,8 @@ static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObj
  *         r = TabProxies.BedProxy()
  */
 
-static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asBed *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
-  struct __pyx_obj_10TabProxies_BedProxy *__pyx_v_r = 0;
+static PyObject *__pyx_pf_5pysam_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asBed *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
+  struct __pyx_obj_5pysam_10TabProxies_BedProxy *__pyx_v_r = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5316,30 +5315,30 @@ static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__call__", 0);
 
-  /* "ctabix.pyx":467
+  /* "pysam/ctabix.pyx":467
  *     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 = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_10TabProxies_BedProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_t_1);
+  __pyx_v_r = ((struct __pyx_obj_5pysam_10TabProxies_BedProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":468
+  /* "pysam/ctabix.pyx":468
  *         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 = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_5pysam_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":469
+  /* "pysam/ctabix.pyx":469
  *         r = TabProxies.BedProxy()
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -5355,7 +5354,7 @@ static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.asBed.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asBed.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_r);
@@ -5365,15 +5364,15 @@ static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5387,12 +5386,10 @@ static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5413,16 +5410,16 @@ static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.asVCF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asVCF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_5asVCF___call__(((struct __pyx_obj_6ctabix_asVCF *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_5asVCF___call__(((struct __pyx_obj_5pysam_6ctabix_asVCF *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":501
+/* "pysam/ctabix.pyx":501
  * 
  *     '''
  *     def __call__(self, char * buffer, int len ):             # <<<<<<<<<<<<<<
@@ -5430,8 +5427,8 @@ static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObj
  *         r = TabProxies.VCFProxy()
  */
 
-static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asVCF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
-  struct __pyx_obj_10TabProxies_VCFProxy *__pyx_v_r = 0;
+static PyObject *__pyx_pf_5pysam_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj_5pysam_6ctabix_asVCF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
+  struct __pyx_obj_5pysam_10TabProxies_VCFProxy *__pyx_v_r = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5440,30 +5437,30 @@ static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__call__", 0);
 
-  /* "ctabix.pyx":503
+  /* "pysam/ctabix.pyx":503
  *     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 = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_10TabProxies_VCFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); 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_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_t_1);
+  __pyx_v_r = ((struct __pyx_obj_5pysam_10TabProxies_VCFProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":504
+  /* "pysam/ctabix.pyx":504
  *         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 = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_5pysam_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":505
+  /* "pysam/ctabix.pyx":505
  *         r = TabProxies.VCFProxy()
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -5479,7 +5476,7 @@ static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.asVCF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.asVCF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_r);
@@ -5489,18 +5486,18 @@ static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj
 }
 
 /* Python wrapper */
-static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
+static int __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
   int __pyx_v_tid;
   int __pyx_v_start;
   int __pyx_v_end;
-  struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__parser,0};
+  struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__parser,0};
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5517,30 +5514,25 @@ static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_s
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __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--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __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--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __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--;
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5557,23 +5549,23 @@ static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_s
       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
     }
-    __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
+    __pyx_v_tabixfile = ((struct __pyx_obj_5pysam_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 = 518; __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 = 519; __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 = 520; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[4]);
+    __pyx_v_parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)values[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 = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixIteratorParsed.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __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 = 517; __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 = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self), __pyx_v_tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end, __pyx_v_parser);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_5pysam_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_5pysam_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed___cinit__(((struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)__pyx_v_self), __pyx_v_tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end, __pyx_v_parser);
   goto __pyx_L0;
   __pyx_L1_error:;
   __pyx_r = -1;
@@ -5582,7 +5574,7 @@ static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "ctabix.pyx":516
+/* "pysam/ctabix.pyx":516
  *     """
  * 
  *     def __cinit__(self,             # <<<<<<<<<<<<<<
@@ -5590,18 +5582,19 @@ static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_s
  *                   int tid,
  */
 
-static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser) {
+static int __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self, struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
+  tabix_t *__pyx_t_4;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":523
+  /* "pysam/ctabix.pyx":523
  *                   Parser parser ):
  * 
  *         assert tabixfile._isOpen()             # <<<<<<<<<<<<<<
@@ -5622,7 +5615,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   }
   #endif
 
-  /* "ctabix.pyx":524
+  /* "pysam/ctabix.pyx":524
  * 
  *         assert tabixfile._isOpen()
  *         self.parser = parser             # <<<<<<<<<<<<<<
@@ -5635,16 +5628,17 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   __Pyx_DECREF(((PyObject *)__pyx_v_self->parser));
   __pyx_v_self->parser = __pyx_v_parser;
 
-  /* "ctabix.pyx":528
+  /* "pysam/ctabix.pyx":528
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive.
  *         self.tabixfile = tabixfile.tabixfile             # <<<<<<<<<<<<<<
  * 
  *         if tid < 0:
  */
-  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
+  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
+  __pyx_v_self->tabixfile = __pyx_t_4;
 
-  /* "ctabix.pyx":530
+  /* "pysam/ctabix.pyx":530
  *         self.tabixfile = tabixfile.tabixfile
  * 
  *         if tid < 0:             # <<<<<<<<<<<<<<
@@ -5654,7 +5648,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   __pyx_t_3 = (__pyx_v_tid < 0);
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":533
+    /* "pysam/ctabix.pyx":533
  *             # seek to start of file to ensure iteration is over
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)             # <<<<<<<<<<<<<<
@@ -5663,7 +5657,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
  */
     bgzf_seek(__pyx_v_self->tabixfile->fp, 0, 0);
 
-    /* "ctabix.pyx":534
+    /* "pysam/ctabix.pyx":534
  *             # all entries.
  *             bgzf_seek( self.tabixfile.fp, 0, 0)
  *             self.iterator = ti_iter_first()             # <<<<<<<<<<<<<<
@@ -5675,7 +5669,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   }
   /*else*/ {
 
-    /* "ctabix.pyx":536
+    /* "pysam/ctabix.pyx":536
  *             self.iterator = ti_iter_first()
  *         else:
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)             # <<<<<<<<<<<<<<
@@ -5686,7 +5680,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":538
+  /* "pysam/ctabix.pyx":538
  *             self.iterator = ti_queryi(self.tabixfile, tid, start, end)
  * 
  *         if <void*>self.iterator == NULL:             # <<<<<<<<<<<<<<
@@ -5696,7 +5690,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   __pyx_t_3 = (((void *)__pyx_v_self->iterator) == NULL);
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":539
+    /* "pysam/ctabix.pyx":539
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
@@ -5717,7 +5711,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixIteratorParsed.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -5725,17 +5719,17 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_2__iter__(((struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":541
+/* "pysam/ctabix.pyx":541
  *             raise ValueError("malformatted query or wrong sequence name.\n")
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -5743,12 +5737,12 @@ static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":542
+  /* "pysam/ctabix.pyx":542
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -5768,19 +5762,21 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_o
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_19TabixIteratorParsed_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__;
-static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_19TabixIteratorParsed_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+#if CYTHON_COMPILING_IN_CPYTHON
+struct wrapperbase __pyx_wrapperbase_5pysam_6ctabix_19TabixIteratorParsed_4__next__;
+#endif
+static PyObject *__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_4__next__(((struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":544
+/* "pysam/ctabix.pyx":544
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -5788,7 +5784,7 @@ static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self) {
   char *__pyx_v_s;
   int __pyx_v_len;
   PyObject *__pyx_r = NULL;
@@ -5802,7 +5798,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":552
+  /* "pysam/ctabix.pyx":552
  *         cdef char * s
  *         cdef int len
  *         while 1:             # <<<<<<<<<<<<<<
@@ -5812,7 +5808,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
   while (1) {
     if (!1) break;
 
-    /* "ctabix.pyx":553
+    /* "pysam/ctabix.pyx":553
  *         cdef int len
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)             # <<<<<<<<<<<<<<
@@ -5821,7 +5817,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
  */
     __pyx_v_s = ti_read(__pyx_v_self->tabixfile, __pyx_v_self->iterator, (&__pyx_v_len));
 
-    /* "ctabix.pyx":554
+    /* "pysam/ctabix.pyx":554
  *         while 1:
  *             s = ti_read(self.tabixfile, self.iterator, &len)
  *             if s == NULL: raise StopIteration             # <<<<<<<<<<<<<<
@@ -5836,7 +5832,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":556
+    /* "pysam/ctabix.pyx":556
  *             if s == NULL: raise StopIteration
  *             # todo: read metachar from configuration
  *             if s[0] != '#': break             # <<<<<<<<<<<<<<
@@ -5852,7 +5848,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":558
+  /* "pysam/ctabix.pyx":558
  *             if s[0] != '#': break
  * 
  *         return self.parser(s, len)             # <<<<<<<<<<<<<<
@@ -5885,7 +5881,7 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.TabixIteratorParsed.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -5894,15 +5890,15 @@ static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_o
 }
 
 /* Python wrapper */
-static void __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self));
+  __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_6__dealloc__(((struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ctabix.pyx":560
+/* "pysam/ctabix.pyx":560
  *         return self.parser(s, len)
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -5910,12 +5906,12 @@ static void __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_
  *             ti_iter_destroy(self.iterator)
  */
 
-static void __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self) {
+static void __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ctabix.pyx":561
+  /* "pysam/ctabix.pyx":561
  * 
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:             # <<<<<<<<<<<<<<
@@ -5925,7 +5921,7 @@ static void __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj
   __pyx_t_1 = (((void *)__pyx_v_self->iterator) != NULL);
   if (__pyx_t_1) {
 
-    /* "ctabix.pyx":562
+    /* "pysam/ctabix.pyx":562
  *     def __dealloc__(self):
  *         if <void*>self.iterator != NULL:
  *             ti_iter_destroy(self.iterator)             # <<<<<<<<<<<<<<
@@ -5941,19 +5937,18 @@ static void __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_1tabix_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_1tabix_compress = {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pw_6ctabix_1tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_compress)};
-static PyObject *__pyx_pw_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_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_5pysam_6ctabix_1tabix_compress = {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pw_5pysam_6ctabix_1tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_tabix_compress)};
+static PyObject *__pyx_pw_5pysam_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename_in = 0;
   PyObject *__pyx_v_filename_out = 0;
   PyObject *__pyx_v_force = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("tabix_compress (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0};
     PyObject* values[3] = {0,0,0};
     values[2] = __pyx_k_30;
     if (unlikely(__pyx_kwds)) {
@@ -5969,12 +5964,10 @@ static PyObject *__pyx_pw_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -6004,16 +5997,16 @@ static PyObject *__pyx_pw_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.tabix_compress", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_compress", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_tabix_compress(__pyx_self, __pyx_v_filename_in, __pyx_v_filename_out, __pyx_v_force);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_tabix_compress(__pyx_self, __pyx_v_filename_in, __pyx_v_filename_out, __pyx_v_force);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":564
+/* "pysam/ctabix.pyx":564
  *             ti_iter_destroy(self.iterator)
  * 
  * def tabix_compress( filename_in,             # <<<<<<<<<<<<<<
@@ -6021,7 +6014,7 @@ static PyObject *__pyx_pw_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject
  *                     force = False ):
  */
 
-static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_in, PyObject *__pyx_v_filename_out, PyObject *__pyx_v_force) {
+static PyObject *__pyx_pf_5pysam_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_in, PyObject *__pyx_v_filename_out, PyObject *__pyx_v_force) {
   int __pyx_v_WINDOW_SIZE;
   int __pyx_v_c;
   int __pyx_v_r;
@@ -6045,7 +6038,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("tabix_compress", 0);
 
-  /* "ctabix.pyx":573
+  /* "pysam/ctabix.pyx":573
  *     '''
  * 
  *     if not force and os.path.exists(filename_out ):             # <<<<<<<<<<<<<<
@@ -6080,7 +6073,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   }
   if (__pyx_t_6) {
 
-    /* "ctabix.pyx":574
+    /* "pysam/ctabix.pyx":574
  * 
  *     if not force and os.path.exists(filename_out ):
  *         raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out)             # <<<<<<<<<<<<<<
@@ -6104,7 +6097,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":583
+  /* "pysam/ctabix.pyx":583
  * 
  *     cdef int O_RDONLY
  *     O_RDONLY = os.O_RDONLY             # <<<<<<<<<<<<<<
@@ -6120,7 +6113,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_O_RDONLY = __pyx_t_7;
 
-  /* "ctabix.pyx":585
+  /* "pysam/ctabix.pyx":585
  *     O_RDONLY = os.O_RDONLY
  * 
  *     WINDOW_SIZE = 64 * 1024             # <<<<<<<<<<<<<<
@@ -6129,19 +6122,19 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
   __pyx_v_WINDOW_SIZE = 65536;
 
-  /* "ctabix.pyx":587
+  /* "pysam/ctabix.pyx":587
  *     WINDOW_SIZE = 64 * 1024
  * 
  *     fn = _force_bytes(filename_out)             # <<<<<<<<<<<<<<
  *     fp = bgzf_open( fn, "w")
  *     if fp == NULL:
  */
-  __pyx_t_4 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_filename_out)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_6ctabix__force_bytes(__pyx_v_filename_out)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_v_fn = ((PyObject*)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "ctabix.pyx":588
+  /* "pysam/ctabix.pyx":588
  * 
  *     fn = _force_bytes(filename_out)
  *     fp = bgzf_open( fn, "w")             # <<<<<<<<<<<<<<
@@ -6151,7 +6144,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_8 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fp = bgzf_open(__pyx_t_8, __pyx_k__w);
 
-  /* "ctabix.pyx":589
+  /* "pysam/ctabix.pyx":589
  *     fn = _force_bytes(filename_out)
  *     fp = bgzf_open( fn, "w")
  *     if fp == NULL:             # <<<<<<<<<<<<<<
@@ -6161,7 +6154,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_6 = (__pyx_v_fp == NULL);
   if (__pyx_t_6) {
 
-    /* "ctabix.pyx":590
+    /* "pysam/ctabix.pyx":590
  *     fp = bgzf_open( fn, "w")
  *     if fp == NULL:
  *         raise IOError( "could not open '%s' for writing" )             # <<<<<<<<<<<<<<
@@ -6177,20 +6170,20 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":592
+  /* "pysam/ctabix.pyx":592
  *         raise IOError( "could not open '%s' for writing" )
  * 
  *     fn = _force_bytes(filename_in)             # <<<<<<<<<<<<<<
  *     fd_src = open(fn, O_RDONLY)
  *     if fd_src == 0:
  */
-  __pyx_t_4 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_filename_in)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_6ctabix__force_bytes(__pyx_v_filename_in)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_v_fn));
   __pyx_v_fn = ((PyObject*)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "ctabix.pyx":593
+  /* "pysam/ctabix.pyx":593
  * 
  *     fn = _force_bytes(filename_in)
  *     fd_src = open(fn, O_RDONLY)             # <<<<<<<<<<<<<<
@@ -6200,7 +6193,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_8 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fd_src = open(__pyx_t_8, __pyx_v_O_RDONLY);
 
-  /* "ctabix.pyx":594
+  /* "pysam/ctabix.pyx":594
  *     fn = _force_bytes(filename_in)
  *     fd_src = open(fn, O_RDONLY)
  *     if fd_src == 0:             # <<<<<<<<<<<<<<
@@ -6210,7 +6203,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_6 = (__pyx_v_fd_src == 0);
   if (__pyx_t_6) {
 
-    /* "ctabix.pyx":595
+    /* "pysam/ctabix.pyx":595
  *     fd_src = open(fn, O_RDONLY)
  *     if fd_src == 0:
  *         raise IOError( "could not open '%s' for reading" )             # <<<<<<<<<<<<<<
@@ -6226,7 +6219,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L5:;
 
-  /* "ctabix.pyx":597
+  /* "pysam/ctabix.pyx":597
  *         raise IOError( "could not open '%s' for reading" )
  * 
  *     buffer = malloc(WINDOW_SIZE)             # <<<<<<<<<<<<<<
@@ -6235,7 +6228,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
   __pyx_v_buffer = malloc(__pyx_v_WINDOW_SIZE);
 
-  /* "ctabix.pyx":598
+  /* "pysam/ctabix.pyx":598
  * 
  *     buffer = malloc(WINDOW_SIZE)
  *     c = 1             # <<<<<<<<<<<<<<
@@ -6244,7 +6237,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
   __pyx_v_c = 1;
 
-  /* "ctabix.pyx":600
+  /* "pysam/ctabix.pyx":600
  *     c = 1
  * 
  *     while c > 0:             # <<<<<<<<<<<<<<
@@ -6255,7 +6248,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
     __pyx_t_6 = (__pyx_v_c > 0);
     if (!__pyx_t_6) break;
 
-    /* "ctabix.pyx":601
+    /* "pysam/ctabix.pyx":601
  * 
  *     while c > 0:
  *         c = read(fd_src, buffer, WINDOW_SIZE)             # <<<<<<<<<<<<<<
@@ -6264,7 +6257,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_c = read(__pyx_v_fd_src, __pyx_v_buffer, __pyx_v_WINDOW_SIZE);
 
-    /* "ctabix.pyx":602
+    /* "pysam/ctabix.pyx":602
  *     while c > 0:
  *         c = read(fd_src, buffer, WINDOW_SIZE)
  *         r = bgzf_write(fp, buffer, c)             # <<<<<<<<<<<<<<
@@ -6273,7 +6266,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_r = bgzf_write(__pyx_v_fp, __pyx_v_buffer, __pyx_v_c);
 
-    /* "ctabix.pyx":603
+    /* "pysam/ctabix.pyx":603
  *         c = read(fd_src, buffer, WINDOW_SIZE)
  *         r = bgzf_write(fp, buffer, c)
  *         if r < 0:             # <<<<<<<<<<<<<<
@@ -6283,7 +6276,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
     __pyx_t_6 = (__pyx_v_r < 0);
     if (__pyx_t_6) {
 
-      /* "ctabix.pyx":604
+      /* "pysam/ctabix.pyx":604
  *         r = bgzf_write(fp, buffer, c)
  *         if r < 0:
  *             free( buffer )             # <<<<<<<<<<<<<<
@@ -6292,7 +6285,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
       free(__pyx_v_buffer);
 
-      /* "ctabix.pyx":605
+      /* "pysam/ctabix.pyx":605
  *         if r < 0:
  *             free( buffer )
  *             raise OSError("writing failed")             # <<<<<<<<<<<<<<
@@ -6309,7 +6302,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
     __pyx_L8:;
   }
 
-  /* "ctabix.pyx":607
+  /* "pysam/ctabix.pyx":607
  *             raise OSError("writing failed")
  * 
  *     free( buffer )             # <<<<<<<<<<<<<<
@@ -6318,7 +6311,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
   free(__pyx_v_buffer);
 
-  /* "ctabix.pyx":608
+  /* "pysam/ctabix.pyx":608
  * 
  *     free( buffer )
  *     r = bgzf_close(fp)             # <<<<<<<<<<<<<<
@@ -6327,7 +6320,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
  */
   __pyx_v_r = bgzf_close(__pyx_v_fp);
 
-  /* "ctabix.pyx":609
+  /* "pysam/ctabix.pyx":609
  *     free( buffer )
  *     r = bgzf_close(fp)
  *     if r < 0: raise OSError("writing failed")             # <<<<<<<<<<<<<<
@@ -6351,7 +6344,7 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("ctabix.tabix_compress", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_compress", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_fn);
@@ -6361,10 +6354,10 @@ static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_2tabix_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 met [...]
-static PyMethodDef __pyx_mdef_6ctabix_3tabix_index = {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pw_6ctabix_3tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_2tabix_index)};
-static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_2tabix_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 -  [...]
+static PyMethodDef __pyx_mdef_5pysam_6ctabix_3tabix_index = {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pw_5pysam_6ctabix_3tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_2tabix_index)};
+static PyObject *__pyx_pw_5pysam_6ctabix_3tabix_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;
@@ -6373,16 +6366,15 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
   PyObject *__pyx_v_preset = 0;
   PyObject *__pyx_v_meta_char = 0;
   PyObject *__pyx_v_zerobased = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__force,&__pyx_n_s__seq_col,&__pyx_n_s__start_col,&__pyx_n_s__end_col,&__pyx_n_s__preset,&__pyx_n_s__meta_char,&__pyx_n_s__zerobased,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("tabix_index (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__force,&__pyx_n_s__seq_col,&__pyx_n_s__start_col,&__pyx_n_s__end_col,&__pyx_n_s__preset,&__pyx_n_s__meta_char,&__pyx_n_s__zerobased,0};
     PyObject* values[8] = {0,0,0,0,0,0,0,0};
     values[1] = __pyx_k_39;
 
-    /* "ctabix.pyx":613
+    /* "pysam/ctabix.pyx":613
  * def tabix_index( filename,
  *                  force = False,
  *                  seq_col = None,             # <<<<<<<<<<<<<<
@@ -6391,7 +6383,7 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":614
+    /* "pysam/ctabix.pyx":614
  *                  force = False,
  *                  seq_col = None,
  *                  start_col = None,             # <<<<<<<<<<<<<<
@@ -6400,7 +6392,7 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":615
+    /* "pysam/ctabix.pyx":615
  *                  seq_col = None,
  *                  start_col = None,
  *                  end_col = None,             # <<<<<<<<<<<<<<
@@ -6409,7 +6401,7 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
  */
     values[4] = ((PyObject *)Py_None);
 
-    /* "ctabix.pyx":616
+    /* "pysam/ctabix.pyx":616
  *                  start_col = None,
  *                  end_col = None,
  *                  preset = None,             # <<<<<<<<<<<<<<
@@ -6437,8 +6429,7 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -6506,16 +6497,16 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("tabix_index", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_2tabix_index(__pyx_self, __pyx_v_filename, __pyx_v_force, __pyx_v_seq_col, __pyx_v_start_col, __pyx_v_end_col, __pyx_v_preset, __pyx_v_meta_char, __pyx_v_zerobased);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_2tabix_index(__pyx_self, __pyx_v_filename, __pyx_v_force, __pyx_v_seq_col, __pyx_v_start_col, __pyx_v_end_col, __pyx_v_preset, __pyx_v_meta_char, __pyx_v_zerobased);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":611
+/* "pysam/ctabix.pyx":611
  *     if r < 0: raise OSError("writing failed")
  * 
  * def tabix_index( filename,             # <<<<<<<<<<<<<<
@@ -6523,7 +6514,7 @@ static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *_
  *                  seq_col = None,
  */
 
-static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_force, PyObject *__pyx_v_seq_col, PyObject *__pyx_v_start_col, PyObject *__pyx_v_end_col, PyObject *__pyx_v_preset, PyObject *__pyx_v_meta_char, PyObject *__pyx_v_zerobased) {
+static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_force, PyObject *__pyx_v_seq_col, PyObject *__pyx_v_start_col, PyObject *__pyx_v_end_col, PyObject *__pyx_v_preset, PyObject *__pyx_v_meta_char, PyObject *__pyx_v_zerobased) {
   PyObject *__pyx_v_preset2conf = NULL;
   PyObject *__pyx_v_conf_data = NULL;
   ti_conf_t __pyx_v_conf;
@@ -6562,7 +6553,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_v_end_col);
   __Pyx_INCREF(__pyx_v_preset);
 
-  /* "ctabix.pyx":653
+  /* "pysam/ctabix.pyx":653
  *     '''
  * 
  *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)             # <<<<<<<<<<<<<<
@@ -6607,30 +6598,26 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":655
+  /* "pysam/ctabix.pyx":655
  *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
  * 
  *     if preset == None and (seq_col == None or start_col == None or end_col == None):             # <<<<<<<<<<<<<<
  *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
  * 
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_preset, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_preset, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __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 = 655; __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_seq_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_seq_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __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 = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (!__pyx_t_4) {
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_start_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_start_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __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 = 655; __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_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __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 = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __pyx_t_8 = __pyx_t_7;
@@ -6647,7 +6634,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   if (__pyx_t_4) {
 
-    /* "ctabix.pyx":656
+    /* "pysam/ctabix.pyx":656
  * 
  *     if preset == None and (seq_col == None or start_col == None or end_col == None):
  *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )             # <<<<<<<<<<<<<<
@@ -6663,7 +6650,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":658
+  /* "pysam/ctabix.pyx":658
  *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
  * 
  *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
@@ -6680,7 +6667,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_5 = (!__pyx_t_4);
   if (__pyx_t_5) {
 
-    /* "ctabix.pyx":659
+    /* "pysam/ctabix.pyx":659
  * 
  *     if not filename.endswith(".gz"):
  *         tabix_compress( filename, filename + ".gz", force = force )             # <<<<<<<<<<<<<<
@@ -6709,7 +6696,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-    /* "ctabix.pyx":660
+    /* "pysam/ctabix.pyx":660
  *     if not filename.endswith(".gz"):
  *         tabix_compress( filename, filename + ".gz", force = force )
  *         os.unlink( filename )             # <<<<<<<<<<<<<<
@@ -6732,7 +6719,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "ctabix.pyx":661
+    /* "pysam/ctabix.pyx":661
  *         tabix_compress( filename, filename + ".gz", force = force )
  *         os.unlink( filename )
  *         filename += ".gz"             # <<<<<<<<<<<<<<
@@ -6748,7 +6735,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   __pyx_L5:;
 
-  /* "ctabix.pyx":663
+  /* "pysam/ctabix.pyx":663
  *         filename += ".gz"
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):             # <<<<<<<<<<<<<<
@@ -6785,7 +6772,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   if (__pyx_t_6) {
 
-    /* "ctabix.pyx":664
+    /* "pysam/ctabix.pyx":664
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):
  *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
@@ -6801,7 +6788,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   __pyx_L6:;
 
-  /* "ctabix.pyx":669
+  /* "pysam/ctabix.pyx":669
  *     # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning
  *     # 0 is a missing column
  *     preset2conf = {             # <<<<<<<<<<<<<<
@@ -6811,7 +6798,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_9));
 
-  /* "ctabix.pyx":670
+  /* "pysam/ctabix.pyx":670
  *     # 0 is a missing column
  *     preset2conf = {
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),             # <<<<<<<<<<<<<<
@@ -6841,7 +6828,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":671
+  /* "pysam/ctabix.pyx":671
  *     preset2conf = {
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),             # <<<<<<<<<<<<<<
@@ -6871,7 +6858,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":672
+  /* "pysam/ctabix.pyx":672
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),             # <<<<<<<<<<<<<<
@@ -6901,7 +6888,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":673
+  /* "pysam/ctabix.pyx":673
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
@@ -6931,7 +6918,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":674
+  /* "pysam/ctabix.pyx":674
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
@@ -6961,7 +6948,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":675
+  /* "pysam/ctabix.pyx":675
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
@@ -6993,7 +6980,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_v_preset2conf = __pyx_t_9;
   __pyx_t_9 = 0;
 
-  /* "ctabix.pyx":678
+  /* "pysam/ctabix.pyx":678
  *         }
  * 
  *     if preset:             # <<<<<<<<<<<<<<
@@ -7003,7 +6990,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_6) {
 
-    /* "ctabix.pyx":679
+    /* "pysam/ctabix.pyx":679
  * 
  *     if preset:
  *         try:             # <<<<<<<<<<<<<<
@@ -7017,7 +7004,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
       __Pyx_XGOTREF(__pyx_t_12);
       /*try:*/ {
 
-        /* "ctabix.pyx":680
+        /* "pysam/ctabix.pyx":680
  *     if preset:
  *         try:
  *             conf_data = preset2conf[preset]             # <<<<<<<<<<<<<<
@@ -7039,7 +7026,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-      /* "ctabix.pyx":681
+      /* "pysam/ctabix.pyx":681
  *         try:
  *             conf_data = preset2conf[preset]
  *         except KeyError:             # <<<<<<<<<<<<<<
@@ -7048,13 +7035,13 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
  */
       __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
       if (__pyx_t_13) {
-        __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
+        __Pyx_AddTraceback("pysam.ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
         if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_GOTREF(__pyx_t_1);
 
-        /* "ctabix.pyx":682
+        /* "pysam/ctabix.pyx":682
  *             conf_data = preset2conf[preset]
  *         except KeyError:
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))             # <<<<<<<<<<<<<<
@@ -7118,15 +7105,14 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   /*else*/ {
 
-    /* "ctabix.pyx":684
+    /* "pysam/ctabix.pyx":684
  *             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_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_6) {
@@ -7137,7 +7123,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     }
     __pyx_L18:;
 
-    /* "ctabix.pyx":685
+    /* "pysam/ctabix.pyx":685
  *     else:
  *         if end_col == None: end_col = -1
  *         preset = 0             # <<<<<<<<<<<<<<
@@ -7148,7 +7134,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     __Pyx_DECREF(__pyx_v_preset);
     __pyx_v_preset = __pyx_int_0;
 
-    /* "ctabix.pyx":692
+    /* "pysam/ctabix.pyx":692
  *         # -1 is subtracted from the start coordinate. To avoid doing this, set
  *         # the TI_FLAG_UCSC=0x10000 flag:
  *         if zerobased: preset = preset | 0x10000             # <<<<<<<<<<<<<<
@@ -7166,7 +7152,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     }
     __pyx_L19:;
 
-    /* "ctabix.pyx":694
+    /* "pysam/ctabix.pyx":694
  *         if zerobased: preset = preset | 0x10000
  * 
  *         conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)             # <<<<<<<<<<<<<<
@@ -7212,7 +7198,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   }
   __pyx_L7:;
 
-  /* "ctabix.pyx":697
+  /* "pysam/ctabix.pyx":697
  * 
  *     cdef ti_conf_t conf
  *     conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data             # <<<<<<<<<<<<<<
@@ -7221,12 +7207,18 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
  */
   if ((likely(PyTuple_CheckExact(__pyx_v_conf_data))) || (PyList_CheckExact(__pyx_v_conf_data))) {
     PyObject* sequence = __pyx_v_conf_data;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    Py_ssize_t size = Py_SIZE(sequence);
+    #else
+    Py_ssize_t size = PySequence_Size(sequence);
+    #endif
+    if (unlikely(size != 6)) {
+      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
+      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
-      if (unlikely(PyTuple_GET_SIZE(sequence) != 6)) {
-        if (PyTuple_GET_SIZE(sequence) > 6) __Pyx_RaiseTooManyValuesError(6);
-        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
       __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
@@ -7234,11 +7226,6 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 4); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 5); 
     } else {
-      if (unlikely(PyList_GET_SIZE(sequence) != 6)) {
-        if (PyList_GET_SIZE(sequence) > 6) __Pyx_RaiseTooManyValuesError(6);
-        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
       __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
@@ -7252,30 +7239,34 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     __Pyx_INCREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_t_2);
-  } else {
+    #else
+    Py_ssize_t i;
+    PyObject** temps[6] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_9,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
+    for (i=0; i < 6; i++) {
+      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      *(temps[i]) = item;
+    }
+    #endif
+  } else
+  {
     Py_ssize_t index = -1;
-    __pyx_t_16 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_16);
-    __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
-    index = 0; __pyx_t_14 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L20_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_14);
-    index = 1; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L20_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_15);
-    index = 2; __pyx_t_9 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_9)) goto __pyx_L20_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_9);
-    index = 3; __pyx_t_3 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 4; __pyx_t_1 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_1);
-    index = 5; __pyx_t_2 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_2);
+    PyObject** temps[6] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_9,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
+    __pyx_t_16 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_16);
+    __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
+    for (index=0; index < 6; index++) {
+      PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L20_unpacking_failed;
+      __Pyx_GOTREF(item);
+      *(temps[index]) = item;
+    }
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = NULL;
     __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
     goto __pyx_L21_unpacking_done;
     __pyx_L20_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+    __pyx_t_17 = NULL;
+    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L21_unpacking_done:;
   }
@@ -7298,19 +7289,19 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_v_conf.meta_char = __pyx_t_22;
   __pyx_v_conf.line_skip = __pyx_t_23;
 
-  /* "ctabix.pyx":699
+  /* "pysam/ctabix.pyx":699
  *     conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data
  * 
  *     fn = _my_encodeFilename( filename )             # <<<<<<<<<<<<<<
  *     ti_index_build( fn, &conf)
  * 
  */
-  __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_v_fn = ((PyObject*)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":700
+  /* "pysam/ctabix.pyx":700
  * 
  *     fn = _my_encodeFilename( filename )
  *     ti_index_build( fn, &conf)             # <<<<<<<<<<<<<<
@@ -7320,7 +7311,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_24 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_24) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   ti_index_build(__pyx_t_24, (&__pyx_v_conf));
 
-  /* "ctabix.pyx":702
+  /* "pysam/ctabix.pyx":702
  *     ti_index_build( fn, &conf)
  * 
  *     return filename             # <<<<<<<<<<<<<<
@@ -7342,7 +7333,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
   __Pyx_XDECREF(__pyx_t_16);
-  __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_preset2conf);
@@ -7357,15 +7348,15 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
 }
 
 /* Python wrapper */
-static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_infile = 0;
   int __pyx_v_buffer_size;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__buffer_size,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__buffer_size,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -7379,8 +7370,7 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -7391,10 +7381,6 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
       if (unlikely(kw_args > 0)) {
         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
-      if (values[1]) {
-      } else {
-        __pyx_v_buffer_size = ((int)65536);
-      }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -7414,16 +7400,16 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_buffer_size);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator___cinit__(((struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_buffer_size);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":719
+/* "pysam/ctabix.pyx":719
  * 
  * 
  *     def __cinit__(self, infile, int buffer_size = 65536 ):             # <<<<<<<<<<<<<<
@@ -7431,7 +7417,7 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  */
 
-static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self, PyObject *__pyx_v_infile, int __pyx_v_buffer_size) {
+static int __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self, PyObject *__pyx_v_infile, int __pyx_v_buffer_size) {
   int __pyx_v_fd;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
@@ -7443,7 +7429,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":721
+  /* "pysam/ctabix.pyx":721
  *     def __cinit__(self, infile, int buffer_size = 65536 ):
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )             # <<<<<<<<<<<<<<
@@ -7453,7 +7439,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
   __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fd = __pyx_t_1;
 
-  /* "ctabix.pyx":722
+  /* "pysam/ctabix.pyx":722
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -7471,7 +7457,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":723
+  /* "pysam/ctabix.pyx":723
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')             # <<<<<<<<<<<<<<
@@ -7480,7 +7466,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
  */
   __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
 
-  /* "ctabix.pyx":725
+  /* "pysam/ctabix.pyx":725
  *         self.infile = fdopen( fd, 'r')
  * 
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -7498,7 +7484,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":727
+  /* "pysam/ctabix.pyx":727
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
  * 
  *         self.buffer = <char*>malloc( buffer_size )             # <<<<<<<<<<<<<<
@@ -7507,7 +7493,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
  */
   __pyx_v_self->buffer = ((char *)malloc(__pyx_v_buffer_size));
 
-  /* "ctabix.pyx":728
+  /* "pysam/ctabix.pyx":728
  * 
  *         self.buffer = <char*>malloc( buffer_size )
  *         self.size = buffer_size             # <<<<<<<<<<<<<<
@@ -7520,7 +7506,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -7528,17 +7514,17 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_2__iter__(((struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":730
+/* "pysam/ctabix.pyx":730
  *         self.size = buffer_size
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -7546,12 +7532,12 @@ static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *_
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":731
+  /* "pysam/ctabix.pyx":731
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -7570,7 +7556,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __py
   return __pyx_r;
 }
 
-/* "ctabix.pyx":733
+/* "pysam/ctabix.pyx":733
  *         return self
  * 
  *     cdef __cnext__(self):             # <<<<<<<<<<<<<<
@@ -7578,51 +7564,53 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __py
  *         cdef char * b
  */
 
-static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
   char *__pyx_v_b;
   size_t __pyx_v_nbytes;
   PyObject *__pyx_v_r = NULL;
   char *__pyx_v_result;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  char *__pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   int __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
+  int __pyx_t_7;
   PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cnext__", 0);
 
-  /* "ctabix.pyx":737
+  /* "pysam/ctabix.pyx":737
  *         cdef char * b
  *         cdef size_t nbytes
  *         b = self.buffer             # <<<<<<<<<<<<<<
  *         r = self.Parser()
  * 
  */
-  __pyx_v_b = __pyx_v_self->buffer;
+  __pyx_t_1 = __pyx_v_self->buffer;
+  __pyx_v_b = __pyx_t_1;
 
-  /* "ctabix.pyx":738
+  /* "pysam/ctabix.pyx":738
  *         cdef size_t nbytes
  *         b = self.buffer
  *         r = self.Parser()             # <<<<<<<<<<<<<<
  * 
  *         while not feof( self.infile ):
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__Parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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 = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__Parser); 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);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_r = __pyx_t_2;
-  __pyx_t_2 = 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 = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_r = __pyx_t_3;
+  __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":740
+  /* "pysam/ctabix.pyx":740
  *         r = self.Parser()
  * 
  *         while not feof( self.infile ):             # <<<<<<<<<<<<<<
@@ -7630,10 +7618,10 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  * 
  */
   while (1) {
-    __pyx_t_3 = (!feof(__pyx_v_self->infile));
-    if (!__pyx_t_3) break;
+    __pyx_t_4 = (!feof(__pyx_v_self->infile));
+    if (!__pyx_t_4) break;
 
-    /* "ctabix.pyx":741
+    /* "pysam/ctabix.pyx":741
  * 
  *         while not feof( self.infile ):
  *             nbytes = getline( &b, &self.size, self.infile)             # <<<<<<<<<<<<<<
@@ -7642,77 +7630,77 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  */
     __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_self->size), __pyx_v_self->infile);
 
-    /* "ctabix.pyx":744
+    /* "pysam/ctabix.pyx":744
  * 
  *             # stop at first error or eof
  *             if (nbytes == -1): break             # <<<<<<<<<<<<<<
  *             # skip comments
  *             if (b[0] == '#'): continue
  */
-    __pyx_t_3 = (__pyx_v_nbytes == -1);
-    if (__pyx_t_3) {
+    __pyx_t_4 = (__pyx_v_nbytes == -1);
+    if (__pyx_t_4) {
       goto __pyx_L4_break;
       goto __pyx_L5;
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":746
+    /* "pysam/ctabix.pyx":746
  *             if (nbytes == -1): break
  *             # skip comments
  *             if (b[0] == '#'): continue             # <<<<<<<<<<<<<<
  * 
  *             # skip empty lines
  */
-    __pyx_t_3 = ((__pyx_v_b[0]) == '#');
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_b[0]) == '#');
+    if (__pyx_t_4) {
       goto __pyx_L3_continue;
       goto __pyx_L6;
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":749
+    /* "pysam/ctabix.pyx":749
  * 
  *             # skip empty lines
  *             if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue             # <<<<<<<<<<<<<<
  * 
  *             # make sure that entry is complete
  */
-    __pyx_t_3 = ((__pyx_v_b[0]) == '\x00');
-    if (!__pyx_t_3) {
-      __pyx_t_4 = ((__pyx_v_b[0]) == '\n');
-      if (!__pyx_t_4) {
-        __pyx_t_5 = ((__pyx_v_b[0]) == '\r');
-        __pyx_t_6 = __pyx_t_5;
+    __pyx_t_4 = ((__pyx_v_b[0]) == '\x00');
+    if (!__pyx_t_4) {
+      __pyx_t_5 = ((__pyx_v_b[0]) == '\n');
+      if (!__pyx_t_5) {
+        __pyx_t_6 = ((__pyx_v_b[0]) == '\r');
+        __pyx_t_7 = __pyx_t_6;
       } else {
-        __pyx_t_6 = __pyx_t_4;
+        __pyx_t_7 = __pyx_t_5;
       }
-      __pyx_t_4 = __pyx_t_6;
+      __pyx_t_5 = __pyx_t_7;
     } else {
-      __pyx_t_4 = __pyx_t_3;
+      __pyx_t_5 = __pyx_t_4;
     }
-    if (__pyx_t_4) {
+    if (__pyx_t_5) {
       goto __pyx_L3_continue;
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":752
+    /* "pysam/ctabix.pyx":752
  * 
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':             # <<<<<<<<<<<<<<
  *                 result = b
  *                 raise ValueError( "incomplete line at %s" % result )
  */
-    __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
-    if (__pyx_t_4) {
-      __pyx_t_3 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
-      __pyx_t_6 = __pyx_t_3;
+    __pyx_t_5 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
+    if (__pyx_t_5) {
+      __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
+      __pyx_t_7 = __pyx_t_4;
     } else {
-      __pyx_t_6 = __pyx_t_4;
+      __pyx_t_7 = __pyx_t_5;
     }
-    if (__pyx_t_6) {
+    if (__pyx_t_7) {
 
-      /* "ctabix.pyx":753
+      /* "pysam/ctabix.pyx":753
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b             # <<<<<<<<<<<<<<
@@ -7721,61 +7709,61 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  */
       __pyx_v_result = __pyx_v_b;
 
-      /* "ctabix.pyx":754
+      /* "pysam/ctabix.pyx":754
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b
  *                 raise ValueError( "incomplete line at %s" % result )             # <<<<<<<<<<<<<<
  * 
  *             # make sure that this goes fully through C
  */
-      __pyx_t_2 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__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 = 754; __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 = 754; __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, ((PyObject *)__pyx_t_3), NULL); 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);
-      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, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":760
+    /* "pysam/ctabix.pyx":760
  *             # Python object causing segfaults as
  *             # the wrong memory is freed
  *             r.present( b, nbytes )             # <<<<<<<<<<<<<<
  *             return r
  * 
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__present); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __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 = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__present); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __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));
-    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
-    __Pyx_GIVEREF(__pyx_t_7);
-    __pyx_t_2 = 0;
-    __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 = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
+    __Pyx_GIVEREF(__pyx_t_8);
+    __pyx_t_3 = 0;
+    __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-    /* "ctabix.pyx":761
+    /* "pysam/ctabix.pyx":761
  *             # the wrong memory is freed
  *             r.present( b, nbytes )
  *             return r             # <<<<<<<<<<<<<<
@@ -7790,7 +7778,7 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":763
+  /* "pysam/ctabix.pyx":763
  *             return r
  * 
  *         raise StopIteration             # <<<<<<<<<<<<<<
@@ -7803,11 +7791,11 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
   __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_7);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_inplace_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_r);
@@ -7817,15 +7805,15 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
 }
 
 /* Python wrapper */
-static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
+  __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_4__dealloc__(((struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ctabix.pyx":765
+/* "pysam/ctabix.pyx":765
  *         raise StopIteration
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -7833,11 +7821,11 @@ static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__p
  * 
  */
 
-static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+static void __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ctabix.pyx":766
+  /* "pysam/ctabix.pyx":766
  * 
  *     def __dealloc__(self):
  *         free(self.buffer)             # <<<<<<<<<<<<<<
@@ -7850,17 +7838,17 @@ static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_6__next__(((struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":768
+/* "pysam/ctabix.pyx":768
  *         free(self.buffer)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -7868,7 +7856,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *_
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -7877,7 +7865,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __py
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":769
+  /* "pysam/ctabix.pyx":769
  * 
  *     def __next__(self):
  *         return self.__cnext__()             # <<<<<<<<<<<<<<
@@ -7885,7 +7873,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __py
  * ctypedef class tabix_copy_iterator:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -7895,7 +7883,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_inplace_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -7904,15 +7892,15 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __py
 }
 
 /* Python wrapper */
-static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_infile = 0;
-  struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
+  struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -7926,12 +7914,10 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -7946,18 +7932,18 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
     }
     __pyx_v_infile = values[0];
-    __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[1]);
+    __pyx_v_parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)values[1]);
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_parser);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_5pysam_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19tabix_copy_iterator___cinit__(((struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_parser);
   goto __pyx_L0;
   __pyx_L1_error:;
   __pyx_r = -1;
@@ -7966,7 +7952,7 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "ctabix.pyx":780
+/* "pysam/ctabix.pyx":780
  *     '''
  * 
  *     def __cinit__(self, infile, Parser parser ):             # <<<<<<<<<<<<<<
@@ -7974,7 +7960,7 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  */
 
-static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self, PyObject *__pyx_v_infile, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser) {
+static int __pyx_pf_5pysam_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self, PyObject *__pyx_v_infile, struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser) {
   int __pyx_v_fd;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
@@ -7986,7 +7972,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":782
+  /* "pysam/ctabix.pyx":782
  *     def __cinit__(self, infile, Parser parser ):
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )             # <<<<<<<<<<<<<<
@@ -7996,7 +7982,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
   __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fd = __pyx_t_1;
 
-  /* "ctabix.pyx":783
+  /* "pysam/ctabix.pyx":783
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -8014,7 +8000,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":784
+  /* "pysam/ctabix.pyx":784
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')             # <<<<<<<<<<<<<<
@@ -8023,7 +8009,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
  */
   __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
 
-  /* "ctabix.pyx":785
+  /* "pysam/ctabix.pyx":785
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -8041,7 +8027,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":786
+  /* "pysam/ctabix.pyx":786
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
  *         self.parser = parser             # <<<<<<<<<<<<<<
@@ -8058,7 +8044,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -8066,17 +8052,17 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19tabix_copy_iterator_2__iter__(((struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":788
+/* "pysam/ctabix.pyx":788
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -8084,12 +8070,12 @@ static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":789
+  /* "pysam/ctabix.pyx":789
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -8108,7 +8094,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_o
   return __pyx_r;
 }
 
-/* "ctabix.pyx":791
+/* "pysam/ctabix.pyx":791
  *         return self
  * 
  *     cdef __cnext__(self):             # <<<<<<<<<<<<<<
@@ -8116,7 +8102,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_o
  *         cdef char * b
  */
 
-static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
+static PyObject *__pyx_f_5pysam_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self) {
   char *__pyx_v_b;
   size_t __pyx_v_nbytes;
   char *__pyx_v_result;
@@ -8134,7 +8120,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cnext__", 0);
 
-  /* "ctabix.pyx":797
+  /* "pysam/ctabix.pyx":797
  *         cdef int x
  * 
  *         b = NULL             # <<<<<<<<<<<<<<
@@ -8143,7 +8129,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
   __pyx_v_b = NULL;
 
-  /* "ctabix.pyx":799
+  /* "pysam/ctabix.pyx":799
  *         b = NULL
  * 
  *         while not feof( self.infile ):             # <<<<<<<<<<<<<<
@@ -8154,7 +8140,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     __pyx_t_1 = (!feof(__pyx_v_self->infile));
     if (!__pyx_t_1) break;
 
-    /* "ctabix.pyx":803
+    /* "pysam/ctabix.pyx":803
  *             # getline allocates on demand
  *             # return number of characters read excluding null byte
  *             nbytes = getline( &b, &nbytes, self.infile)             # <<<<<<<<<<<<<<
@@ -8163,7 +8149,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
     __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_nbytes), __pyx_v_self->infile);
 
-    /* "ctabix.pyx":805
+    /* "pysam/ctabix.pyx":805
  *             nbytes = getline( &b, &nbytes, self.infile)
  *             # stop at first error
  *             if (nbytes == -1): break             # <<<<<<<<<<<<<<
@@ -8177,7 +8163,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":807
+    /* "pysam/ctabix.pyx":807
  *             if (nbytes == -1): break
  *             # skip comments
  *             if (b[0] == '#'): continue             # <<<<<<<<<<<<<<
@@ -8191,7 +8177,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":810
+    /* "pysam/ctabix.pyx":810
  * 
  *             # skip empty lines
  *             if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue             # <<<<<<<<<<<<<<
@@ -8217,7 +8203,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":813
+    /* "pysam/ctabix.pyx":813
  * 
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':             # <<<<<<<<<<<<<<
@@ -8233,7 +8219,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     if (__pyx_t_4) {
 
-      /* "ctabix.pyx":814
+      /* "pysam/ctabix.pyx":814
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b             # <<<<<<<<<<<<<<
@@ -8242,7 +8228,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
       __pyx_v_result = __pyx_v_b;
 
-      /* "ctabix.pyx":815
+      /* "pysam/ctabix.pyx":815
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b
  *                 free(b)             # <<<<<<<<<<<<<<
@@ -8251,7 +8237,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
       free(__pyx_v_b);
 
-      /* "ctabix.pyx":816
+      /* "pysam/ctabix.pyx":816
  *                 result = b
  *                 free(b)
  *                 raise ValueError( "incomplete line at %s" % result )             # <<<<<<<<<<<<<<
@@ -8278,7 +8264,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":823
+    /* "pysam/ctabix.pyx":823
  *             # the wrong memory is freed
  *             # -1 to remove the new-line character
  *             return self.parser(b, nbytes)             # <<<<<<<<<<<<<<
@@ -8308,7 +8294,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":825
+  /* "pysam/ctabix.pyx":825
  *             return self.parser(b, nbytes)
  * 
  *         free(b)             # <<<<<<<<<<<<<<
@@ -8317,7 +8303,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
   free(__pyx_v_b);
 
-  /* "ctabix.pyx":826
+  /* "pysam/ctabix.pyx":826
  * 
  *         free(b)
  *         raise StopIteration             # <<<<<<<<<<<<<<
@@ -8333,7 +8319,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_copy_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -8342,17 +8328,17 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_19tabix_copy_iterator_4__next__(((struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":828
+/* "pysam/ctabix.pyx":828
  *         raise StopIteration
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -8360,7 +8346,7 @@ static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -8369,7 +8355,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_o
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":829
+  /* "pysam/ctabix.pyx":829
  * 
  *     def __next__(self):
  *         return self.__cnext__()             # <<<<<<<<<<<<<<
@@ -8377,7 +8363,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_o
  * class tabix_generic_iterator:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -8387,7 +8373,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_copy_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -8396,19 +8382,18 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_o
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_22tabix_generic_iterator___init__[] = "tabix_generic_iterator.__init__(self, infile, parser)";
-static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator___init__)};
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_22tabix_generic_iterator___init__[] = "tabix_generic_iterator.__init__(self, infile, parser)";
+static PyMethodDef __pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_22tabix_generic_iterator___init__)};
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_infile = 0;
   PyObject *__pyx_v_parser = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__infile,&__pyx_n_s__parser,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__infile,&__pyx_n_s__parser,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8423,18 +8408,15 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8457,16 +8439,16 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator___init__(__pyx_self, __pyx_v_self, __pyx_v_infile, __pyx_v_parser);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator___init__(__pyx_self, __pyx_v_self, __pyx_v_infile, __pyx_v_parser);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":836
+/* "pysam/ctabix.pyx":836
  *     Permits the use of file-like objects for example from the gzip module.
  *     '''
  *     def __init__(self, infile, parser ):             # <<<<<<<<<<<<<<
@@ -8474,7 +8456,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *_
  *         self.infile = infile
  */
 
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -8485,7 +8467,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSE
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__init__", 0);
 
-  /* "ctabix.pyx":838
+  /* "pysam/ctabix.pyx":838
  *     def __init__(self, infile, parser ):
  * 
  *         self.infile = infile             # <<<<<<<<<<<<<<
@@ -8494,7 +8476,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSE
  */
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__infile, __pyx_v_infile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":839
+  /* "pysam/ctabix.pyx":839
  * 
  *         self.infile = infile
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -8518,7 +8500,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSE
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":840
+  /* "pysam/ctabix.pyx":840
  *         self.infile = infile
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )
  *         self.parser = parser             # <<<<<<<<<<<<<<
@@ -8532,7 +8514,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSE
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -8541,20 +8523,19 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSE
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_22tabix_generic_iterator_2__iter__[] = "tabix_generic_iterator.__iter__(self)";
-static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_3__iter__ = {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__, METH_O, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator_2__iter__)};
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_22tabix_generic_iterator_2__iter__[] = "tabix_generic_iterator.__iter__(self)";
+static PyMethodDef __pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_3__iter__ = {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_3__iter__, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_22tabix_generic_iterator_2__iter__)};
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":842
+/* "pysam/ctabix.pyx":842
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -8562,12 +8543,12 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *_
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":843
+  /* "pysam/ctabix.pyx":843
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -8587,20 +8568,19 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUS
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_22tabix_generic_iterator_4__next__[] = "tabix_generic_iterator.__next__(self)";
-static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_5__next__ = {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__, METH_O, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator_4__next__)};
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_22tabix_generic_iterator_4__next__[] = "tabix_generic_iterator.__next__(self)";
+static PyMethodDef __pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_5__next__ = {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_5__next__, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_22tabix_generic_iterator_4__next__)};
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_4__next__(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":846
+/* "pysam/ctabix.pyx":846
  * 
  *     # cython version - required for python 3
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -8608,7 +8588,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *_
  *         cdef char * b, * cpy
  */
 
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   char *__pyx_v_b;
   char *__pyx_v_cpy;
   size_t __pyx_v_nbytes;
@@ -8631,7 +8611,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":850
+  /* "pysam/ctabix.pyx":850
  *         cdef char * b, * cpy
  *         cdef size_t nbytes
  *         while 1:             # <<<<<<<<<<<<<<
@@ -8641,7 +8621,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   while (1) {
     if (!1) break;
 
-    /* "ctabix.pyx":852
+    /* "pysam/ctabix.pyx":852
  *         while 1:
  * 
  *             line = self.infile.readline()             # <<<<<<<<<<<<<<
@@ -8660,7 +8640,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     __pyx_v_line = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "ctabix.pyx":853
+    /* "pysam/ctabix.pyx":853
  * 
  *             line = self.infile.readline()
  *             if not line: break             # <<<<<<<<<<<<<<
@@ -8675,20 +8655,20 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":855
+    /* "pysam/ctabix.pyx":855
  *             if not line: break
  * 
  *             s = _force_bytes( line )             # <<<<<<<<<<<<<<
  *             b = s
  *             nbytes = len( line )
  */
-    __pyx_t_1 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_line)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_6ctabix__force_bytes(__pyx_v_line)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_XDECREF(((PyObject *)__pyx_v_s));
     __pyx_v_s = ((PyObject*)__pyx_t_1);
     __pyx_t_1 = 0;
 
-    /* "ctabix.pyx":856
+    /* "pysam/ctabix.pyx":856
  * 
  *             s = _force_bytes( line )
  *             b = s             # <<<<<<<<<<<<<<
@@ -8698,7 +8678,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_s)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_b = __pyx_t_5;
 
-    /* "ctabix.pyx":857
+    /* "pysam/ctabix.pyx":857
  *             s = _force_bytes( line )
  *             b = s
  *             nbytes = len( line )             # <<<<<<<<<<<<<<
@@ -8708,7 +8688,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     __pyx_t_6 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_nbytes = __pyx_t_6;
 
-    /* "ctabix.pyx":858
+    /* "pysam/ctabix.pyx":858
  *             b = s
  *             nbytes = len( line )
  *             assert b[nbytes] == '\0'             # <<<<<<<<<<<<<<
@@ -8722,7 +8702,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     #endif
 
-    /* "ctabix.pyx":861
+    /* "pysam/ctabix.pyx":861
  * 
  *             # skip comments
  *             if (b[0] == '#'): continue             # <<<<<<<<<<<<<<
@@ -8736,7 +8716,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":864
+    /* "pysam/ctabix.pyx":864
  * 
  *             # skip empty lines
  *             if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue             # <<<<<<<<<<<<<<
@@ -8762,7 +8742,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":867
+    /* "pysam/ctabix.pyx":867
  * 
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':             # <<<<<<<<<<<<<<
@@ -8778,7 +8758,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     if (__pyx_t_8) {
 
-      /* "ctabix.pyx":868
+      /* "pysam/ctabix.pyx":868
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 raise ValueError( "incomplete line at %s" % line )             # <<<<<<<<<<<<<<
@@ -8802,7 +8782,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":871
+    /* "pysam/ctabix.pyx":871
  * 
  *             # create a copy
  *             cpy = <char*>malloc(nbytes+1)             # <<<<<<<<<<<<<<
@@ -8811,7 +8791,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  */
     __pyx_v_cpy = ((char *)malloc((__pyx_v_nbytes + 1)));
 
-    /* "ctabix.pyx":872
+    /* "pysam/ctabix.pyx":872
  *             # create a copy
  *             cpy = <char*>malloc(nbytes+1)
  *             if cpy == NULL: raise MemoryError()             # <<<<<<<<<<<<<<
@@ -8825,7 +8805,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L9:;
 
-    /* "ctabix.pyx":873
+    /* "pysam/ctabix.pyx":873
  *             cpy = <char*>malloc(nbytes+1)
  *             if cpy == NULL: raise MemoryError()
  *             memcpy( cpy, b, nbytes+1)             # <<<<<<<<<<<<<<
@@ -8834,7 +8814,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  */
     memcpy(__pyx_v_cpy, __pyx_v_b, (__pyx_v_nbytes + 1));
 
-    /* "ctabix.pyx":875
+    /* "pysam/ctabix.pyx":875
  *             memcpy( cpy, b, nbytes+1)
  * 
  *             return self.parser(cpy, nbytes)             # <<<<<<<<<<<<<<
@@ -8867,7 +8847,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":877
+  /* "pysam/ctabix.pyx":877
  *             return self.parser(cpy, nbytes)
  * 
  *         raise StopIteration             # <<<<<<<<<<<<<<
@@ -8884,7 +8864,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_generic_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_line);
@@ -8895,20 +8875,19 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_6ctabix_22tabix_generic_iterator_6next[] = "tabix_generic_iterator.next(self)";
-static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_7next = {__Pyx_NAMESTR("next"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_7next, METH_O, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator_6next)};
-static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_22tabix_generic_iterator_6next[] = "tabix_generic_iterator.next(self)";
+static PyMethodDef __pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_7next = {__Pyx_NAMESTR("next"), (PyCFunction)__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_7next, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_22tabix_generic_iterator_6next)};
+static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("next (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_6next(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_6next(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":880
+/* "pysam/ctabix.pyx":880
  * 
  *     # python version - required for python 2.7
  *     def next(self):             # <<<<<<<<<<<<<<
@@ -8916,7 +8895,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx
  * 
  */
 
-static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -8926,7 +8905,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED P
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("next", 0);
 
-  /* "ctabix.pyx":881
+  /* "pysam/ctabix.pyx":881
  *     # python version - required for python 2.7
  *     def next(self):
  *         return self.__next__()             # <<<<<<<<<<<<<<
@@ -8948,7 +8927,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED P
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("ctabix.tabix_generic_iterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_generic_iterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -8957,18 +8936,17 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED P
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_6ctabix_4tabix_iterator[] = "tabix_iterator(infile, parser)\nreturn an iterator over all entries in a file.";
-static PyMethodDef __pyx_mdef_6ctabix_5tabix_iterator = {__Pyx_NAMESTR("tabix_iterator"), (PyCFunction)__pyx_pw_6ctabix_5tabix_iterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_4tabix_iterator)};
-static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_6ctabix_4tabix_iterator[] = "tabix_iterator(infile, parser)\nreturn an iterator over all entries in a file.";
+static PyMethodDef __pyx_mdef_5pysam_6ctabix_5tabix_iterator = {__Pyx_NAMESTR("tabix_iterator"), (PyCFunction)__pyx_pw_5pysam_6ctabix_5tabix_iterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_4tabix_iterator)};
+static PyObject *__pyx_pw_5pysam_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_infile = 0;
   PyObject *__pyx_v_parser = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("tabix_iterator (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8982,12 +8960,10 @@ static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -9008,16 +8984,16 @@ static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_6ctabix_4tabix_iterator(__pyx_self, __pyx_v_infile, __pyx_v_parser);
+  __pyx_r = __pyx_pf_5pysam_6ctabix_4tabix_iterator(__pyx_self, __pyx_v_infile, __pyx_v_parser);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "ctabix.pyx":883
+/* "pysam/ctabix.pyx":883
  *         return self.__next__()
  * 
  * def tabix_iterator( infile, parser ):             # <<<<<<<<<<<<<<
@@ -9025,7 +9001,7 @@ static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject
  *     return tabix_generic_iterator( infile, parser )
  */
 
-static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
+static PyObject *__pyx_pf_5pysam_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -9036,7 +9012,7 @@ static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("tabix_iterator", 0);
 
-  /* "ctabix.pyx":885
+  /* "pysam/ctabix.pyx":885
  * def tabix_iterator( infile, parser ):
  *     """return an iterator over all entries in a file."""
  *     return tabix_generic_iterator( infile, parser )             # <<<<<<<<<<<<<<
@@ -9068,7 +9044,7 @@ static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -9076,21 +9052,21 @@ static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_
   return __pyx_r;
 }
 
-static PyObject *__pyx_tp_new_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  if (__pyx_pw_6ctabix_9Tabixfile_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pw_5pysam_6ctabix_9Tabixfile_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) {
+static void __pyx_tp_dealloc_5pysam_6ctabix_Tabixfile(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(o);
+    __pyx_pw_5pysam_6ctabix_9Tabixfile_13__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -9098,31 +9074,31 @@ static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_6ctabix_9Tabixfile_filename(PyObject *o, void *x) {
-  return __pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_filename(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_6ctabix_9Tabixfile_8filename_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_6ctabix_9Tabixfile_header(PyObject *o, void *x) {
-  return __pyx_pw_6ctabix_9Tabixfile_6header_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_header(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_6ctabix_9Tabixfile_6header_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_6ctabix_9Tabixfile_contigs(PyObject *o, void *x) {
-  return __pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_contigs(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_6ctabix_9Tabixfile_7contigs_1__get__(o);
 }
 
-static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_2_isOpen)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_5_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_4_open)},
-  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_7_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_6_parseRegion)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_9fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_8fetch)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_11close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_10close)},
+static PyMethodDef __pyx_methods_5pysam_6ctabix_Tabixfile[] = {
+  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_5pysam_6ctabix_9Tabixfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_9Tabixfile_2_isOpen)},
+  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_5pysam_6ctabix_9Tabixfile_5_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_9Tabixfile_4_open)},
+  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_5pysam_6ctabix_9Tabixfile_7_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_9Tabixfile_6_parseRegion)},
+  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_5pysam_6ctabix_9Tabixfile_9fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_9Tabixfile_8fetch)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_5pysam_6ctabix_9Tabixfile_11close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_9Tabixfile_10close)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = {
-  {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_59), 0},
-  {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_60), 0},
-  {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_61), 0},
+static struct PyGetSetDef __pyx_getsets_5pysam_6ctabix_Tabixfile[] = {
+  {(char *)"filename", __pyx_getprop_5pysam_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_59), 0},
+  {(char *)"header", __pyx_getprop_5pysam_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_60), 0},
+  {(char *)"contigs", __pyx_getprop_5pysam_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_61), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -9224,12 +9200,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Tabixfile = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_Tabixfile = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.Tabixfile"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_Tabixfile), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.Tabixfile"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_Tabixfile), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_Tabixfile, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_Tabixfile, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -9256,9 +9232,9 @@ static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_6ctabix_Tabixfile, /*tp_methods*/
+  __pyx_methods_5pysam_6ctabix_Tabixfile, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_6ctabix_Tabixfile, /*tp_getset*/
+  __pyx_getsets_5pysam_6ctabix_Tabixfile, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -9266,7 +9242,7 @@ static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_Tabixfile, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_Tabixfile, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -9280,21 +9256,21 @@ static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_6ctabix_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  if (__pyx_pw_6ctabix_13TabixIterator_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pw_5pysam_6ctabix_13TabixIterator_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
+static void __pyx_tp_dealloc_5pysam_6ctabix_TabixIterator(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(o);
+    __pyx_pw_5pysam_6ctabix_13TabixIterator_7__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -9302,8 +9278,8 @@ static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_6ctabix_TabixIterator[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_13TabixIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator_4__next__)},
+static PyMethodDef __pyx_methods_5pysam_6ctabix_TabixIterator[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_13TabixIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_13TabixIterator_4__next__)},
   {0, 0, 0, 0}
 };
 
@@ -9405,12 +9381,12 @@ static PyBufferProcs __pyx_tp_as_buffer_TabixIterator = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_TabixIterator = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.TabixIterator"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_TabixIterator), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.TabixIterator"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_TabixIterator), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_TabixIterator, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_TabixIterator, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -9435,9 +9411,9 @@ static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_6ctabix_13TabixIterator_3__iter__, /*tp_iter*/
-  __pyx_pw_6ctabix_13TabixIterator_5__next__, /*tp_iternext*/
-  __pyx_methods_6ctabix_TabixIterator, /*tp_methods*/
+  __pyx_pw_5pysam_6ctabix_13TabixIterator_3__iter__, /*tp_iter*/
+  __pyx_pw_5pysam_6ctabix_13TabixIterator_5__next__, /*tp_iternext*/
+  __pyx_methods_5pysam_6ctabix_TabixIterator, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -9447,7 +9423,7 @@ static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_TabixIterator, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_TabixIterator, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -9461,21 +9437,21 @@ static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_TabixHeaderIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_6ctabix_TabixHeaderIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  if (__pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) {
+static void __pyx_tp_dealloc_5pysam_6ctabix_TabixHeaderIterator(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(o);
+    __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_7__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -9483,8 +9459,8 @@ static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_6ctabix_TabixHeaderIterator[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixHeaderIterator_4__next__)},
+static PyMethodDef __pyx_methods_5pysam_6ctabix_TabixHeaderIterator[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_19TabixHeaderIterator_4__next__)},
   {0, 0, 0, 0}
 };
 
@@ -9586,12 +9562,12 @@ static PyBufferProcs __pyx_tp_as_buffer_TabixHeaderIterator = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_TabixHeaderIterator = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.TabixHeaderIterator"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_TabixHeaderIterator), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.TabixHeaderIterator"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_TabixHeaderIterator, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_TabixHeaderIterator, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -9616,9 +9592,9 @@ static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__, /*tp_iter*/
-  __pyx_pw_6ctabix_19TabixHeaderIterator_5__next__, /*tp_iternext*/
-  __pyx_methods_6ctabix_TabixHeaderIterator, /*tp_methods*/
+  __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_3__iter__, /*tp_iter*/
+  __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_5__next__, /*tp_iternext*/
+  __pyx_methods_5pysam_6ctabix_TabixHeaderIterator, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -9628,7 +9604,7 @@ static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_TabixHeaderIterator, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_TabixHeaderIterator, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -9642,17 +9618,17 @@ static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_Parser(PyTypeObject *t, PyObject *a, PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_6ctabix_Parser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_Parser(PyObject *o) {
+static void __pyx_tp_dealloc_5pysam_6ctabix_Parser(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_6ctabix_Parser[] = {
+static PyMethodDef __pyx_methods_5pysam_6ctabix_Parser[] = {
   {0, 0, 0, 0}
 };
 
@@ -9754,12 +9730,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Parser = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_Parser = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_Parser = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.Parser"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_Parser), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.Parser"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_Parser), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_Parser, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -9786,7 +9762,7 @@ static PyTypeObject __pyx_type_6ctabix_Parser = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_6ctabix_Parser, /*tp_methods*/
+  __pyx_methods_5pysam_6ctabix_Parser, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -9796,7 +9772,7 @@ static PyTypeObject __pyx_type_6ctabix_Parser = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_Parser, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_Parser, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -9810,13 +9786,13 @@ static PyTypeObject __pyx_type_6ctabix_Parser = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_asTuple(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
+static PyObject *__pyx_tp_new_5pysam_6ctabix_asTuple(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = __pyx_tp_new_5pysam_6ctabix_Parser(t, a, k);
   if (!o) return 0;
   return o;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_asTuple[] = {
+static PyMethodDef __pyx_methods_5pysam_6ctabix_asTuple[] = {
   {0, 0, 0, 0}
 };
 
@@ -9918,12 +9894,12 @@ static PyBufferProcs __pyx_tp_as_buffer_asTuple = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_asTuple = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_asTuple = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.asTuple"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_asTuple), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.asTuple"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_asTuple), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_Parser, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -9937,7 +9913,7 @@ static PyTypeObject __pyx_type_6ctabix_asTuple = {
   &__pyx_tp_as_sequence_asTuple, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_asTuple, /*tp_as_mapping*/
   0, /*tp_hash*/
-  __pyx_pw_6ctabix_7asTuple_1__call__, /*tp_call*/
+  __pyx_pw_5pysam_6ctabix_7asTuple_1__call__, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
@@ -9950,7 +9926,7 @@ static PyTypeObject __pyx_type_6ctabix_asTuple = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_6ctabix_asTuple, /*tp_methods*/
+  __pyx_methods_5pysam_6ctabix_asTuple, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -9960,7 +9936,7 @@ static PyTypeObject __pyx_type_6ctabix_asTuple = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_asTuple, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_asTuple, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -9974,13 +9950,13 @@ static PyTypeObject __pyx_type_6ctabix_asTuple = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_asGTF(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
+static PyObject *__pyx_tp_new_5pysam_6ctabix_asGTF(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = __pyx_tp_new_5pysam_6ctabix_Parser(t, a, k);
   if (!o) return 0;
   return o;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_asGTF[] = {
+static PyMethodDef __pyx_methods_5pysam_6ctabix_asGTF[] = {
   {0, 0, 0, 0}
 };
 
@@ -10082,12 +10058,12 @@ static PyBufferProcs __pyx_tp_as_buffer_asGTF = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_asGTF = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_asGTF = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.asGTF"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_asGTF), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.asGTF"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_asGTF), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_Parser, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -10101,7 +10077,7 @@ static PyTypeObject __pyx_type_6ctabix_asGTF = {
   &__pyx_tp_as_sequence_asGTF, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_asGTF, /*tp_as_mapping*/
   0, /*tp_hash*/
-  __pyx_pw_6ctabix_5asGTF_1__call__, /*tp_call*/
+  __pyx_pw_5pysam_6ctabix_5asGTF_1__call__, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
@@ -10114,7 +10090,7 @@ static PyTypeObject __pyx_type_6ctabix_asGTF = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_6ctabix_asGTF, /*tp_methods*/
+  __pyx_methods_5pysam_6ctabix_asGTF, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -10124,7 +10100,7 @@ static PyTypeObject __pyx_type_6ctabix_asGTF = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_asGTF, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_asGTF, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -10138,13 +10114,13 @@ static PyTypeObject __pyx_type_6ctabix_asGTF = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_asBed(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
+static PyObject *__pyx_tp_new_5pysam_6ctabix_asBed(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = __pyx_tp_new_5pysam_6ctabix_Parser(t, a, k);
   if (!o) return 0;
   return o;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_asBed[] = {
+static PyMethodDef __pyx_methods_5pysam_6ctabix_asBed[] = {
   {0, 0, 0, 0}
 };
 
@@ -10246,12 +10222,12 @@ static PyBufferProcs __pyx_tp_as_buffer_asBed = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_asBed = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_asBed = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.asBed"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_asBed), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.asBed"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_asBed), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_Parser, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -10265,7 +10241,7 @@ static PyTypeObject __pyx_type_6ctabix_asBed = {
   &__pyx_tp_as_sequence_asBed, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_asBed, /*tp_as_mapping*/
   0, /*tp_hash*/
-  __pyx_pw_6ctabix_5asBed_1__call__, /*tp_call*/
+  __pyx_pw_5pysam_6ctabix_5asBed_1__call__, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
@@ -10278,7 +10254,7 @@ static PyTypeObject __pyx_type_6ctabix_asBed = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_6ctabix_asBed, /*tp_methods*/
+  __pyx_methods_5pysam_6ctabix_asBed, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -10288,7 +10264,7 @@ static PyTypeObject __pyx_type_6ctabix_asBed = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_asBed, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_asBed, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -10302,13 +10278,13 @@ static PyTypeObject __pyx_type_6ctabix_asBed = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_asVCF(PyTypeObject *t, PyObject *a, PyObject *k) {
-  PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
+static PyObject *__pyx_tp_new_5pysam_6ctabix_asVCF(PyTypeObject *t, PyObject *a, PyObject *k) {
+  PyObject *o = __pyx_tp_new_5pysam_6ctabix_Parser(t, a, k);
   if (!o) return 0;
   return o;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_asVCF[] = {
+static PyMethodDef __pyx_methods_5pysam_6ctabix_asVCF[] = {
   {0, 0, 0, 0}
 };
 
@@ -10410,12 +10386,12 @@ static PyBufferProcs __pyx_tp_as_buffer_asVCF = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_asVCF = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_asVCF = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.asVCF"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_asVCF), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.asVCF"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_asVCF), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_Parser, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -10429,7 +10405,7 @@ static PyTypeObject __pyx_type_6ctabix_asVCF = {
   &__pyx_tp_as_sequence_asVCF, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_asVCF, /*tp_as_mapping*/
   0, /*tp_hash*/
-  __pyx_pw_6ctabix_5asVCF_1__call__, /*tp_call*/
+  __pyx_pw_5pysam_6ctabix_5asVCF_1__call__, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
@@ -10442,7 +10418,7 @@ static PyTypeObject __pyx_type_6ctabix_asVCF = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_6ctabix_asVCF, /*tp_methods*/
+  __pyx_methods_5pysam_6ctabix_asVCF, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -10452,7 +10428,7 @@ static PyTypeObject __pyx_type_6ctabix_asVCF = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_asVCF, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_asVCF, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -10466,53 +10442,55 @@ static PyTypeObject __pyx_type_6ctabix_asVCF = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_6ctabix_TabixIteratorParsed(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_6ctabix_TabixIteratorParsed *p;
+static PyObject *__pyx_tp_new_5pysam_6ctabix_TabixIteratorParsed(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)o);
-  p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)o);
+  p->parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
+  if (__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) {
-  struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
+static void __pyx_tp_dealloc_5pysam_6ctabix_TabixIteratorParsed(PyObject *o) {
+  struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(o);
+    __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_7__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_XDECREF(((PyObject *)p->parser));
+  Py_CLEAR(p->parser);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_6ctabix_TabixIteratorParsed(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_6ctabix_TabixIteratorParsed(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
+  struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)o;
   if (p->parser) {
     e = (*v)(((PyObject*)p->parser), a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_6ctabix_TabixIteratorParsed(PyObject *o) {
-  struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
+static int __pyx_tp_clear_5pysam_6ctabix_TabixIteratorParsed(PyObject *o) {
+  struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->parser);
-  p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
+  p->parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_TabixIteratorParsed[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixIteratorParsed_4__next__)},
+static PyMethodDef __pyx_methods_5pysam_6ctabix_TabixIteratorParsed[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_6ctabix_19TabixIteratorParsed_4__next__)},
   {0, 0, 0, 0}
 };
 
@@ -10614,12 +10592,12 @@ static PyBufferProcs __pyx_tp_as_buffer_TabixIteratorParsed = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_TabixIteratorParsed = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.TabixIteratorParsed"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_TabixIteratorParsed), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.TabixIteratorParsed"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_TabixIteratorParsed, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_TabixIteratorParsed, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -10640,13 +10618,13 @@ static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
   &__pyx_tp_as_buffer_TabixIteratorParsed, /*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 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*/
+  __pyx_tp_traverse_5pysam_6ctabix_TabixIteratorParsed, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_6ctabix_TabixIteratorParsed, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__, /*tp_iter*/
-  __pyx_pw_6ctabix_19TabixIteratorParsed_5__next__, /*tp_iternext*/
-  __pyx_methods_6ctabix_TabixIteratorParsed, /*tp_methods*/
+  __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_3__iter__, /*tp_iter*/
+  __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_5__next__, /*tp_iternext*/
+  __pyx_methods_5pysam_6ctabix_TabixIteratorParsed, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -10656,7 +10634,7 @@ static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_TabixIteratorParsed, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_TabixIteratorParsed, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -10669,56 +10647,58 @@ static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator __pyx_vtable_6ctabix_tabix_inplace_iterator;
+static struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator __pyx_vtable_5pysam_6ctabix_tabix_inplace_iterator;
 
-static PyObject *__pyx_tp_new_6ctabix_tabix_inplace_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_6ctabix_tabix_inplace_iterator *p;
+static PyObject *__pyx_tp_new_5pysam_6ctabix_tabix_inplace_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o);
-  p->__pyx_vtab = __pyx_vtabptr_6ctabix_tabix_inplace_iterator;
-  p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)o);
+  p->__pyx_vtab = __pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator;
+  p->parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
+  if (__pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_tabix_inplace_iterator(PyObject *o) {
-  struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
+static void __pyx_tp_dealloc_5pysam_6ctabix_tabix_inplace_iterator(PyObject *o) {
+  struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(o);
+    __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_5__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_XDECREF(((PyObject *)p->parser));
+  Py_CLEAR(p->parser);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_6ctabix_tabix_inplace_iterator(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_6ctabix_tabix_inplace_iterator(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
+  struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)o;
   if (p->parser) {
     e = (*v)(((PyObject*)p->parser), a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_6ctabix_tabix_inplace_iterator(PyObject *o) {
-  struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
+static int __pyx_tp_clear_5pysam_6ctabix_tabix_inplace_iterator(PyObject *o) {
+  struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->parser);
-  p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
+  p->parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_tabix_inplace_iterator[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_5pysam_6ctabix_tabix_inplace_iterator[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
@@ -10820,12 +10800,12 @@ static PyBufferProcs __pyx_tp_as_buffer_tabix_inplace_iterator = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_tabix_inplace_iterator = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_tabix_inplace_iterator = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.tabix_inplace_iterator"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_tabix_inplace_iterator), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.tabix_inplace_iterator"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_tabix_inplace_iterator, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_tabix_inplace_iterator, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -10846,13 +10826,13 @@ static PyTypeObject __pyx_type_6ctabix_tabix_inplace_iterator = {
   &__pyx_tp_as_buffer_tabix_inplace_iterator, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("iterate over ``infile``.\n\n    This iterator is not safe. If the :meth:`__next__()` method is called \n    after ``infile`` is closed, the result is undefined (see ``fclose()``).\n\n    The iterator might either raise a StopIteration or segfault.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_6ctabix_tabix_inplace_iterator, /*tp_traverse*/
-  __pyx_tp_clear_6ctabix_tabix_inplace_iterator, /*tp_clear*/
+  __pyx_tp_traverse_5pysam_6ctabix_tabix_inplace_iterator, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_6ctabix_tabix_inplace_iterator, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__, /*tp_iter*/
-  __pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__, /*tp_iternext*/
-  __pyx_methods_6ctabix_tabix_inplace_iterator, /*tp_methods*/
+  __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_3__iter__, /*tp_iter*/
+  __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_7__next__, /*tp_iternext*/
+  __pyx_methods_5pysam_6ctabix_tabix_inplace_iterator, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -10862,7 +10842,7 @@ static PyTypeObject __pyx_type_6ctabix_tabix_inplace_iterator = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_tabix_inplace_iterator, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_tabix_inplace_iterator, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -10875,47 +10855,49 @@ static PyTypeObject __pyx_type_6ctabix_tabix_inplace_iterator = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator __pyx_vtable_6ctabix_tabix_copy_iterator;
+static struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator __pyx_vtable_5pysam_6ctabix_tabix_copy_iterator;
 
-static PyObject *__pyx_tp_new_6ctabix_tabix_copy_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_6ctabix_tabix_copy_iterator *p;
+static PyObject *__pyx_tp_new_5pysam_6ctabix_tabix_copy_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_6ctabix_tabix_copy_iterator *)o);
-  p->__pyx_vtab = __pyx_vtabptr_6ctabix_tabix_copy_iterator;
-  p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)o);
+  p->__pyx_vtab = __pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator;
+  p->parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
+  if (__pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_1__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_6ctabix_tabix_copy_iterator(PyObject *o) {
-  struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
-  Py_XDECREF(((PyObject *)p->parser));
+static void __pyx_tp_dealloc_5pysam_6ctabix_tabix_copy_iterator(PyObject *o) {
+  struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->parser);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_6ctabix_tabix_copy_iterator(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_6ctabix_tabix_copy_iterator(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
+  struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)o;
   if (p->parser) {
     e = (*v)(((PyObject*)p->parser), a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_6ctabix_tabix_copy_iterator(PyObject *o) {
-  struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
+static int __pyx_tp_clear_5pysam_6ctabix_tabix_copy_iterator(PyObject *o) {
+  struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->parser);
-  p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
+  p->parser = ((struct __pyx_obj_5pysam_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_6ctabix_tabix_copy_iterator[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_5pysam_6ctabix_tabix_copy_iterator[] = {
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
@@ -11017,12 +10999,12 @@ static PyBufferProcs __pyx_tp_as_buffer_tabix_copy_iterator = {
   #endif
 };
 
-static PyTypeObject __pyx_type_6ctabix_tabix_copy_iterator = {
+static PyTypeObject __pyx_type_5pysam_6ctabix_tabix_copy_iterator = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("ctabix.tabix_copy_iterator"), /*tp_name*/
-  sizeof(struct __pyx_obj_6ctabix_tabix_copy_iterator), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.ctabix.tabix_copy_iterator"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_6ctabix_tabix_copy_iterator, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_6ctabix_tabix_copy_iterator, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -11043,13 +11025,13 @@ static PyTypeObject __pyx_type_6ctabix_tabix_copy_iterator = {
   &__pyx_tp_as_buffer_tabix_copy_iterator, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("iterate over ``infile``.\n\n    This iterator is not save. If the :meth:`__next__()` method is called \n    after ``infile`` is closed, the result is undefined (see ``fclose()``).\n\n    The iterator might either raise a StopIteration or segfault.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_6ctabix_tabix_copy_iterator, /*tp_traverse*/
-  __pyx_tp_clear_6ctabix_tabix_copy_iterator, /*tp_clear*/
+  __pyx_tp_traverse_5pysam_6ctabix_tabix_copy_iterator, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_6ctabix_tabix_copy_iterator, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__, /*tp_iter*/
-  __pyx_pw_6ctabix_19tabix_copy_iterator_5__next__, /*tp_iternext*/
-  __pyx_methods_6ctabix_tabix_copy_iterator, /*tp_methods*/
+  __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_3__iter__, /*tp_iter*/
+  __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_5__next__, /*tp_iternext*/
+  __pyx_methods_5pysam_6ctabix_tabix_copy_iterator, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -11059,7 +11041,7 @@ static PyTypeObject __pyx_type_6ctabix_tabix_copy_iterator = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_6ctabix_tabix_copy_iterator, /*tp_new*/
+  __pyx_tp_new_5pysam_6ctabix_tabix_copy_iterator, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -11124,9 +11106,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
   {&__pyx_n_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 1},
   {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
+  {&__pyx_n_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 1},
   {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
-  {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0},
-  {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1},
+  {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0},
+  {&__pyx_n_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 1},
   {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
   {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
   {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
@@ -11165,7 +11148,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__conf, __pyx_k__conf, sizeof(__pyx_k__conf), 0, 0, 1, 1},
   {&__pyx_n_s__conf_data, __pyx_k__conf_data, sizeof(__pyx_k__conf_data), 0, 0, 1, 1},
   {&__pyx_n_s__cpy, __pyx_k__cpy, sizeof(__pyx_k__cpy), 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__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
   {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
@@ -11247,7 +11229,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "ctabix.pyx":58
+  /* "pysam/ctabix.pyx":58
  *         return s
  *     elif PyUnicode_Check(s):
  *         return s.encode('ascii')             # <<<<<<<<<<<<<<
@@ -11261,7 +11243,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
-  /* "ctabix.pyx":78
+  /* "pysam/ctabix.pyx":78
  *         return s
  *     elif PyBytes_Check(s):
  *         return s.decode('ascii')             # <<<<<<<<<<<<<<
@@ -11275,7 +11257,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
-  /* "ctabix.pyx":112
+  /* "pysam/ctabix.pyx":112
  * 
  *         filename_index = filename + ".tbi"
  *         self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" )             # <<<<<<<<<<<<<<
@@ -11295,7 +11277,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
-  /* "ctabix.pyx":117
+  /* "pysam/ctabix.pyx":117
  *         filename = _my_encodeFilename(filename)
  *         filename_index = _my_encodeFilename(filename_index)
  *         cdef bytes bmode = mode.encode('ascii')             # <<<<<<<<<<<<<<
@@ -11309,7 +11291,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 
-  /* "ctabix.pyx":125
+  /* "pysam/ctabix.pyx":125
  *         if mode[0] == 'w':
  *             # open file for writing
  *             raise NotImplementedError("writing to tabix files not implemented" )             # <<<<<<<<<<<<<<
@@ -11323,7 +11305,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
 
-  /* "ctabix.pyx":212
+  /* "pysam/ctabix.pyx":212
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -11337,7 +11319,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
-  /* "ctabix.pyx":235
+  /* "pysam/ctabix.pyx":235
  *         '''filename associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -11351,7 +11333,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
 
-  /* "ctabix.pyx":302
+  /* "pysam/ctabix.pyx":302
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
@@ -11365,7 +11347,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
-  /* "ctabix.pyx":347
+  /* "pysam/ctabix.pyx":347
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("can't open header.\n")             # <<<<<<<<<<<<<<
@@ -11379,7 +11361,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 
-  /* "ctabix.pyx":539
+  /* "pysam/ctabix.pyx":539
  * 
  *         if <void*>self.iterator == NULL:
  *             raise ValueError("malformatted query or wrong sequence name.\n")             # <<<<<<<<<<<<<<
@@ -11393,7 +11375,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
-  /* "ctabix.pyx":590
+  /* "pysam/ctabix.pyx":590
  *     fp = bgzf_open( fn, "w")
  *     if fp == NULL:
  *         raise IOError( "could not open '%s' for writing" )             # <<<<<<<<<<<<<<
@@ -11407,7 +11389,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
 
-  /* "ctabix.pyx":595
+  /* "pysam/ctabix.pyx":595
  *     fd_src = open(fn, O_RDONLY)
  *     if fd_src == 0:
  *         raise IOError( "could not open '%s' for reading" )             # <<<<<<<<<<<<<<
@@ -11421,7 +11403,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
 
-  /* "ctabix.pyx":605
+  /* "pysam/ctabix.pyx":605
  *         if r < 0:
  *             free( buffer )
  *             raise OSError("writing failed")             # <<<<<<<<<<<<<<
@@ -11435,7 +11417,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
-  /* "ctabix.pyx":609
+  /* "pysam/ctabix.pyx":609
  *     free( buffer )
  *     r = bgzf_close(fp)
  *     if r < 0: raise OSError("writing failed")             # <<<<<<<<<<<<<<
@@ -11449,7 +11431,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
-  /* "ctabix.pyx":656
+  /* "pysam/ctabix.pyx":656
  * 
  *     if preset == None and (seq_col == None or start_col == None or end_col == None):
  *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )             # <<<<<<<<<<<<<<
@@ -11463,7 +11445,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
 
-  /* "ctabix.pyx":658
+  /* "pysam/ctabix.pyx":658
  *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
  * 
  *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
@@ -11477,7 +11459,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
 
-  /* "ctabix.pyx":664
+  /* "pysam/ctabix.pyx":664
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):
  *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
@@ -11491,7 +11473,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_47));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
 
-  /* "ctabix.pyx":722
+  /* "pysam/ctabix.pyx":722
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -11505,7 +11487,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
-  /* "ctabix.pyx":725
+  /* "pysam/ctabix.pyx":725
  *         self.infile = fdopen( fd, 'r')
  * 
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -11519,7 +11501,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
 
-  /* "ctabix.pyx":783
+  /* "pysam/ctabix.pyx":783
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -11533,7 +11515,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
-  /* "ctabix.pyx":785
+  /* "pysam/ctabix.pyx":785
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -11547,7 +11529,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
-  /* "ctabix.pyx":839
+  /* "pysam/ctabix.pyx":839
  * 
  *         self.infile = infile
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -11561,7 +11543,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
-  /* "ctabix.pyx":564
+  /* "pysam/ctabix.pyx":564
  *             ti_iter_destroy(self.iterator)
  * 
  * def tabix_compress( filename_in,             # <<<<<<<<<<<<<<
@@ -11606,152 +11588,152 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
   __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_compress, 564, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":611
+  /* "pysam/ctabix.pyx":611
  *     if r < 0: raise OSError("writing failed")
  * 
  * def tabix_index( filename,             # <<<<<<<<<<<<<<
  *                  force = False,
  *                  seq_col = None,
  */
-  __pyx_k_tuple_66 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_66);
+  __pyx_k_tuple_67 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_67);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__filename));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_n_s__filename));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__force));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 1, ((PyObject *)__pyx_n_s__force));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, ((PyObject *)__pyx_n_s__force));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__force));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__seq_col));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 2, ((PyObject *)__pyx_n_s__seq_col));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 2, ((PyObject *)__pyx_n_s__seq_col));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq_col));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__start_col));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 3, ((PyObject *)__pyx_n_s__start_col));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 3, ((PyObject *)__pyx_n_s__start_col));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start_col));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__end_col));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 4, ((PyObject *)__pyx_n_s__end_col));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 4, ((PyObject *)__pyx_n_s__end_col));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end_col));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__preset));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 5, ((PyObject *)__pyx_n_s__preset));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 5, ((PyObject *)__pyx_n_s__preset));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__preset));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__meta_char));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 6, ((PyObject *)__pyx_n_s__meta_char));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 6, ((PyObject *)__pyx_n_s__meta_char));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__meta_char));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__zerobased));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 7, ((PyObject *)__pyx_n_s__zerobased));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 7, ((PyObject *)__pyx_n_s__zerobased));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zerobased));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__preset2conf));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 8, ((PyObject *)__pyx_n_s__preset2conf));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 8, ((PyObject *)__pyx_n_s__preset2conf));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__preset2conf));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__conf_data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 9, ((PyObject *)__pyx_n_s__conf_data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 9, ((PyObject *)__pyx_n_s__conf_data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__conf_data));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__conf));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 10, ((PyObject *)__pyx_n_s__conf));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 10, ((PyObject *)__pyx_n_s__conf));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__conf));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fn));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 11, ((PyObject *)__pyx_n_s__fn));
+  PyTuple_SET_ITEM(__pyx_k_tuple_67, 11, ((PyObject *)__pyx_n_s__fn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fn));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
-  __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_index, 611, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
+  __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_index, 611, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":836
+  /* "pysam/ctabix.pyx":836
  *     Permits the use of file-like objects for example from the gzip module.
  *     '''
  *     def __init__(self, infile, parser ):             # <<<<<<<<<<<<<<
  * 
  *         self.infile = infile
  */
-  __pyx_k_tuple_68 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_68);
+  __pyx_k_tuple_69 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_69);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__infile));
-  PyTuple_SET_ITEM(__pyx_k_tuple_68, 1, ((PyObject *)__pyx_n_s__infile));
+  PyTuple_SET_ITEM(__pyx_k_tuple_69, 1, ((PyObject *)__pyx_n_s__infile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infile));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__parser));
-  PyTuple_SET_ITEM(__pyx_k_tuple_68, 2, ((PyObject *)__pyx_n_s__parser));
+  PyTuple_SET_ITEM(__pyx_k_tuple_69, 2, ((PyObject *)__pyx_n_s__parser));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parser));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
-  __pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____init__, 836, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));
+  __pyx_k_codeobj_70 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____init__, 836, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":842
+  /* "pysam/ctabix.pyx":842
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self
  * 
  */
-  __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_70);
+  __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_71);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
-  __pyx_k_codeobj_71 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____iter__, 842, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));
+  __pyx_k_codeobj_72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____iter__, 842, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":846
+  /* "pysam/ctabix.pyx":846
  * 
  *     # cython version - required for python 3
  *     def __next__(self):             # <<<<<<<<<<<<<<
  * 
  *         cdef char * b, * cpy
  */
-  __pyx_k_tuple_72 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_72);
+  __pyx_k_tuple_73 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_73);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 1, ((PyObject *)__pyx_n_s__b));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 1, ((PyObject *)__pyx_n_s__b));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__cpy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 2, ((PyObject *)__pyx_n_s__cpy));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 2, ((PyObject *)__pyx_n_s__cpy));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpy));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__nbytes));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 3, ((PyObject *)__pyx_n_s__nbytes));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 3, ((PyObject *)__pyx_n_s__nbytes));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nbytes));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 4, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 4, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 5, ((PyObject *)__pyx_n_s__s));
+  PyTuple_SET_ITEM(__pyx_k_tuple_73, 5, ((PyObject *)__pyx_n_s__s));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
-  __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____next__, 846, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
+  __pyx_k_codeobj_74 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____next__, 846, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":880
+  /* "pysam/ctabix.pyx":880
  * 
  *     # python version - required for python 2.7
  *     def next(self):             # <<<<<<<<<<<<<<
  *         return self.__next__()
  * 
  */
-  __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_74);
+  __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_75);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));
-  __pyx_k_codeobj_75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__next, 880, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
+  __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__next, 880, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":883
+  /* "pysam/ctabix.pyx":883
  *         return self.__next__()
  * 
  * def tabix_iterator( infile, parser ):             # <<<<<<<<<<<<<<
  *     """return an iterator over all entries in a file."""
  *     return tabix_generic_iterator( infile, parser )
  */
-  __pyx_k_tuple_77 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_77);
+  __pyx_k_tuple_78 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_78);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__infile));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_n_s__infile));
+  PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_n_s__infile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infile));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__parser));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 1, ((PyObject *)__pyx_n_s__parser));
+  PyTuple_SET_ITEM(__pyx_k_tuple_78, 1, ((PyObject *)__pyx_n_s__parser));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parser));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
-  __pyx_k_codeobj_78 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_iterator, 883, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
+  __pyx_k_codeobj_79 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_iterator, 883, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -11821,20 +11803,27 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
   #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);
+  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "pysam.ctabix")) {
+      if (unlikely(PyDict_SetItemString(modules, "pysam.ctabix", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if CYTHON_COMPILING_IN_PYPY
+  Py_INCREF(__pyx_b);
   #endif
-  __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_module_is_main_pysam__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 ---*/
@@ -11842,100 +11831,113 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   /*--- Constants init code ---*/
   if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Global init code ---*/
-  __pyx_v_6ctabix__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  __pyx_v_5pysam_6ctabix__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_Tabixfile = &__pyx_type_6ctabix_Tabixfile;
-  if (PyType_Ready(&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_5pysam_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_Tabixfile = &__pyx_type_5pysam_6ctabix_Tabixfile;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if CYTHON_COMPILING_IN_CPYTHON
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_6ctabix_13TabixIterator_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_6ctabix_13TabixIterator_4__next__.doc = __pyx_doc_6ctabix_13TabixIterator_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_13TabixIterator_4__next__;
+      __pyx_wrapperbase_5pysam_6ctabix_13TabixIterator_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_5pysam_6ctabix_13TabixIterator_4__next__.doc = __pyx_doc_5pysam_6ctabix_13TabixIterator_4__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_6ctabix_13TabixIterator_4__next__;
     }
   }
-  if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __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 = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_5pysam_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_TabixIterator = &__pyx_type_5pysam_6ctabix_TabixIterator;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if CYTHON_COMPILING_IN_CPYTHON
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__.doc = __pyx_doc_6ctabix_19TabixHeaderIterator_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__;
+      __pyx_wrapperbase_5pysam_6ctabix_19TabixHeaderIterator_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_5pysam_6ctabix_19TabixHeaderIterator_4__next__.doc = __pyx_doc_5pysam_6ctabix_19TabixHeaderIterator_4__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_6ctabix_19TabixHeaderIterator_4__next__;
     }
   }
-  if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_TabixHeaderIterator = &__pyx_type_6ctabix_TabixHeaderIterator;
-  if (PyType_Ready(&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __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 = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_Parser = &__pyx_type_6ctabix_Parser;
-  __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 = 381; __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 = 381; __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 = 394; __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 = 394; __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 = 431; __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 = 431; __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 = 471; __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 = 471; __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 = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_5pysam_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_TabixHeaderIterator = &__pyx_type_5pysam_6ctabix_TabixHeaderIterator;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_5pysam_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_Parser = &__pyx_type_5pysam_6ctabix_Parser;
+  __pyx_type_5pysam_6ctabix_asTuple.tp_base = __pyx_ptype_5pysam_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asTuple", (PyObject *)&__pyx_type_5pysam_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asTuple = &__pyx_type_5pysam_6ctabix_asTuple;
+  __pyx_type_5pysam_6ctabix_asGTF.tp_base = __pyx_ptype_5pysam_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asGTF", (PyObject *)&__pyx_type_5pysam_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asGTF = &__pyx_type_5pysam_6ctabix_asGTF;
+  __pyx_type_5pysam_6ctabix_asBed.tp_base = __pyx_ptype_5pysam_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asBed", (PyObject *)&__pyx_type_5pysam_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asBed = &__pyx_type_5pysam_6ctabix_asBed;
+  __pyx_type_5pysam_6ctabix_asVCF.tp_base = __pyx_ptype_5pysam_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_5pysam_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asVCF = &__pyx_type_5pysam_6ctabix_asVCF;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if CYTHON_COMPILING_IN_CPYTHON
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__.doc = __pyx_doc_6ctabix_19TabixIteratorParsed_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__;
+      __pyx_wrapperbase_5pysam_6ctabix_19TabixIteratorParsed_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_5pysam_6ctabix_19TabixIteratorParsed_4__next__.doc = __pyx_doc_5pysam_6ctabix_19TabixIteratorParsed_4__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_6ctabix_19TabixIteratorParsed_4__next__;
     }
   }
-  if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_TabixIteratorParsed = &__pyx_type_6ctabix_TabixIteratorParsed;
-  __pyx_vtabptr_6ctabix_tabix_inplace_iterator = &__pyx_vtable_6ctabix_tabix_inplace_iterator;
-  __pyx_vtable_6ctabix_tabix_inplace_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *))__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__;
-  if (PyType_Ready(&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_inplace_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "tabix_inplace_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_tabix_inplace_iterator = &__pyx_type_6ctabix_tabix_inplace_iterator;
-  __pyx_vtabptr_6ctabix_tabix_copy_iterator = &__pyx_vtable_6ctabix_tabix_copy_iterator;
-  __pyx_vtable_6ctabix_tabix_copy_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_6ctabix_tabix_copy_iterator *))__pyx_f_6ctabix_19tabix_copy_iterator___cnext__;
-  if (PyType_Ready(&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_copy_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "tabix_copy_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_tabix_copy_iterator = &__pyx_type_6ctabix_tabix_copy_iterator;
+  #endif
+  if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_5pysam_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_TabixIteratorParsed = &__pyx_type_5pysam_6ctabix_TabixIteratorParsed;
+  __pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator = &__pyx_vtable_5pysam_6ctabix_tabix_inplace_iterator;
+  __pyx_vtable_5pysam_6ctabix_tabix_inplace_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *))__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_5pysam_6ctabix_tabix_inplace_iterator.tp_dict, __pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "tabix_inplace_iterator", (PyObject *)&__pyx_type_5pysam_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_tabix_inplace_iterator = &__pyx_type_5pysam_6ctabix_tabix_inplace_iterator;
+  __pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator = &__pyx_vtable_5pysam_6ctabix_tabix_copy_iterator;
+  __pyx_vtable_5pysam_6ctabix_tabix_copy_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *))__pyx_f_5pysam_6ctabix_19tabix_copy_iterator___cnext__;
+  if (PyType_Ready(&__pyx_type_5pysam_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_5pysam_6ctabix_tabix_copy_iterator.tp_dict, __pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "tabix_copy_iterator", (PyObject *)&__pyx_type_5pysam_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_tabix_copy_iterator = &__pyx_type_5pysam_6ctabix_tabix_copy_iterator;
   /*--- Type import 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[1]; __pyx_lineno = 41; __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[1]; __pyx_lineno = 41; __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[1]; __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[1]; __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[1]; __pyx_lineno = 69; __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[1]; __pyx_lineno = 69; __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[1]; __pyx_lineno = 72; __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[1]; __pyx_lineno = 72; __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[1]; __pyx_lineno = 83; __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[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[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;}
+  __pyx_ptype_5pysam_10TabProxies_TupleProxy = __Pyx_ImportType("pysam.TabProxies", "TupleProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_GTFProxy = __Pyx_ImportType("pysam.TabProxies", "GTFProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_NamedTupleProxy = __Pyx_ImportType("pysam.TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_BedProxy = __Pyx_ImportType("pysam.TabProxies", "BedProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_BedProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_VCFProxy = __Pyx_ImportType("pysam.TabProxies", "VCFProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
+  #if CYTHON_COMPILING_IN_PYPY
+  sizeof(PyTypeObject),
+  #else
+  sizeof(PyHeapTypeObject),
+  #endif
+  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "ctabix.pyx":6
+  /* "pysam/ctabix.pyx":6
  * # Helper functions for python 3 compatibility - taken
  * # from csamtools.pyx
  * import tempfile, os, sys, types, itertools, struct, ctypes, gzip             # <<<<<<<<<<<<<<
  * import io
- * cimport TabProxies
+ * from pysam cimport TabProxies
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -11970,11 +11972,11 @@ 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 = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":7
+  /* "pysam/ctabix.pyx":7
  * # from csamtools.pyx
  * import tempfile, os, sys, types, itertools, struct, ctypes, gzip
  * import io             # <<<<<<<<<<<<<<
- * cimport TabProxies
+ * from pysam cimport TabProxies
  * 
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__io), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -11982,7 +11984,7 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__io, __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;
 
-  /* "ctabix.pyx":14
+  /* "pysam/ctabix.pyx":14
  *     PyObject_AsFileDescriptor
  * 
  * PYTHON3 = PY_MAJOR_VERSION >= 3             # <<<<<<<<<<<<<<
@@ -11994,7 +11996,7 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PYTHON3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":27
+  /* "pysam/ctabix.pyx":27
  * # filename encoding (copied from lxml.etree.pyx)
  * cdef str _FILENAME_ENCODING
  * _FILENAME_ENCODING = sys.getfilesystemencoding()             # <<<<<<<<<<<<<<
@@ -12010,23 +12012,23 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_XGOTREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
-  __Pyx_DECREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
+  __Pyx_XGOTREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
+  __Pyx_DECREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
   __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_v_6ctabix__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
+  __pyx_v_5pysam_6ctabix__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":28
+  /* "pysam/ctabix.pyx":28
  * cdef str _FILENAME_ENCODING
  * _FILENAME_ENCODING = sys.getfilesystemencoding()
  * if _FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
  *     _FILENAME_ENCODING = sys.getdefaultencoding()
  * if _FILENAME_ENCODING is None:
  */
-  __pyx_t_3 = (__pyx_v_6ctabix__FILENAME_ENCODING == ((PyObject*)Py_None));
+  __pyx_t_3 = (__pyx_v_5pysam_6ctabix__FILENAME_ENCODING == ((PyObject*)Py_None));
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":29
+    /* "pysam/ctabix.pyx":29
  * _FILENAME_ENCODING = sys.getfilesystemencoding()
  * if _FILENAME_ENCODING is None:
  *     _FILENAME_ENCODING = sys.getdefaultencoding()             # <<<<<<<<<<<<<<
@@ -12042,26 +12044,26 @@ PyMODINIT_FUNC PyInit_ctabix(void)
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XGOTREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
-    __Pyx_DECREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
+    __Pyx_XGOTREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
+    __Pyx_DECREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
     __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_v_6ctabix__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
+    __pyx_v_5pysam_6ctabix__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
     __pyx_t_1 = 0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "ctabix.pyx":30
+  /* "pysam/ctabix.pyx":30
  * if _FILENAME_ENCODING is None:
  *     _FILENAME_ENCODING = sys.getdefaultencoding()
  * if _FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
  *     _FILENAME_ENCODING = 'ascii'
  * 
  */
-  __pyx_t_3 = (__pyx_v_6ctabix__FILENAME_ENCODING == ((PyObject*)Py_None));
+  __pyx_t_3 = (__pyx_v_5pysam_6ctabix__FILENAME_ENCODING == ((PyObject*)Py_None));
   if (__pyx_t_3) {
 
-    /* "ctabix.pyx":31
+    /* "pysam/ctabix.pyx":31
  *     _FILENAME_ENCODING = sys.getdefaultencoding()
  * if _FILENAME_ENCODING is None:
  *     _FILENAME_ENCODING = 'ascii'             # <<<<<<<<<<<<<<
@@ -12069,15 +12071,15 @@ PyMODINIT_FUNC PyInit_ctabix(void)
  * #cdef char* _C_FILENAME_ENCODING
  */
     __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
-    __Pyx_XGOTREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
-    __Pyx_DECREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
+    __Pyx_XGOTREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
+    __Pyx_DECREF(((PyObject *)__pyx_v_5pysam_6ctabix__FILENAME_ENCODING));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
-    __pyx_v_6ctabix__FILENAME_ENCODING = __pyx_n_s__ascii;
+    __pyx_v_5pysam_6ctabix__FILENAME_ENCODING = __pyx_n_s__ascii;
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":566
+  /* "pysam/ctabix.pyx":566
  * def tabix_compress( filename_in,
  *                     filename_out,
  *                     force = False ):             # <<<<<<<<<<<<<<
@@ -12090,19 +12092,19 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":564
+  /* "pysam/ctabix.pyx":564
  *             ti_iter_destroy(self.iterator)
  * 
  * def tabix_compress( filename_in,             # <<<<<<<<<<<<<<
  *                     filename_out,
  *                     force = False ):
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_1tabix_compress, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_1tabix_compress, NULL, __pyx_n_s_66); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_compress, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":612
+  /* "pysam/ctabix.pyx":612
  * 
  * def tabix_index( filename,
  *                  force = False,             # <<<<<<<<<<<<<<
@@ -12115,7 +12117,7 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":618
+  /* "pysam/ctabix.pyx":618
  *                  preset = None,
  *                  meta_char = "#",
  *                  zerobased = False,             # <<<<<<<<<<<<<<
@@ -12128,19 +12130,19 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":611
+  /* "pysam/ctabix.pyx":611
  *     if r < 0: raise OSError("writing failed")
  * 
  * def tabix_index( filename,             # <<<<<<<<<<<<<<
  *                  force = False,
  *                  seq_col = None,
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_3tabix_index, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_3tabix_index, NULL, __pyx_n_s_66); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":831
+  /* "pysam/ctabix.pyx":831
  *         return self.__cnext__()
  * 
  * class tabix_generic_iterator:             # <<<<<<<<<<<<<<
@@ -12150,81 +12152,81 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "ctabix.pyx":836
+  /* "pysam/ctabix.pyx":836
  *     Permits the use of file-like objects for example from the gzip module.
  *     '''
  *     def __init__(self, infile, parser ):             # <<<<<<<<<<<<<<
  * 
  *         self.infile = infile
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_1__init__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_69)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_1__init__, 0, NULL, __pyx_n_s_66, ((PyObject *)__pyx_k_codeobj_70)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":842
+  /* "pysam/ctabix.pyx":842
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self
  * 
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_3__iter__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_71)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_3__iter__, 0, NULL, __pyx_n_s_66, ((PyObject *)__pyx_k_codeobj_72)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____iter__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":846
+  /* "pysam/ctabix.pyx":846
  * 
  *     # cython version - required for python 3
  *     def __next__(self):             # <<<<<<<<<<<<<<
  * 
  *         cdef char * b, * cpy
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_5__next__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_73)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_5__next__, 0, NULL, __pyx_n_s_66, ((PyObject *)__pyx_k_codeobj_74)); 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);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____next__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":880
+  /* "pysam/ctabix.pyx":880
  * 
  *     # python version - required for python 2.7
  *     def next(self):             # <<<<<<<<<<<<<<
  *         return self.__next__()
  * 
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_7next, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_75)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_22tabix_generic_iterator_7next, 0, NULL, __pyx_n_s_66, ((PyObject *)__pyx_k_codeobj_76)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__next, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":831
+  /* "pysam/ctabix.pyx":831
  *         return self.__cnext__()
  * 
  * class tabix_generic_iterator:             # <<<<<<<<<<<<<<
  *     '''iterate over ``infile``.
  * 
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_76)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s_58, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_77)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s_58, __pyx_n_s_66); 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);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_58, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __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;
 
-  /* "ctabix.pyx":883
+  /* "pysam/ctabix.pyx":883
  *         return self.__next__()
  * 
  * def tabix_iterator( infile, parser ):             # <<<<<<<<<<<<<<
  *     """return an iterator over all entries in a file."""
  *     return tabix_generic_iterator( infile, parser )
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_5tabix_iterator, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pysam_6ctabix_5tabix_iterator, NULL, __pyx_n_s_66); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_iterator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":899
+  /* "pysam/ctabix.pyx":899
  * #            return tabix_generic_iterator( infile, parser )
  * 
  * __all__ = ["tabix_index",             # <<<<<<<<<<<<<<
@@ -12257,13 +12259,13 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_iterator));
   PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__tabix_iterator));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_iterator));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s_79));
-  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s_79));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_79));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s_80));
+  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s_80));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_80));
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":1
+  /* "pysam/ctabix.pyx":1
  * # cython: embedsignature=True             # <<<<<<<<<<<<<<
  * # adds doc-strings for sphinx
  * 
@@ -12277,10 +12279,10 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   if (__pyx_m) {
-    __Pyx_AddTraceback("init ctabix", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    __Pyx_AddTraceback("init pysam.ctabix", __pyx_clineno, __pyx_lineno, __pyx_filename);
     Py_DECREF(__pyx_m); __pyx_m = 0;
   } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init ctabix");
+    PyErr_SetString(PyExc_ImportError, "init pysam.ctabix");
   }
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -12323,6 +12325,32 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     return result;
 }
 
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+         const char* encoding, const char* errors,
+         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
+    Py_ssize_t length;
+    if (unlikely((start < 0) | (stop < 0))) {
+        length = strlen(cstring);
+        if (start < 0) {
+            start += length;
+            if (start < 0)
+                start = 0;
+        }
+        if (stop < 0)
+            stop += length;
+    }
+    length = stop - start;
+    if (unlikely(length <= 0))
+        return PyUnicode_FromUnicode(NULL, 0);
+    cstring += start;
+    if (decode_func) {
+        return decode_func(cstring, length, errors);
+    } else {
+        return PyUnicode_Decode(cstring, length, encoding, errors);
+    }
+}
+
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
@@ -12358,33 +12386,38 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                         CYTHON_UNUSED PyObject *cause) {
     Py_XINCREF(type);
-    Py_XINCREF(value);
-    Py_XINCREF(tb);
-    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;
-    }
-    if (value == NULL) {
-        value = Py_None;
+    if (!value || value == Py_None)
+        value = NULL;
+    else
         Py_INCREF(value);
+    if (!tb || tb == Py_None)
+        tb = NULL;
+    else {
+        Py_INCREF(tb);
+        if (!PyTraceBack_Check(tb)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: arg 3 must be a traceback or None");
+            goto raise_error;
+        }
     }
     #if PY_VERSION_HEX < 0x02050000
-    if (!PyClass_Check(type))
+    if (PyClass_Check(type)) {
     #else
-    if (!PyType_Check(type))
+    if (PyType_Check(type)) {
     #endif
-    {
-        if (value != Py_None) {
+#if CYTHON_COMPILING_IN_PYPY
+        if (!value) {
+            Py_INCREF(Py_None);
+            value = Py_None;
+        }
+#endif
+        PyErr_NormalizeException(&type, &value, &tb);
+    } else {
+        if (value) {
             PyErr_SetString(PyExc_TypeError,
                 "instance exception may not have a separate value");
             goto raise_error;
         }
-        Py_DECREF(value);
         value = type;
         #if PY_VERSION_HEX < 0x02050000
             if (PyInstance_Check(type)) {
@@ -12417,6 +12450,7 @@ raise_error:
 }
 #else /* Python 3+ */
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+    PyObject* owned_instance = NULL;
     if (tb == Py_None) {
         tb = 0;
     } else if (tb && !PyTraceBack_Check(tb)) {
@@ -12434,12 +12468,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
         value = type;
         type = (PyObject*) Py_TYPE(value);
-    } else if (!PyExceptionClass_Check(type)) {
+    } else if (PyExceptionClass_Check(type)) {
+        PyObject *args;
+        if (!value)
+            args = PyTuple_New(0);
+        else if (PyTuple_Check(value)) {
+            Py_INCREF(value);
+            args = value;
+        }
+        else
+            args = PyTuple_Pack(1, value);
+        if (!args)
+            goto bad;
+        owned_instance = PyEval_CallObject(type, args);
+        Py_DECREF(args);
+        if (!owned_instance)
+            goto bad;
+        value = owned_instance;
+        if (!PyExceptionInstance_Check(value)) {
+            PyErr_Format(PyExc_TypeError,
+                         "calling %R should have returned an instance of "
+                         "BaseException, not %R",
+                         type, Py_TYPE(value));
+            goto bad;
+        }
+    } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
-    if (cause) {
+    if (cause && cause != Py_None) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
@@ -12456,9 +12514,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
                             "BaseException");
             goto bad;
         }
-        if (!value) {
-            value = PyObject_CallObject(type, NULL);
-        }
         PyException_SetCause(value, fixed_cause);
     }
     PyErr_SetObject(type, value);
@@ -12472,6 +12527,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
     }
 bad:
+    Py_XDECREF(owned_instance);
     return;
 }
 #endif
@@ -12485,7 +12541,7 @@ static void __Pyx_RaiseDoubleKeywordsError(
         "%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));
+        PyString_AsString(kw_name));
         #endif
 }
 
@@ -12506,48 +12562,72 @@ static int __Pyx_ParseOptionalKeywords(
         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_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) {
+            continue;
+        }
+        name = first_kw_arg;
+        #if PY_MAJOR_VERSION < 3
+        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+            while (*name) {
+                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+                        && _PyString_Eq(**name, key)) {
                     values[name-argnames] = value;
-                } else {
-                    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;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    if ((**argname == key) || (
+                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+                             && _PyString_Eq(**argname, key))) {
+                        goto arg_passed_twice;
                     }
+                    argname++;
+                }
+            }
+        } else
+        #endif
+        if (likely(PyUnicode_Check(key))) {
+            while (*name) {
+                int cmp = (**name == key) ? 0 :
+                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+                #endif
+                    PyUnicode_Compare(**name, key);
+                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                if (cmp == 0) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    int cmp = (**argname == key) ? 0 :
+                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+                    #endif
+                        PyUnicode_Compare(**argname, key);
+                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                    if (cmp == 0) goto arg_passed_twice;
+                    argname++;
                 }
             }
+        } else
+            goto invalid_keyword_type;
+        if (kwds2) {
+            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+        } else {
+            goto invalid_keyword;
         }
     }
     return 0;
 arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
+    __Pyx_RaiseDoubleKeywordsError(function_name, key);
     goto bad;
 invalid_keyword_type:
     PyErr_Format(PyExc_TypeError,
@@ -12586,22 +12666,54 @@ static void __Pyx_RaiseArgtupleInvalid(
         more_or_less = "exactly";
     }
     PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
+                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                  func_name, more_or_less, num_expected,
                  (num_expected == 1) ? "" : "s", num_found);
 }
 
-
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
+}
 
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
     PyErr_Format(PyExc_ValueError,
-                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
+                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                  index, (index == 1) ? "" : "s");
 }
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
-    PyErr_Format(PyExc_ValueError,
-                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
+static CYTHON_INLINE int __Pyx_IterFinish(void) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyThreadState *tstate = PyThreadState_GET();
+    PyObject* exc_type = tstate->curexc_type;
+    if (unlikely(exc_type)) {
+        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
+            PyObject *exc_value, *exc_tb;
+            exc_value = tstate->curexc_value;
+            exc_tb = tstate->curexc_traceback;
+            tstate->curexc_type = 0;
+            tstate->curexc_value = 0;
+            tstate->curexc_traceback = 0;
+            Py_DECREF(exc_type);
+            Py_XDECREF(exc_value);
+            Py_XDECREF(exc_tb);
+            return 0;
+        } else {
+            return -1;
+        }
+    }
+    return 0;
+#else
+    if (unlikely(PyErr_Occurred())) {
+        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+            PyErr_Clear();
+            return 0;
+        } else {
+            return -1;
+        }
+    }
+    return 0;
+#endif
 }
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
@@ -12609,13 +12721,8 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
         Py_DECREF(retval);
         __Pyx_RaiseTooManyValuesError(expected);
         return -1;
-    } else if (PyErr_Occurred()) {
-        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
-            PyErr_Clear();
-            return 0;
-        } else {
-            return -1;
-        }
+    } else {
+        return __Pyx_IterFinish();
     }
     return 0;
 }
@@ -12640,12 +12747,9 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
-}
-
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     local_type = tstate->curexc_type;
@@ -12654,19 +12758,27 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->curexc_type = 0;
     tstate->curexc_value = 0;
     tstate->curexc_traceback = 0;
+#else
+    PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
     if (unlikely(tstate->curexc_type))
+#else
+    if (unlikely(PyErr_Occurred()))
+#endif
         goto bad;
     #if PY_MAJOR_VERSION >= 3
     if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
         goto bad;
     #endif
-    *type = local_type;
-    *value = local_value;
-    *tb = local_tb;
     Py_INCREF(local_type);
     Py_INCREF(local_value);
     Py_INCREF(local_tb);
+    *type = local_type;
+    *value = local_value;
+    *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
     tmp_tb = tstate->exc_traceback;
@@ -12674,10 +12786,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     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). */
+       these objects (DECREF may run arbitrary code). */
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
+#else
+    PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
     return 0;
 bad:
     *type = 0;
@@ -12690,6 +12805,7 @@ bad:
 }
 
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
     *value = tstate->exc_value;
@@ -12697,8 +12813,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
     Py_XINCREF(*type);
     Py_XINCREF(*value);
     Py_XINCREF(*tb);
+#else
+    PyErr_GetExcInfo(type, value, tb);
+#endif
 }
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     tmp_type = tstate->exc_type;
@@ -12710,6 +12830,9 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
+#else
+    PyErr_SetExcInfo(type, value, tb);
+#endif
 }
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
@@ -12783,7 +12906,6 @@ bad:
 
 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);
@@ -12813,7 +12935,6 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
     PyObject *metaclass;
     if (PyDict_SetItemString(dict, "__module__", modname) < 0)
         return NULL;
-    /* Python2 __metaclass__ */
     metaclass = PyDict_GetItemString(dict, "__metaclass__");
     if (metaclass) {
         Py_INCREF(metaclass);
@@ -13105,6 +13226,56 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
                                PyString_AsString(func_name), (void *)op);
 #endif
 }
+#if CYTHON_COMPILING_IN_PYPY
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+    PyCFunctionObject* f = (PyCFunctionObject*)func;
+    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
+    PyObject *self = PyCFunction_GET_SELF(func);
+    Py_ssize_t size;
+    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
+    case METH_VARARGS:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
+            return (*meth)(self, arg);
+        break;
+    case METH_VARARGS | METH_KEYWORDS:
+        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
+    case METH_NOARGS:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+            size = PyTuple_GET_SIZE(arg);
+            if (size == 0)
+                return (*meth)(self, NULL);
+            PyErr_Format(PyExc_TypeError,
+                "%.200s() takes no arguments (%zd given)",
+                f->m_ml->ml_name, size);
+            return NULL;
+        }
+        break;
+    case METH_O:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+            size = PyTuple_GET_SIZE(arg);
+            if (size == 1)
+                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
+            PyErr_Format(PyExc_TypeError,
+                "%.200s() takes exactly one argument (%zd given)",
+                f->m_ml->ml_name, size);
+            return NULL;
+        }
+        break;
+    default:
+        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
+                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
+                        "longer supported!");
+        return NULL;
+    }
+    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
+                 f->m_ml->ml_name);
+    return NULL;
+}
+#else
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+	return PyCFunction_Call(func, arg, kw);
+}
+#endif
 static PyTypeObject __pyx_CyFunctionType_type = {
     PyVarObject_HEAD_INIT(0, 0)
     __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
@@ -13124,7 +13295,7 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_as_sequence*/
     0,                                  /*tp_as_mapping*/
     0,                                  /*tp_hash*/
-    __Pyx_PyCFunction_Call,             /*tp_call*/
+    __Pyx_CyFunction_Call,              /*tp_call*/
     0,                                  /*tp_str*/
     0,                                  /*tp_getattro*/
     0,                                  /*tp_setattro*/
@@ -13160,15 +13331,16 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_version_tag*/
 #endif
 };
-static int __Pyx_CyFunction_init(void)
-{
+static int __Pyx_CyFunction_init(void) {
+#if !CYTHON_COMPILING_IN_PYPY
+    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+#endif
     if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
         return -1;
     __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
     return 0;
 }
-void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
-{
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
     m->defaults = PyMem_Malloc(size);
     if (!m->defaults)
@@ -13177,85 +13349,12 @@ void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
     m->defaults_pyobjects = pyobjects;
     return m->defaults;
 }
-static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
-{
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
     m->defaults_tuple = tuple;
     Py_INCREF(tuple);
 }
 
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
-    if (s1 == s2) {
-        return (equals == Py_EQ);
-    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
-        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
-            return (equals == Py_NE);
-        } else if (PyBytes_GET_SIZE(s1) == 1) {
-            if (equals == Py_EQ)
-                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
-            else
-                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
-        } else {
-            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
-        return (equals == Py_NE);
-    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
-        return (equals == Py_NE);
-    } else {
-        int result;
-        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
-        if (!py_result)
-            return -1;
-        result = __Pyx_PyObject_IsTrue(py_result);
-        Py_DECREF(py_result);
-        return result;
-    }
-}
-
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
-    if (s1 == s2) {
-        return (equals == Py_EQ);
-    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
-        #if CYTHON_PEP393_ENABLED
-        if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
-            return -1;
-        if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
-            return (equals == Py_NE);
-        } else if (PyUnicode_GET_LENGTH(s1) == 1) {
-            Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
-            Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
-            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
-        #else
-        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
-            return (equals == Py_NE);
-        } else if (PyUnicode_GET_SIZE(s1) == 1) {
-            Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
-            Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
-            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
-        #endif
-        } else {
-            int result = PyUnicode_Compare(s1, s2);
-            if ((result == -1) && unlikely(PyErr_Occurred()))
-                return -1;
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
-        return (equals == Py_NE);
-    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
-        return (equals == Py_NE);
-    } else {
-        int result;
-        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
-        if (!py_result)
-            return -1;
-        result = __Pyx_PyObject_IsTrue(py_result);
-        Py_DECREF(py_result);
-        return result;
-    }
-}
-
 static 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;
@@ -13285,6 +13384,10 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
         else
             return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
     }  else {
+        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+        PyErr_SetString(PyExc_RuntimeError,
+                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+        #else
         int32_t val;
         PyObject *v = __Pyx_PyNumber_Int(x);
         #if PY_VERSION_HEX < 0x03000000
@@ -13304,6 +13407,7 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
             if (likely(!ret))
                 return val;
         }
+        #endif
         return (int32_t)-1;
     }
 }
@@ -13744,6 +13848,23 @@ bad:
     return -1;
 }
 
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+    PyObject *py_name = 0;
+    PyObject *py_module = 0;
+    py_name = __Pyx_PyIdentifier_FromString(name);
+    if (!py_name)
+        goto bad;
+    py_module = PyImport_Import(py_name);
+    Py_DECREF(py_name);
+    return py_module;
+bad:
+    Py_XDECREF(py_name);
+    return 0;
+}
+#endif
+
 #ifndef __PYX_HAVE_RT_ImportType
 #define __PYX_HAVE_RT_ImportType
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
@@ -13796,23 +13917,6 @@ bad:
 }
 #endif
 
-#ifndef __PYX_HAVE_RT_ImportModule
-#define __PYX_HAVE_RT_ImportModule
-static PyObject *__Pyx_ImportModule(const char *name) {
-    PyObject *py_name = 0;
-    PyObject *py_module = 0;
-    py_name = __Pyx_PyIdentifier_FromString(name);
-    if (!py_name)
-        goto bad;
-    py_module = PyImport_Import(py_name);
-    Py_DECREF(py_name);
-    return py_module;
-bad:
-    Py_XDECREF(py_name);
-    return 0;
-}
-#endif
-
 static void* __Pyx_GetVtable(PyObject *dict) {
     void* ptr;
     PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
diff --git a/pysam/ctabix.pyx b/pysam/ctabix.pyx
index 6a19541..67e8514 100644
--- a/pysam/ctabix.pyx
+++ b/pysam/ctabix.pyx
@@ -5,7 +5,7 @@
 # from csamtools.pyx
 import tempfile, os, sys, types, itertools, struct, ctypes, gzip
 import io
-cimport TabProxies
+from pysam cimport TabProxies
 
 from cpython cimport PyErr_SetString, PyBytes_Check, \
     PyUnicode_Check, PyBytes_FromStringAndSize, \
diff --git a/pysam/cvcf.c b/pysam/cvcf.c
index 6caaba0..1754ba8 100644
--- a/pysam/cvcf.c
+++ b/pysam/cvcf.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Mon Nov 19 08:44:41 2012 */
+/* Generated by Cython 0.17.4 on Wed Jan 23 22:59:29 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -11,7 +11,6 @@
 #ifndef offsetof
 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
 #endif
-
 #if !defined(WIN32) && !defined(MS_WINDOWS)
   #ifndef __stdcall
     #define __stdcall
@@ -23,22 +22,18 @@
     #define __fastcall
   #endif
 #endif
-
 #ifndef DL_IMPORT
   #define DL_IMPORT(t) t
 #endif
 #ifndef DL_EXPORT
   #define DL_EXPORT(t) t
 #endif
-
 #ifndef PY_LONG_LONG
   #define PY_LONG_LONG LONG_LONG
 #endif
-
 #ifndef Py_HUGE_VAL
   #define Py_HUGE_VAL HUGE_VAL
 #endif
-
 #ifdef PYPY_VERSION
 #define CYTHON_COMPILING_IN_PYPY 1
 #define CYTHON_COMPILING_IN_CPYTHON 0
@@ -46,28 +41,28 @@
 #define CYTHON_COMPILING_IN_PYPY 0
 #define CYTHON_COMPILING_IN_CPYTHON 1
 #endif
-
-#if CYTHON_COMPILING_IN_PYPY
-  #define __Pyx_PyCFunction_Call PyObject_Call
-#else
-  #define __Pyx_PyCFunction_Call PyCFunction_Call
-#endif
-
 #if PY_VERSION_HEX < 0x02050000
   typedef int Py_ssize_t;
   #define PY_SSIZE_T_MAX INT_MAX
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
+  #define CYTHON_FORMAT_SSIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
-  #define PyNumber_Index(o)    PyNumber_Int(o)
-  #define PyIndex_Check(o)     PyNumber_Check(o)
+  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
+                                (PyErr_Format(PyExc_TypeError, \
+                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
+                                 (PyObject*)0))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
+  #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
-
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
@@ -75,7 +70,6 @@
   #define PyVarObject_HEAD_INIT(type, size) \
           PyObject_HEAD_INIT(type) size,
   #define PyType_Modified(t)
-
   typedef struct {
      void *buf;
      PyObject *obj;
@@ -89,7 +83,6 @@
      Py_ssize_t *suboffsets;
      void *internal;
   } Py_buffer;
-
   #define PyBUF_SIMPLE 0
   #define PyBUF_WRITABLE 0x0001
   #define PyBUF_FORMAT 0x0004
@@ -101,11 +94,9 @@
   #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
   #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
   #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
-
   typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
   typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
 #endif
-
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
@@ -115,31 +106,30 @@
   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #endif
-
 #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
   #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define Py_TPFLAGS_CHECKTYPES 0
   #define Py_TPFLAGS_HAVE_INDEX 0
 #endif
-
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-
-
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
+                                              0 : _PyUnicode_Ready((PyObject *)(op)))
+  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
 #else
   #define CYTHON_PEP393_ENABLED 0
-  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+  #define __Pyx_PyUnicode_READY(op)       (0)
+  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
@@ -147,7 +137,6 @@
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
 #endif
-
 #if PY_VERSION_HEX < 0x02060000
   #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
@@ -166,7 +155,6 @@
   #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)
@@ -174,9 +162,7 @@
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
-
 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
-
 #if PY_MAJOR_VERSION >= 3
   #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
@@ -193,11 +179,9 @@
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyBoolObject                 PyLongObject
 #endif
-
 #if PY_VERSION_HEX < 0x03020000
   typedef long Py_hash_t;
   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
@@ -206,7 +190,6 @@
   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #endif
-
 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
   #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
   #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
@@ -225,11 +208,9 @@
         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
-
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
@@ -239,7 +220,6 @@
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 #endif
-
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_NAMESTR(n) ((char *)(n))
   #define __Pyx_DOCSTR(n)  ((char *)(n))
@@ -248,6 +228,7 @@
   #define __Pyx_DOCSTR(n)  (n)
 #endif
 
+
 #if PY_MAJOR_VERSION >= 3
   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
@@ -268,8 +249,8 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
-#define __PYX_HAVE__cvcf
-#define __PYX_HAVE_API__cvcf
+#define __PYX_HAVE__pysam__cvcf
+#define __PYX_HAVE_API__pysam__cvcf
 #include "stdlib.h"
 #include "string.h"
 #include "stdint.h"
@@ -335,7 +316,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
+#if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
 
 #ifdef __GNUC__
@@ -369,27 +354,27 @@ static const char *__pyx_f[] = {
 };
 
 /*--- Type declarations ---*/
-struct __pyx_obj_6ctabix_Parser;
-struct __pyx_obj_6ctabix_asVCF;
-struct __pyx_obj_10TabProxies_TupleProxy;
-struct __pyx_obj_10TabProxies_NamedTupleProxy;
-struct __pyx_obj_10TabProxies_BedProxy;
-struct __pyx_obj_6ctabix_tabix_copy_iterator;
-struct __pyx_obj_4cvcf_VCFRecord;
-struct __pyx_obj_10TabProxies_VCFProxy;
-struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse;
-struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data;
-struct __pyx_obj_6ctabix_TabixIterator;
-struct __pyx_obj_4cvcf_asVCFRecord;
-struct __pyx_obj_10TabProxies_GTFProxy;
-struct __pyx_obj_6ctabix_TabixIteratorParsed;
-struct __pyx_obj_6ctabix_TabixHeaderIterator;
-struct __pyx_obj_6ctabix_Tabixfile;
-struct __pyx_obj_6ctabix_asGTF;
-struct __pyx_obj_6ctabix_asBed;
-struct __pyx_obj_6ctabix_tabix_inplace_iterator;
-struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr;
-struct __pyx_obj_6ctabix_asTuple;
+struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data;
+struct __pyx_obj_5pysam_10TabProxies_TupleProxy;
+struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy;
+struct __pyx_obj_5pysam_10TabProxies_BedProxy;
+struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator;
+struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed;
+struct __pyx_obj_5pysam_6ctabix_TabixIterator;
+struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator;
+struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr;
+struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse;
+struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator;
+struct __pyx_obj_5pysam_6ctabix_Parser;
+struct __pyx_obj_5pysam_4cvcf_asVCFRecord;
+struct __pyx_obj_5pysam_6ctabix_Tabixfile;
+struct __pyx_obj_5pysam_6ctabix_asBed;
+struct __pyx_obj_5pysam_6ctabix_asGTF;
+struct __pyx_obj_5pysam_10TabProxies_VCFProxy;
+struct __pyx_obj_5pysam_4cvcf_VCFRecord;
+struct __pyx_obj_5pysam_6ctabix_asTuple;
+struct __pyx_obj_5pysam_10TabProxies_GTFProxy;
+struct __pyx_obj_5pysam_6ctabix_asVCF;
 struct __pyx_defaults;
 typedef struct __pyx_defaults __pyx_defaults;
 struct __pyx_defaults1;
@@ -417,27 +402,16 @@ struct __pyx_defaults4 {
   PyObject *__pyx_arg_lineparse;
 };
 
-/* "ctabix.pxd":190
- *     cdef tabix_t * tabixfile
- * 
- * cdef class Parser:             # <<<<<<<<<<<<<<
- *      pass
+/* "pysam/cvcf.pyx":647
+ *         return False
  * 
+ *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
+ *         cols = line.split('\t')
+ *         if len(cols) != len(self._samples)+9:
  */
-struct __pyx_obj_6ctabix_Parser {
+struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data {
   PyObject_HEAD
-};
-
-
-/* "ctabix.pxd":202
- *      pass
- * 
- * cdef class asVCF(Parser):             # <<<<<<<<<<<<<<
- *      pass
- * 
- */
-struct __pyx_obj_6ctabix_asVCF {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+  PyObject *__pyx_v_alt;
 };
 
 
@@ -448,9 +422,9 @@ struct __pyx_obj_6ctabix_asVCF {
  * 
  *     cdef:
  */
-struct __pyx_obj_10TabProxies_TupleProxy {
+struct __pyx_obj_5pysam_10TabProxies_TupleProxy {
   PyObject_HEAD
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab;
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy *__pyx_vtab;
   char *data;
   char **fields;
   int nfields;
@@ -468,8 +442,8 @@ struct __pyx_obj_10TabProxies_TupleProxy {
  *     pass
  * 
  */
-struct __pyx_obj_10TabProxies_NamedTupleProxy {
-  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
+struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy {
+  struct __pyx_obj_5pysam_10TabProxies_TupleProxy __pyx_base;
 };
 
 
@@ -480,8 +454,8 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
  * 
  *     cdef:
  */
-struct __pyx_obj_10TabProxies_BedProxy {
-  struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_obj_5pysam_10TabProxies_BedProxy {
+  struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
   char *contig;
   uint32_t start;
   uint32_t end;
@@ -489,58 +463,91 @@ struct __pyx_obj_10TabProxies_BedProxy {
 };
 
 
-/* "ctabix.pxd":218
- *     cdef __cnext__(self)
+/* "ctabix.pxd":186
+ *     cdef tabix_t * tabixfile
  * 
- * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef Parser parser
+ * cdef class TabixHeaderIterator:             # <<<<<<<<<<<<<<
+ *     cdef ti_iter_t iterator
+ *     cdef tabix_t * tabixfile
  */
-struct __pyx_obj_6ctabix_tabix_copy_iterator {
+struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator {
   PyObject_HEAD
-  struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtab;
-  FILE *infile;
-  struct __pyx_obj_6ctabix_Parser *parser;
+  ti_iter_t iterator;
+  tabix_t *tabixfile;
 };
 
 
-/* "cvcf.pyx":94
- * ###########################################################################################################
- * 
- * cdef class VCFRecord( TabProxies.TupleProxy):             # <<<<<<<<<<<<<<
- *     '''vcf record.
+/* "ctabix.pxd":205
+ *      pass
  * 
+ * cdef class TabixIteratorParsed:             # <<<<<<<<<<<<<<
+ *     cdef ti_iter_t iterator
+ *     cdef tabix_t * tabixfile
  */
-struct __pyx_obj_4cvcf_VCFRecord {
-  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
-  PyObject *vcf;
-  char *contig;
-  uint32_t pos;
+struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed {
+  PyObject_HEAD
+  ti_iter_t iterator;
+  tabix_t *tabixfile;
+  struct __pyx_obj_5pysam_6ctabix_Parser *parser;
 };
 
 
-/* "TabProxies.pxd":83
- *     cdef update( self, char * buffer, size_t nbytes )
+/* "ctabix.pxd":182
+ *     cdef char * _filename
  * 
- * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * cdef class TabixIterator:             # <<<<<<<<<<<<<<
+ *     cdef ti_iter_t iterator
+ *     cdef tabix_t * tabixfile
+ */
+struct __pyx_obj_5pysam_6ctabix_TabixIterator {
+  PyObject_HEAD
+  ti_iter_t iterator;
+  tabix_t *tabixfile;
+};
+
+
+/* "ctabix.pxd":210
+ *     cdef Parser parser
  * 
- *     cdef:
+ * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef char * buffer
  */
-struct __pyx_obj_10TabProxies_VCFProxy {
-  struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
-  char *contig;
-  uint32_t pos;
+struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator *__pyx_vtab;
+  FILE *infile;
+  char *buffer;
+  size_t size;
+  struct __pyx_obj_5pysam_6ctabix_Parser *parser;
+};
+
+
+/* "pysam/cvcf.pyx":790
+ *         if alt:
+ *             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]
+ */
+struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr {
+  PyObject_HEAD
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *__pyx_outer_scope;
+  PyObject *__pyx_v_allele;
+  PyObject *__pyx_t_0;
+  Py_ssize_t __pyx_t_1;
+  PyObject *(*__pyx_t_2)(PyObject *);
 };
 
 
-/* "cvcf.pyx":899
+/* "pysam/cvcf.pyx":899
  *         return line
  * 
  *     def _parse(self, line, stream):             # <<<<<<<<<<<<<<
  *         # deal with files with header only
  *         if line.startswith("##"): return
  */
-struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse {
+struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse {
   PyObject_HEAD
   PyObject *__pyx_v_d;
   PyObject *__pyx_v_line;
@@ -552,89 +559,46 @@ struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse {
 };
 
 
-/* "cvcf.pyx":647
- *         return False
+/* "ctabix.pxd":218
+ *     cdef __cnext__(self)
  * 
- *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
- *         cols = line.split('\t')
- *         if len(cols) != len(self._samples)+9:
+ * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef Parser parser
  */
-struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data {
+struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator {
   PyObject_HEAD
-  PyObject *__pyx_v_alt;
+  struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator *__pyx_vtab;
+  FILE *infile;
+  struct __pyx_obj_5pysam_6ctabix_Parser *parser;
 };
 
 
-/* "ctabix.pxd":182
- *     cdef char * _filename
- * 
- * cdef class TabixIterator:             # <<<<<<<<<<<<<<
- *     cdef ti_iter_t iterator
+/* "ctabix.pxd":190
  *     cdef tabix_t * tabixfile
+ * 
+ * cdef class Parser:             # <<<<<<<<<<<<<<
+ *      pass
+ * 
  */
-struct __pyx_obj_6ctabix_TabixIterator {
+struct __pyx_obj_5pysam_6ctabix_Parser {
   PyObject_HEAD
-  ti_iter_t iterator;
-  tabix_t *tabixfile;
 };
 
 
-/* "cvcf.pyx":226
+/* "pysam/cvcf.pyx":226
  * 
  * 
  * cdef class asVCFRecord( ctabix.Parser ):             # <<<<<<<<<<<<<<
  *     '''converts a :term:`tabix row` into a VCF record.'''
  *     cdef vcffile
  */
-struct __pyx_obj_4cvcf_asVCFRecord {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_4cvcf_asVCFRecord {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
   PyObject *vcffile;
 };
 
 
-/* "TabProxies.pxd":60
- *     cdef update( self, char * buffer, size_t nbytes )
- * 
- * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
- * 
- *     cdef:
- */
-struct __pyx_obj_10TabProxies_GTFProxy {
-  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
-  char *_attributes;
-  int hasOwnAttributes;
-};
-
-
-/* "ctabix.pxd":205
- *      pass
- * 
- * cdef class TabixIteratorParsed:             # <<<<<<<<<<<<<<
- *     cdef ti_iter_t iterator
- *     cdef tabix_t * tabixfile
- */
-struct __pyx_obj_6ctabix_TabixIteratorParsed {
-  PyObject_HEAD
-  ti_iter_t iterator;
-  tabix_t *tabixfile;
-  struct __pyx_obj_6ctabix_Parser *parser;
-};
-
-
-/* "ctabix.pxd":186
- *     cdef tabix_t * tabixfile
- * 
- * cdef class TabixHeaderIterator:             # <<<<<<<<<<<<<<
- *     cdef ti_iter_t iterator
- *     cdef tabix_t * tabixfile
- */
-struct __pyx_obj_6ctabix_TabixHeaderIterator {
-  PyObject_HEAD
-  ti_iter_t iterator;
-  tabix_t *tabixfile;
-};
-
-
 /* "ctabix.pxd":172
  *   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
  * 
@@ -642,7 +606,7 @@ struct __pyx_obj_6ctabix_TabixHeaderIterator {
  * 
  *     # pointer to tabixfile
  */
-struct __pyx_obj_6ctabix_Tabixfile {
+struct __pyx_obj_5pysam_6ctabix_Tabixfile {
   PyObject_HEAD
   tabix_t *tabixfile;
   int isremote;
@@ -650,61 +614,56 @@ struct __pyx_obj_6ctabix_Tabixfile {
 };
 
 
-/* "ctabix.pxd":196
+/* "ctabix.pxd":199
  *      pass
  * 
- * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
+ * cdef class asBed(Parser):             # <<<<<<<<<<<<<<
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asGTF {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_6ctabix_asBed {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
 };
 
 
-/* "ctabix.pxd":199
+/* "ctabix.pxd":196
  *      pass
  * 
- * cdef class asBed(Parser):             # <<<<<<<<<<<<<<
+ * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asBed {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_6ctabix_asGTF {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
 };
 
 
-/* "ctabix.pxd":210
- *     cdef Parser parser
+/* "TabProxies.pxd":83
+ *     cdef update( self, char * buffer, size_t nbytes )
  * 
- * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef char * buffer
+ * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * 
+ *     cdef:
  */
-struct __pyx_obj_6ctabix_tabix_inplace_iterator {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtab;
-  FILE *infile;
-  char *buffer;
-  size_t size;
-  struct __pyx_obj_6ctabix_Parser *parser;
+struct __pyx_obj_5pysam_10TabProxies_VCFProxy {
+  struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
+  char *contig;
+  uint32_t pos;
 };
 
 
-/* "cvcf.pyx":790
- *         if alt:
- *             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]
+/* "pysam/cvcf.pyx":94
+ * ###########################################################################################################
+ * 
+ * cdef class VCFRecord( TabProxies.TupleProxy):             # <<<<<<<<<<<<<<
+ *     '''vcf record.
+ * 
  */
-struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr {
-  PyObject_HEAD
-  struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *__pyx_outer_scope;
-  PyObject *__pyx_v_allele;
-  PyObject *__pyx_t_0;
-  Py_ssize_t __pyx_t_1;
-  PyObject *(*__pyx_t_2)(PyObject *);
+struct __pyx_obj_5pysam_4cvcf_VCFRecord {
+  struct __pyx_obj_5pysam_10TabProxies_TupleProxy __pyx_base;
+  PyObject *vcf;
+  char *contig;
+  uint32_t pos;
 };
 
 
@@ -715,24 +674,36 @@ struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr {
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asTuple {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_5pysam_6ctabix_asTuple {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
 };
 
 
-
-/* "ctabix.pxd":218
- *     cdef __cnext__(self)
+/* "TabProxies.pxd":60
+ *     cdef update( self, char * buffer, size_t nbytes )
  * 
- * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef Parser parser
+ * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
+ * 
+ *     cdef:
  */
+struct __pyx_obj_5pysam_10TabProxies_GTFProxy {
+  struct __pyx_obj_5pysam_10TabProxies_TupleProxy __pyx_base;
+  char *_attributes;
+  int hasOwnAttributes;
+};
+
 
-struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator {
-  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_copy_iterator *);
+/* "ctabix.pxd":202
+ *      pass
+ * 
+ * cdef class asVCF(Parser):             # <<<<<<<<<<<<<<
+ *      pass
+ * 
+ */
+struct __pyx_obj_5pysam_6ctabix_asVCF {
+  struct __pyx_obj_5pysam_6ctabix_Parser __pyx_base;
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabix_tabix_copy_iterator;
+
 
 
 /* "TabProxies.pxd":41
@@ -743,14 +714,14 @@ static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabi
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_TupleProxy {
-  int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t);
-  PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
-  PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
-  PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
-  PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
+struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy {
+  int (*getMaxFields)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, size_t);
+  PyObject *(*take)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
+  PyObject *(*present)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
+  PyObject *(*copy)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
+  PyObject *(*update)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t);
 };
-static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy *__pyx_vtabptr_5pysam_10TabProxies_TupleProxy;
 
 
 /* "TabProxies.pxd":69
@@ -761,10 +732,10 @@ static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxi
  * 
  */
 
-struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy *__pyx_vtabptr_5pysam_10TabProxies_NamedTupleProxy;
 
 
 /* "TabProxies.pxd":83
@@ -775,24 +746,38 @@ static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10Tab
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_VCFProxy {
-  struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy *__pyx_vtabptr_5pysam_10TabProxies_VCFProxy;
 
 
-/* "ctabix.pxd":210
- *     cdef Parser parser
+/* "pysam/cvcf.pyx":94
+ * ###########################################################################################################
  * 
- * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef char * buffer
+ * cdef class VCFRecord( TabProxies.TupleProxy):             # <<<<<<<<<<<<<<
+ *     '''vcf record.
+ * 
+ */
+
+struct __pyx_vtabstruct_5pysam_4cvcf_VCFRecord {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy __pyx_base;
+};
+static struct __pyx_vtabstruct_5pysam_4cvcf_VCFRecord *__pyx_vtabptr_5pysam_4cvcf_VCFRecord;
+
+
+/* "ctabix.pxd":210
+ *     cdef Parser parser
+ * 
+ * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef char * buffer
  */
 
-struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator {
-  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *);
+struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator {
+  PyObject *(*__pyx___cnext__)(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *);
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ctabix_tabix_inplace_iterator;
+static struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator;
 
 
 /* "TabProxies.pxd":60
@@ -803,25 +788,25 @@ static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ct
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_GTFProxy {
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
-  char *(*getAttributes)(struct __pyx_obj_10TabProxies_GTFProxy *);
+struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy __pyx_base;
+  char *(*getAttributes)(struct __pyx_obj_5pysam_10TabProxies_GTFProxy *);
 };
-static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy *__pyx_vtabptr_5pysam_10TabProxies_GTFProxy;
 
 
-/* "cvcf.pyx":94
- * ###########################################################################################################
- * 
- * cdef class VCFRecord( TabProxies.TupleProxy):             # <<<<<<<<<<<<<<
- *     '''vcf record.
+/* "ctabix.pxd":218
+ *     cdef __cnext__(self)
  * 
+ * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef Parser parser
  */
 
-struct __pyx_vtabstruct_4cvcf_VCFRecord {
-  struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator {
+  PyObject *(*__pyx___cnext__)(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *);
 };
-static struct __pyx_vtabstruct_4cvcf_VCFRecord *__pyx_vtabptr_4cvcf_VCFRecord;
+static struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator *__pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator;
 
 
 /* "TabProxies.pxd":72
@@ -832,10 +817,10 @@ static struct __pyx_vtabstruct_4cvcf_VCFRecord *__pyx_vtabptr_4cvcf_VCFRecord;
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_BedProxy {
-  struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy {
+  struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
+static struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy *__pyx_vtabptr_5pysam_10TabProxies_BedProxy;
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
@@ -912,42 +897,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
                                                     __Pyx_GetItemInt_List_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-    if (likely(o != Py_None)) {
-        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, i);
-            Py_INCREF(r);
-            return r;
-        }
-        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-            Py_INCREF(r);
-            return r;
-        }
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
 }
 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-    if (likely(o != Py_None)) {
-        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, i);
-            Py_INCREF(r);
-            return r;
-        }
-        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-            Py_INCREF(r);
-            return r;
-        }
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
 }
 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
     if (PyList_CheckExact(o)) {
         Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
         if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
@@ -963,13 +953,22 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
             Py_INCREF(r);
             return r;
         }
-    }
-    else if (likely(i >= 0)) {
+    } else {  /* inlined PySequence_GetItem() */
         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
         if (likely(m && m->sq_item)) {
+            if (unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (unlikely(l < 0)) return NULL;
+                i += l;
+            }
             return m->sq_item(o, i);
         }
     }
+#else
+    if (PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
 
@@ -981,21 +980,22 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
 
 static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
+#if CYTHON_COMPILING_IN_PYPY
+#define __Pyx_PyObject_AsDouble(obj) \
+(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
+ likely(PyInt_CheckExact(obj)) ? \
+ PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
+#else
 #define __Pyx_PyObject_AsDouble(obj) \
 ((likely(PyFloat_CheckExact(obj))) ? \
  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
+#endif
 
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 
-static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
-
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
-    if (unlikely(d == Py_None)) {
-        __Pyx_RaiseNoneIndexingError();
-        return NULL;
-    }
     value = PyDict_GetItemWithError(d, key);
     if (unlikely(!value)) {
         if (!PyErr_Occurred())
@@ -1009,28 +1009,48 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
 #endif
 
-static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
-    return unlikely(b < 0) ? b : !b;
-}
-static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
-    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
+static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
+    int result = PySequence_Contains(seq, item);
+    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
 }
 
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
+static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
+    int result = PyDict_Contains(dict, item);
+    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len)) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#endif
+
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     if (likely(PyList_CheckExact(L))) {
-        if (PyList_Append(L, x) < 0) return NULL;
+        if (unlikely(PyList_Append(L, x) < 0)) return NULL;
         Py_INCREF(Py_None);
         return Py_None; /* this is just to have an accurate signature */
-    }
-    else {
+    } else {
         PyObject *r, *m;
         m = __Pyx_GetAttrString(L, "append");
         if (!m) return NULL;
@@ -1040,6 +1060,18 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     }
 }
 
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
+
+static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
+                                             int is_tuple, int has_known_size, int decref_tuple);
+
+static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
+                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
+static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
+                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
+
 #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_SetItemInt_Fast(o, i, v) : \
                                                     __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
@@ -1051,6 +1083,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb
     return r;
 }
 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
+#if CYTHON_COMPILING_IN_CPYTHON
     if (PyList_CheckExact(o)) {
         Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
         if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
@@ -1060,13 +1093,26 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje
             Py_DECREF(old);
             return 1;
         }
-    }
-    else if (likely(i >= 0)) {
+    } else {  /* inlined PySequence_SetItem() */
         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
         if (likely(m && m->sq_ass_item)) {
+            if (unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (unlikely(l < 0)) return -1;
+                i += l;
+            }
             return m->sq_ass_item(o, i, v);
         }
     }
+#else
+#if CYTHON_COMPILING_IN_PYPY
+    if (PySequence_Check(o) && !PyDict_Check(o)) {
+#else
+    if (PySequence_Check(o)) {
+#endif
+        return PySequence_SetItem(o, i, v);
+    }
+#endif
     return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
 }
 
@@ -1105,6 +1151,12 @@ static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
 #endif /* PyAnySet_CheckExact (<= Py2.4) */
 #endif /* < Py2.5  */
 
+static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
+
+static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
+
+static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
@@ -1161,18 +1213,6 @@ static int __Pyx_CyFunction_init(void);
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
 
-#include <string.h>
-
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
-
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
-
-#if PY_MAJOR_VERSION >= 3
-#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
-#else
-#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
-#endif
-
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
 
 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
@@ -1209,22 +1249,30 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
 
 #define __Pyx_Generator_USED
 #include <structmember.h>
+#include <frameobject.h>
 typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
 typedef struct {
     PyObject_HEAD
     __pyx_generator_body_t body;
     PyObject *closure;
-    int is_running;
-    int resume_label;
     PyObject *exc_type;
     PyObject *exc_value;
     PyObject *exc_traceback;
     PyObject *gi_weakreflist;
     PyObject *classobj;
+    PyObject *yieldfrom;
+    int resume_label;
+    char is_running;  // using T_BOOL for property below requires char value
 } __pyx_GeneratorObject;
 static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                   PyObject *closure);
 static int __pyx_Generator_init(void);
+static int __Pyx_Generator_clear(PyObject* self);
+#if 1 || PY_VERSION_HEX < 0x030300B0
+static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
+#else
+#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
+#endif
 
 static int __Pyx_check_binary_version(void);
 
@@ -1236,10 +1284,10 @@ static int __Pyx_check_binary_version(void);
 #endif
 #endif
 
-static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/
-
 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/
+
 static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
 
 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
@@ -1264,36 +1312,38 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 
-/* Module declarations from 'ctabix' */
-static PyTypeObject *__pyx_ptype_6ctabix_Tabixfile = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_TabixIterator = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_TabixHeaderIterator = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_Parser = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asTuple = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asGTF = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asBed = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_asVCF = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_TabixIteratorParsed = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_tabix_inplace_iterator = 0;
-static PyTypeObject *__pyx_ptype_6ctabix_tabix_copy_iterator = 0;
-
-/* Module declarations from 'TabProxies' */
-static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0;
-static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0;
-
-/* Module declarations from 'cvcf' */
-static PyTypeObject *__pyx_ptype_4cvcf_VCFRecord = 0;
-static PyTypeObject *__pyx_ptype_4cvcf_asVCFRecord = 0;
-static PyTypeObject *__pyx_ptype_4cvcf___pyx_scope_struct__parse_data = 0;
-static PyTypeObject *__pyx_ptype_4cvcf___pyx_scope_struct_1_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cvcf___pyx_scope_struct_2__parse = 0;
-#define __Pyx_MODULE_NAME "cvcf"
-int __pyx_module_is_main_cvcf = 0;
-
-/* Implementation of 'cvcf' */
+/* Module declarations from 'pysam' */
+
+/* Module declarations from 'pysam.ctabix' */
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_Tabixfile = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_TabixIterator = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_TabixHeaderIterator = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_Parser = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asTuple = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asGTF = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asBed = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_asVCF = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_TabixIteratorParsed = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_tabix_inplace_iterator = 0;
+static PyTypeObject *__pyx_ptype_5pysam_6ctabix_tabix_copy_iterator = 0;
+
+/* Module declarations from 'pysam.TabProxies' */
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_TupleProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_GTFProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_NamedTupleProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_BedProxy = 0;
+static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_VCFProxy = 0;
+
+/* Module declarations from 'pysam.cvcf' */
+static PyTypeObject *__pyx_ptype_5pysam_4cvcf_VCFRecord = 0;
+static PyTypeObject *__pyx_ptype_5pysam_4cvcf_asVCFRecord = 0;
+static PyTypeObject *__pyx_ptype_5pysam_4cvcf___pyx_scope_struct__parse_data = 0;
+static PyTypeObject *__pyx_ptype_5pysam_4cvcf___pyx_scope_struct_1_genexpr = 0;
+static PyTypeObject *__pyx_ptype_5pysam_4cvcf___pyx_scope_struct_2__parse = 0;
+#define __Pyx_MODULE_NAME "pysam.cvcf"
+int __pyx_module_is_main_pysam__cvcf = 0;
+
+/* Implementation of 'pysam.cvcf' */
 static PyObject *__pyx_builtin_object;
 static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_range;
@@ -1304,73 +1354,73 @@ static PyObject *__pyx_builtin_zip;
 static PyObject *__pyx_builtin_StopIteration;
 static PyObject *__pyx_builtin_KeyError;
 static PyObject *__pyx_builtin_NotImplementedError;
-static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_fa); /* proto */
-static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string); /* proto */
-static int __pyx_pf_4cvcf_9VCFRecord___init__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf); /* proto */
-static int __pyx_pf_4cvcf_9VCFRecord_2__cinit__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_4error(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt); /* proto */
-static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_6__len__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
-static int __pyx_pf_4cvcf_11asVCFRecord___init__(struct __pyx_obj_4cvcf_asVCFRecord *__pyx_v_self, PyObject *__pyx_v_vcffile); /* proto */
-static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_asVCFRecord *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_85__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v__copy, PyObject *__pyx_v_reference, PyObject *__pyx_v_regions, PyObject *__pyx_v_lines, PyObject *__pyx_v_leftalign); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_87__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_format, PyObject *__pyx_v_filter); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_89__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_filter); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_alt); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_key, PyObject *__pyx_v_data, PyObject *__pyx_v_line); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_91__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_format, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_separator); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_GTstring); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_GTdata); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_line); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_93__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_10parse_data_genexpr(PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_lineparse); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_data); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_stream); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_samples); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_header); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_info); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filter); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_version); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_regions); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ref); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_datagenerator); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_pos1, PyObject *__pyx_v_ref1, PyObject *__pyx_v_alt1, PyObject *__pyx_v_pos2, PyObject *__pyx_v_ref2, PyObject *__pyx_v_alt2); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
-static PyObject *__pyx_pf_4cvcf_3VCF_83validate(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_record); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_fa); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string); /* proto */
+static int __pyx_pf_5pysam_4cvcf_9VCFRecord___init__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf); /* proto */
+static int __pyx_pf_5pysam_4cvcf_9VCFRecord_2__cinit__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4error(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt); /* proto */
+static Py_ssize_t __pyx_pf_5pysam_4cvcf_9VCFRecord_6__len__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6contig___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3pos___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_2id___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3ref___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
+static int __pyx_pf_5pysam_4cvcf_11asVCFRecord___init__(struct __pyx_obj_5pysam_4cvcf_asVCFRecord *__pyx_v_self, PyObject *__pyx_v_vcffile); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_5pysam_4cvcf_asVCFRecord *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_85__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v__copy, PyObject *__pyx_v_reference, PyObject *__pyx_v_regions, PyObject *__pyx_v_lines, PyObject *__pyx_v_leftalign); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_87__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_format, PyObject *__pyx_v_filter); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_89__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_filter); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_alt); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_key, PyObject *__pyx_v_data, PyObject *__pyx_v_line); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_91__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_format, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_separator); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_GTstring); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_GTdata); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_line); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_93__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10parse_data_genexpr(PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_lineparse); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_data); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_stream); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_samples); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_header); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_info); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filter); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_version); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_regions); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ref); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_datagenerator); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_pos1, PyObject *__pyx_v_ref1, PyObject *__pyx_v_alt1, PyObject *__pyx_v_pos2, PyObject *__pyx_v_ref2, PyObject *__pyx_v_alt2); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_83validate(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_record); /* proto */
 static char __pyx_k_1[] = "";
 static char __pyx_k_2[] = ",";
 static char __pyx_k_4[] = ":";
@@ -1469,41 +1519,42 @@ static char __pyx_k_126[] = "needs to be checked";
 static char __pyx_k_128[] = "[|/\\\\]";
 static char __pyx_k_130[] = "^[ACGTN]+$";
 static char __pyx_k_134[] = "/ifs/devel/pysam/pysam/cvcf.pyx";
-static char __pyx_k_137[] = "id numbertype number type description missingvalue";
-static char __pyx_k_139[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier";
-static char __pyx_k_140[] = "BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string";
-static char __pyx_k_141[] = "BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s";
-static char __pyx_k_142[] = "BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)";
-static char __pyx_k_143[] = "POS_NOT_NUMERICAL:Position column is not numerical";
-static char __pyx_k_144[] = "UNKNOWN_CHAR_IN_REF:Unknown character in reference field";
-static char __pyx_k_145[] = "V33_BAD_REF:Reference should be single-character in v3.3 VCF";
-static char __pyx_k_146[] = "V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF";
-static char __pyx_k_147[] = "POS_NOT_POSITIVE:Position field must be >0";
-static char __pyx_k_148[] = "QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'";
-static char __pyx_k_149[] = "ERROR_INFO_STRING:Error while parsing info field";
-static char __pyx_k_150[] = "ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)";
-static char __pyx_k_151[] = "ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s";
-static char __pyx_k_152[] = "ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string";
-static char __pyx_k_153[] = "FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header";
-static char __pyx_k_154[] = "FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header";
-static char __pyx_k_155[] = "BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)";
-static char __pyx_k_156[] = "BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)";
-static char __pyx_k_157[] = "BAD_GENOTYPE:Cannot parse genotype (%s)";
-static char __pyx_k_158[] = "V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)";
-static char __pyx_k_159[] = "MISSING_REF:Reference allele missing";
-static char __pyx_k_160[] = "V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)";
-static char __pyx_k_161[] = "V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets";
-static char __pyx_k_162[] = "FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes";
-static char __pyx_k_163[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields";
-static char __pyx_k_164[] = "HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs";
-static char __pyx_k_165[] = "WRONG_REF:Wrong reference %s";
-static char __pyx_k_166[] = "ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data";
-static char __pyx_k_167[] = "BAD_CHR_TAG:Error calculating chr tag for %s";
-static char __pyx_k_168[] = "ZERO_LENGTH_ALLELE:Found zero-length allele";
-static char __pyx_k_169[] = "MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base";
-static char __pyx_k_170[] = "ZERO_FOR_NON_FLAG_FIELD: number set to 0, but type is not 'FLAG'";
-static char __pyx_k_171[] = "ERROR_FORMAT_NOT_INTEGER:Expected integer in formatted field; got %s";
-static char __pyx_k_172[] = "ERROR_FLAG_HAS_VALUE:Flag fields should not have a value";
+static char __pyx_k_135[] = "pysam.cvcf";
+static char __pyx_k_138[] = "id numbertype number type description missingvalue";
+static char __pyx_k_140[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier";
+static char __pyx_k_141[] = "BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string";
+static char __pyx_k_142[] = "BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s";
+static char __pyx_k_143[] = "BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)";
+static char __pyx_k_144[] = "POS_NOT_NUMERICAL:Position column is not numerical";
+static char __pyx_k_145[] = "UNKNOWN_CHAR_IN_REF:Unknown character in reference field";
+static char __pyx_k_146[] = "V33_BAD_REF:Reference should be single-character in v3.3 VCF";
+static char __pyx_k_147[] = "V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF";
+static char __pyx_k_148[] = "POS_NOT_POSITIVE:Position field must be >0";
+static char __pyx_k_149[] = "QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'";
+static char __pyx_k_150[] = "ERROR_INFO_STRING:Error while parsing info field";
+static char __pyx_k_151[] = "ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)";
+static char __pyx_k_152[] = "ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s";
+static char __pyx_k_153[] = "ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string";
+static char __pyx_k_154[] = "FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header";
+static char __pyx_k_155[] = "FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header";
+static char __pyx_k_156[] = "BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)";
+static char __pyx_k_157[] = "BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)";
+static char __pyx_k_158[] = "BAD_GENOTYPE:Cannot parse genotype (%s)";
+static char __pyx_k_159[] = "V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)";
+static char __pyx_k_160[] = "MISSING_REF:Reference allele missing";
+static char __pyx_k_161[] = "V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)";
+static char __pyx_k_162[] = "V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets";
+static char __pyx_k_163[] = "FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes";
+static char __pyx_k_164[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields";
+static char __pyx_k_165[] = "HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs";
+static char __pyx_k_166[] = "WRONG_REF:Wrong reference %s";
+static char __pyx_k_167[] = "ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data";
+static char __pyx_k_168[] = "BAD_CHR_TAG:Error calculating chr tag for %s";
+static char __pyx_k_169[] = "ZERO_LENGTH_ALLELE:Found zero-length allele";
+static char __pyx_k_170[] = "MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base";
+static char __pyx_k_171[] = "ZERO_FOR_NON_FLAG_FIELD: number set to 0, but type is not 'FLAG'";
+static char __pyx_k_172[] = "ERROR_FORMAT_NOT_INTEGER:Expected integer in formatted field; got %s";
+static char __pyx_k_173[] = "ERROR_FLAG_HAS_VALUE:Flag fields should not have a value";
 static char __pyx_k__DP[] = "DP";
 static char __pyx_k__EC[] = "EC";
 static char __pyx_k__FT[] = "FT";
@@ -1556,7 +1607,6 @@ static char __pyx_k__alt1[] = "alt1";
 static char __pyx_k__alt2[] = "alt2";
 static char __pyx_k__cols[] = "cols";
 static char __pyx_k__copy[] = "copy";
-static char __pyx_k__cvcf[] = "cvcf";
 static char __pyx_k__data[] = "data";
 static char __pyx_k__dict[] = "dict";
 static char __pyx_k__elts[] = "elts";
@@ -1783,8 +1833,8 @@ static PyObject *__pyx_kp_s_126;
 static PyObject *__pyx_kp_s_128;
 static PyObject *__pyx_kp_s_130;
 static PyObject *__pyx_kp_s_134;
-static PyObject *__pyx_kp_s_137;
-static PyObject *__pyx_kp_s_139;
+static PyObject *__pyx_n_s_135;
+static PyObject *__pyx_kp_s_138;
 static PyObject *__pyx_kp_s_14;
 static PyObject *__pyx_kp_s_140;
 static PyObject *__pyx_kp_s_141;
@@ -1819,6 +1869,7 @@ static PyObject *__pyx_kp_s_169;
 static PyObject *__pyx_kp_s_170;
 static PyObject *__pyx_kp_s_171;
 static PyObject *__pyx_kp_s_172;
+static PyObject *__pyx_kp_s_173;
 static PyObject *__pyx_n_s_18;
 static PyObject *__pyx_kp_s_19;
 static PyObject *__pyx_kp_s_2;
@@ -2000,7 +2051,6 @@ static PyObject *__pyx_n_s__connect;
 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__d;
 static PyObject *__pyx_n_s__data;
 static PyObject *__pyx_n_s__datagenerator;
@@ -2253,111 +2303,110 @@ static PyObject *__pyx_k_tuple_127;
 static PyObject *__pyx_k_tuple_129;
 static PyObject *__pyx_k_tuple_131;
 static PyObject *__pyx_k_tuple_132;
-static PyObject *__pyx_k_tuple_135;
-static PyObject *__pyx_k_tuple_138;
-static PyObject *__pyx_k_tuple_173;
-static PyObject *__pyx_k_tuple_175;
-static PyObject *__pyx_k_tuple_177;
+static PyObject *__pyx_k_tuple_136;
+static PyObject *__pyx_k_tuple_139;
+static PyObject *__pyx_k_tuple_174;
+static PyObject *__pyx_k_tuple_176;
 static PyObject *__pyx_k_tuple_178;
-static PyObject *__pyx_k_tuple_180;
-static PyObject *__pyx_k_tuple_182;
-static PyObject *__pyx_k_tuple_184;
-static PyObject *__pyx_k_tuple_186;
-static PyObject *__pyx_k_tuple_188;
-static PyObject *__pyx_k_tuple_190;
-static PyObject *__pyx_k_tuple_192;
-static PyObject *__pyx_k_tuple_194;
-static PyObject *__pyx_k_tuple_196;
-static PyObject *__pyx_k_tuple_198;
-static PyObject *__pyx_k_tuple_200;
-static PyObject *__pyx_k_tuple_202;
-static PyObject *__pyx_k_tuple_204;
-static PyObject *__pyx_k_tuple_206;
-static PyObject *__pyx_k_tuple_208;
-static PyObject *__pyx_k_tuple_210;
-static PyObject *__pyx_k_tuple_212;
-static PyObject *__pyx_k_tuple_214;
-static PyObject *__pyx_k_tuple_216;
-static PyObject *__pyx_k_tuple_218;
-static PyObject *__pyx_k_tuple_220;
-static PyObject *__pyx_k_tuple_222;
-static PyObject *__pyx_k_tuple_224;
-static PyObject *__pyx_k_tuple_226;
-static PyObject *__pyx_k_tuple_228;
-static PyObject *__pyx_k_tuple_230;
-static PyObject *__pyx_k_tuple_232;
-static PyObject *__pyx_k_tuple_234;
-static PyObject *__pyx_k_tuple_236;
-static PyObject *__pyx_k_tuple_238;
-static PyObject *__pyx_k_tuple_240;
-static PyObject *__pyx_k_tuple_242;
-static PyObject *__pyx_k_tuple_244;
-static PyObject *__pyx_k_tuple_246;
-static PyObject *__pyx_k_tuple_248;
-static PyObject *__pyx_k_tuple_250;
-static PyObject *__pyx_k_tuple_252;
-static PyObject *__pyx_k_tuple_254;
-static PyObject *__pyx_k_tuple_256;
+static PyObject *__pyx_k_tuple_179;
+static PyObject *__pyx_k_tuple_181;
+static PyObject *__pyx_k_tuple_183;
+static PyObject *__pyx_k_tuple_185;
+static PyObject *__pyx_k_tuple_187;
+static PyObject *__pyx_k_tuple_189;
+static PyObject *__pyx_k_tuple_191;
+static PyObject *__pyx_k_tuple_193;
+static PyObject *__pyx_k_tuple_195;
+static PyObject *__pyx_k_tuple_197;
+static PyObject *__pyx_k_tuple_199;
+static PyObject *__pyx_k_tuple_201;
+static PyObject *__pyx_k_tuple_203;
+static PyObject *__pyx_k_tuple_205;
+static PyObject *__pyx_k_tuple_207;
+static PyObject *__pyx_k_tuple_209;
+static PyObject *__pyx_k_tuple_211;
+static PyObject *__pyx_k_tuple_213;
+static PyObject *__pyx_k_tuple_215;
+static PyObject *__pyx_k_tuple_217;
+static PyObject *__pyx_k_tuple_219;
+static PyObject *__pyx_k_tuple_221;
+static PyObject *__pyx_k_tuple_223;
+static PyObject *__pyx_k_tuple_225;
+static PyObject *__pyx_k_tuple_227;
+static PyObject *__pyx_k_tuple_229;
+static PyObject *__pyx_k_tuple_231;
+static PyObject *__pyx_k_tuple_233;
+static PyObject *__pyx_k_tuple_235;
+static PyObject *__pyx_k_tuple_237;
+static PyObject *__pyx_k_tuple_239;
+static PyObject *__pyx_k_tuple_241;
+static PyObject *__pyx_k_tuple_243;
+static PyObject *__pyx_k_tuple_245;
+static PyObject *__pyx_k_tuple_247;
+static PyObject *__pyx_k_tuple_249;
+static PyObject *__pyx_k_tuple_251;
+static PyObject *__pyx_k_tuple_253;
+static PyObject *__pyx_k_tuple_255;
 static PyObject *__pyx_k_tuple_257;
+static PyObject *__pyx_k_tuple_258;
 static PyObject *__pyx_k_codeobj_133;
-static PyObject *__pyx_k_codeobj_136;
-static PyObject *__pyx_k_codeobj_174;
-static PyObject *__pyx_k_codeobj_176;
-static PyObject *__pyx_k_codeobj_179;
-static PyObject *__pyx_k_codeobj_181;
-static PyObject *__pyx_k_codeobj_183;
-static PyObject *__pyx_k_codeobj_185;
-static PyObject *__pyx_k_codeobj_187;
-static PyObject *__pyx_k_codeobj_189;
-static PyObject *__pyx_k_codeobj_191;
-static PyObject *__pyx_k_codeobj_193;
-static PyObject *__pyx_k_codeobj_195;
-static PyObject *__pyx_k_codeobj_197;
-static PyObject *__pyx_k_codeobj_199;
-static PyObject *__pyx_k_codeobj_201;
-static PyObject *__pyx_k_codeobj_203;
-static PyObject *__pyx_k_codeobj_205;
-static PyObject *__pyx_k_codeobj_207;
-static PyObject *__pyx_k_codeobj_209;
-static PyObject *__pyx_k_codeobj_211;
-static PyObject *__pyx_k_codeobj_213;
-static PyObject *__pyx_k_codeobj_215;
-static PyObject *__pyx_k_codeobj_217;
-static PyObject *__pyx_k_codeobj_219;
-static PyObject *__pyx_k_codeobj_221;
-static PyObject *__pyx_k_codeobj_223;
-static PyObject *__pyx_k_codeobj_225;
-static PyObject *__pyx_k_codeobj_227;
-static PyObject *__pyx_k_codeobj_229;
-static PyObject *__pyx_k_codeobj_231;
-static PyObject *__pyx_k_codeobj_233;
-static PyObject *__pyx_k_codeobj_235;
-static PyObject *__pyx_k_codeobj_237;
-static PyObject *__pyx_k_codeobj_239;
-static PyObject *__pyx_k_codeobj_241;
-static PyObject *__pyx_k_codeobj_243;
-static PyObject *__pyx_k_codeobj_245;
-static PyObject *__pyx_k_codeobj_247;
-static PyObject *__pyx_k_codeobj_249;
-static PyObject *__pyx_k_codeobj_251;
-static PyObject *__pyx_k_codeobj_253;
-static PyObject *__pyx_k_codeobj_255;
-static PyObject *__pyx_k_codeobj_258;
+static PyObject *__pyx_k_codeobj_137;
+static PyObject *__pyx_k_codeobj_175;
+static PyObject *__pyx_k_codeobj_177;
+static PyObject *__pyx_k_codeobj_180;
+static PyObject *__pyx_k_codeobj_182;
+static PyObject *__pyx_k_codeobj_184;
+static PyObject *__pyx_k_codeobj_186;
+static PyObject *__pyx_k_codeobj_188;
+static PyObject *__pyx_k_codeobj_190;
+static PyObject *__pyx_k_codeobj_192;
+static PyObject *__pyx_k_codeobj_194;
+static PyObject *__pyx_k_codeobj_196;
+static PyObject *__pyx_k_codeobj_198;
+static PyObject *__pyx_k_codeobj_200;
+static PyObject *__pyx_k_codeobj_202;
+static PyObject *__pyx_k_codeobj_204;
+static PyObject *__pyx_k_codeobj_206;
+static PyObject *__pyx_k_codeobj_208;
+static PyObject *__pyx_k_codeobj_210;
+static PyObject *__pyx_k_codeobj_212;
+static PyObject *__pyx_k_codeobj_214;
+static PyObject *__pyx_k_codeobj_216;
+static PyObject *__pyx_k_codeobj_218;
+static PyObject *__pyx_k_codeobj_220;
+static PyObject *__pyx_k_codeobj_222;
+static PyObject *__pyx_k_codeobj_224;
+static PyObject *__pyx_k_codeobj_226;
+static PyObject *__pyx_k_codeobj_228;
+static PyObject *__pyx_k_codeobj_230;
+static PyObject *__pyx_k_codeobj_232;
+static PyObject *__pyx_k_codeobj_234;
+static PyObject *__pyx_k_codeobj_236;
+static PyObject *__pyx_k_codeobj_238;
+static PyObject *__pyx_k_codeobj_240;
+static PyObject *__pyx_k_codeobj_242;
+static PyObject *__pyx_k_codeobj_244;
+static PyObject *__pyx_k_codeobj_246;
+static PyObject *__pyx_k_codeobj_248;
+static PyObject *__pyx_k_codeobj_250;
+static PyObject *__pyx_k_codeobj_252;
+static PyObject *__pyx_k_codeobj_254;
+static PyObject *__pyx_k_codeobj_256;
+static PyObject *__pyx_k_codeobj_259;
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_1get_sequence = {__Pyx_NAMESTR("get_sequence"), (PyCFunction)__pyx_pw_4cvcf_1get_sequence, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_1get_sequence = {__Pyx_NAMESTR("get_sequence"), (PyCFunction)__pyx_pw_5pysam_4cvcf_1get_sequence, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_chrom = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_fa = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__fa,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("get_sequence (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__fa,0};
     PyObject* values[4] = {0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -2373,24 +2422,20 @@ static PyObject *__pyx_pw_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fa);
-        if (likely(values[3])) kw_args--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fa)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -2415,16 +2460,16 @@ static PyObject *__pyx_pw_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.get_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.get_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_get_sequence(__pyx_self, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_fa);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_get_sequence(__pyx_self, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_fa);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":58
+/* "pysam/cvcf.pyx":58
  * 
  * # Utility function.  Uses 0-based coordinates
  * def get_sequence(chrom, start, end, fa):             # <<<<<<<<<<<<<<
@@ -2432,7 +2477,7 @@ static PyObject *__pyx_pw_4cvcf_1get_sequence(PyObject *__pyx_self, PyObject *__
  *     if end<=start: return ""
  */
 
-static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_fa) {
+static PyObject *__pyx_pf_5pysam_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_fa) {
   PyObject *__pyx_v_sequence = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -2448,15 +2493,14 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_sequence", 0);
 
-  /* "cvcf.pyx":60
+  /* "pysam/cvcf.pyx":60
  * 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()
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_v_start, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_v_start, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
@@ -2468,7 +2512,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":61
+  /* "pysam/cvcf.pyx":61
  *     # obtain sequence from .fa file, without truncation
  *     if end<=start: return ""
  *     if not fa: return "N"*(end-start)             # <<<<<<<<<<<<<<
@@ -2491,15 +2535,14 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L4:;
 
-  /* "cvcf.pyx":62
+  /* "pysam/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()             # <<<<<<<<<<<<<<
  *     sequence = fa.fetch(chrom, start, end).upper()
  *     if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); 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_4 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_3) {
@@ -2546,7 +2589,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L5:;
 
-  /* "cvcf.pyx":63
+  /* "pysam/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()             # <<<<<<<<<<<<<<
@@ -2579,7 +2622,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_v_sequence = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":64
+  /* "pysam/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))             # <<<<<<<<<<<<<<
@@ -2591,8 +2634,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_6 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2620,7 +2662,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":65
+  /* "pysam/cvcf.pyx":65
  *     sequence = fa.fetch(chrom, start, end).upper()
  *     if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))
  *     return sequence             # <<<<<<<<<<<<<<
@@ -2639,7 +2681,7 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_AddTraceback("cvcf.get_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.get_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_sequence);
@@ -2649,19 +2691,18 @@ static PyObject *__pyx_pf_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__pyx_self,
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3parse_regions = {__Pyx_NAMESTR("parse_regions"), (PyCFunction)__pyx_pw_4cvcf_3parse_regions, METH_O, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3parse_regions = {__Pyx_NAMESTR("parse_regions"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3parse_regions, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_regions (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_2parse_regions(__pyx_self, ((PyObject *)__pyx_v_string));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_2parse_regions(__pyx_self, ((PyObject *)__pyx_v_string));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":68
+/* "pysam/cvcf.pyx":68
  * 
  * # Utility function.  Parses a region string
  * def parse_regions( string ):             # <<<<<<<<<<<<<<
@@ -2669,7 +2710,7 @@ static PyObject *__pyx_pw_4cvcf_3parse_regions(PyObject *__pyx_self, PyObject *_
  *     for r in string.split(','):
  */
 
-static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string) {
+static PyObject *__pyx_pf_5pysam_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string) {
   PyObject *__pyx_v_result = NULL;
   PyObject *__pyx_v_r = NULL;
   PyObject *__pyx_v_elts = NULL;
@@ -2698,7 +2739,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("parse_regions", 0);
 
-  /* "cvcf.pyx":69
+  /* "pysam/cvcf.pyx":69
  * # Utility function.  Parses a region string
  * def parse_regions( string ):
  *     result = []             # <<<<<<<<<<<<<<
@@ -2710,7 +2751,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_v_result = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":70
+  /* "pysam/cvcf.pyx":70
  * def parse_regions( string ):
  *     result = []
  *     for r in string.split(','):             # <<<<<<<<<<<<<<
@@ -2734,10 +2775,18 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
   for (;;) {
     if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_2 = __pyx_t_4(__pyx_t_1);
       if (unlikely(!__pyx_t_2)) {
@@ -2753,7 +2802,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
     __pyx_v_r = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":71
+    /* "pysam/cvcf.pyx":71
  *     result = []
  *     for r in string.split(','):
  *         elts = r.split(':')             # <<<<<<<<<<<<<<
@@ -2769,7 +2818,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
     __pyx_v_elts = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":72
+    /* "pysam/cvcf.pyx":72
  *     for r in string.split(','):
  *         elts = r.split(':')
  *         chrom, start, end = elts[0], 0, 3000000000             # <<<<<<<<<<<<<<
@@ -2792,7 +2841,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
     __pyx_v_end = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":73
+    /* "pysam/cvcf.pyx":73
  *         elts = r.split(':')
  *         chrom, start, end = elts[0], 0, 3000000000
  *         if len(elts)==1: pass             # <<<<<<<<<<<<<<
@@ -2805,7 +2854,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
       goto __pyx_L5;
     }
 
-    /* "cvcf.pyx":74
+    /* "pysam/cvcf.pyx":74
  *         chrom, start, end = elts[0], 0, 3000000000
  *         if len(elts)==1: pass
  *         elif len(elts)==2:             # <<<<<<<<<<<<<<
@@ -2816,7 +2865,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
     __pyx_t_8 = (__pyx_t_7 == 2);
     if (__pyx_t_8) {
 
-      /* "cvcf.pyx":75
+      /* "pysam/cvcf.pyx":75
  *         if len(elts)==1: pass
  *         elif len(elts)==2:
  *             if len(elts[1])>0:             # <<<<<<<<<<<<<<
@@ -2830,7 +2879,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
       __pyx_t_8 = (__pyx_t_7 > 0);
       if (__pyx_t_8) {
 
-        /* "cvcf.pyx":76
+        /* "pysam/cvcf.pyx":76
  *         elif len(elts)==2:
  *             if len(elts[1])>0:
  *                 ielts = elts[1].split('-')             # <<<<<<<<<<<<<<
@@ -2849,7 +2898,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
         __pyx_v_ielts = __pyx_t_6;
         __pyx_t_6 = 0;
 
-        /* "cvcf.pyx":77
+        /* "pysam/cvcf.pyx":77
  *             if len(elts[1])>0:
  *                 ielts = elts[1].split('-')
  *                 if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)             # <<<<<<<<<<<<<<
@@ -2874,7 +2923,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
         }
         __pyx_L7:;
 
-        /* "cvcf.pyx":78
+        /* "pysam/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])             # <<<<<<<<<<<<<<
@@ -2926,7 +2975,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-          /* "cvcf.pyx":79
+          /* "pysam/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)             # <<<<<<<<<<<<<<
@@ -2934,7 +2983,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
  *             raise ValueError("Don't understand region string '%s'" % r)
  */
           /*except:*/ {
-            __Pyx_AddTraceback("cvcf.parse_regions", __pyx_clineno, __pyx_lineno, __pyx_filename);
+            __Pyx_AddTraceback("pysam.cvcf.parse_regions", __pyx_clineno, __pyx_lineno, __pyx_filename);
             if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
             __Pyx_GOTREF(__pyx_t_6);
             __Pyx_GOTREF(__pyx_t_2);
@@ -2977,7 +3026,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
     }
     /*else*/ {
 
-      /* "cvcf.pyx":81
+      /* "pysam/cvcf.pyx":81
  *                 except: raise ValueError("Don't understand region string '%s'" % r)
  *         else:
  *             raise ValueError("Don't understand region string '%s'" % r)             # <<<<<<<<<<<<<<
@@ -3000,7 +3049,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
     }
     __pyx_L5:;
 
-    /* "cvcf.pyx":82
+    /* "pysam/cvcf.pyx":82
  *         else:
  *             raise ValueError("Don't understand region string '%s'" % r)
  *         result.append( (chrom,start,end) )             # <<<<<<<<<<<<<<
@@ -3023,7 +3072,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":83
+  /* "pysam/cvcf.pyx":83
  *             raise ValueError("Don't understand region string '%s'" % r)
  *         result.append( (chrom,start,end) )
  *     return result             # <<<<<<<<<<<<<<
@@ -3044,7 +3093,7 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_12);
   __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_AddTraceback("cvcf.parse_regions", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.parse_regions", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_result);
@@ -3060,14 +3109,14 @@ static PyObject *__pyx_pf_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__pyx_sel
 }
 
 /* Python wrapper */
-static int __pyx_pw_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_5pysam_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcf = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -3080,8 +3129,7 @@ static int __pyx_pw_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -3098,16 +3146,16 @@ static int __pyx_pw_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, 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("cvcf.VCFRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord___init__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self), __pyx_v_vcf);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord___init__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self), __pyx_v_vcf);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":104
+/* "pysam/cvcf.pyx":104
  *     cdef uint32_t pos
  * 
  *     def __init__(self, vcf):             # <<<<<<<<<<<<<<
@@ -3115,12 +3163,12 @@ static int __pyx_pw_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject
  *         # if len(data) != len(self.vcf._samples):
  */
 
-static int __pyx_pf_4cvcf_9VCFRecord___init__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf) {
+static int __pyx_pf_5pysam_4cvcf_9VCFRecord___init__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__", 0);
 
-  /* "cvcf.pyx":105
+  /* "pysam/cvcf.pyx":105
  * 
  *     def __init__(self, vcf):
  *         self.vcf = vcf             # <<<<<<<<<<<<<<
@@ -3139,14 +3187,14 @@ static int __pyx_pf_4cvcf_9VCFRecord___init__(struct __pyx_obj_4cvcf_VCFRecord *
 }
 
 /* Python wrapper */
-static int __pyx_pw_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_5pysam_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcf = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -3159,8 +3207,7 @@ static int __pyx_pw_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -3177,16 +3224,16 @@ static int __pyx_pw_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCFRecord.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_2__cinit__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self), __pyx_v_vcf);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_2__cinit__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self), __pyx_v_vcf);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":115
+/* "pysam/cvcf.pyx":115
  *         #                     len(data)))
  * 
  *     def __cinit__(self, vcf ):             # <<<<<<<<<<<<<<
@@ -3194,12 +3241,12 @@ static int __pyx_pw_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject
  *         self.offset = 9
  */
 
-static int __pyx_pf_4cvcf_9VCFRecord_2__cinit__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf) {
+static int __pyx_pf_5pysam_4cvcf_9VCFRecord_2__cinit__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_vcf) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "cvcf.pyx":117
+  /* "pysam/cvcf.pyx":117
  *     def __cinit__(self, vcf ):
  *         # start indexed access at genotypes
  *         self.offset = 9             # <<<<<<<<<<<<<<
@@ -3208,7 +3255,7 @@ static int __pyx_pf_4cvcf_9VCFRecord_2__cinit__(struct __pyx_obj_4cvcf_VCFRecord
  */
   __pyx_v_self->__pyx_base.offset = 9;
 
-  /* "cvcf.pyx":119
+  /* "pysam/cvcf.pyx":119
  *         self.offset = 9
  * 
  *         self.vcf = vcf             # <<<<<<<<<<<<<<
@@ -3227,20 +3274,20 @@ static int __pyx_pf_4cvcf_9VCFRecord_2__cinit__(struct __pyx_obj_4cvcf_VCFRecord
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_9VCFRecord_4error[] = "raise error.";
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_9VCFRecord_4error[] = "raise error.";
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_error = 0;
   PyObject *__pyx_v_opt = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("error (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
     PyObject* values[3] = {0,0,0};
 
-    /* "cvcf.pyx":121
+    /* "pysam/cvcf.pyx":121
  *         self.vcf = vcf
  * 
  *     def error(self,line,error,opt=None):             # <<<<<<<<<<<<<<
@@ -3261,12 +3308,10 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("error", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -3296,16 +3341,16 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self, PyObje
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("error", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCFRecord.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_4error(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self), __pyx_v_line, __pyx_v_error, __pyx_v_opt);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_4error(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self), __pyx_v_line, __pyx_v_error, __pyx_v_opt);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_4error(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4error(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3316,7 +3361,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4error(struct __pyx_obj_4cvcf_VCFReco
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("error", 0);
 
-  /* "cvcf.pyx":124
+  /* "pysam/cvcf.pyx":124
  *         '''raise error.'''
  *         # pass to vcf file for error handling
  *         return self.vcf.error( line, error, opt )             # <<<<<<<<<<<<<<
@@ -3351,7 +3396,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4error(struct __pyx_obj_4cvcf_VCFReco
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCFRecord.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3359,7 +3404,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4error(struct __pyx_obj_4cvcf_VCFReco
   return __pyx_r;
 }
 
-/* "cvcf.pyx":126
+/* "pysam/cvcf.pyx":126
  *         return self.vcf.error( line, error, opt )
  * 
  *     cdef update( self, char * buffer, size_t nbytes ):             # <<<<<<<<<<<<<<
@@ -3367,7 +3412,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4error(struct __pyx_obj_4cvcf_VCFReco
  * 
  */
 
-static PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) {
+static PyObject *__pyx_f_5pysam_4cvcf_9VCFRecord_update(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3376,18 +3421,18 @@ static PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFRecor
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("update", 0);
 
-  /* "cvcf.pyx":131
+  /* "pysam/cvcf.pyx":131
  *         nbytes does not include the terminal '\0'.
  *         '''
  *         TabProxies.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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_vtabptr_5pysam_10TabProxies_TupleProxy->update(((struct __pyx_obj_5pysam_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); 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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":133
+  /* "pysam/cvcf.pyx":133
  *         TabProxies.TupleProxy.update( self, buffer, nbytes )
  * 
  *         self.contig = self.fields[0]             # <<<<<<<<<<<<<<
@@ -3396,7 +3441,7 @@ static PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFRecor
  */
   __pyx_v_self->contig = (__pyx_v_self->__pyx_base.fields[0]);
 
-  /* "cvcf.pyx":135
+  /* "pysam/cvcf.pyx":135
  *         self.contig = self.fields[0]
  *         # vcf counts from 1 - correct here
  *         self.pos = atoi( self.fields[1] ) - 1             # <<<<<<<<<<<<<<
@@ -3409,7 +3454,7 @@ static PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFRecor
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCFRecord.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3418,17 +3463,17 @@ static PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFRecor
 }
 
 /* Python wrapper */
-static Py_ssize_t __pyx_pw_4cvcf_9VCFRecord_7__len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pw_4cvcf_9VCFRecord_7__len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pw_5pysam_4cvcf_9VCFRecord_7__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pw_5pysam_4cvcf_9VCFRecord_7__len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_6__len__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_6__len__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":137
+/* "pysam/cvcf.pyx":137
  *         self.pos = atoi( self.fields[1] ) - 1
  * 
  *     def __len__(self):             # <<<<<<<<<<<<<<
@@ -3436,7 +3481,7 @@ static Py_ssize_t __pyx_pw_4cvcf_9VCFRecord_7__len__(PyObject *__pyx_v_self) {
  * 
  */
 
-static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_6__len__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_5pysam_4cvcf_9VCFRecord_6__len__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   __Pyx_RefNannyDeclarations
   long __pyx_t_1;
@@ -3444,7 +3489,7 @@ static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_6__len__(struct __pyx_obj_4cvcf_VCFR
   long __pyx_t_3;
   __Pyx_RefNannySetupContext("__len__", 0);
 
-  /* "cvcf.pyx":138
+  /* "pysam/cvcf.pyx":138
  * 
  *     def __len__(self):
  *         return max(0, self.nfields - 9)             # <<<<<<<<<<<<<<
@@ -3468,17 +3513,17 @@ static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_6__len__(struct __pyx_obj_4cvcf_VCFR
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_6contig_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_6contig_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_6contig_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_6contig_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_6contig___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_6contig___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":141
+/* "pysam/cvcf.pyx":141
  * 
  *     property contig:
  *         def __get__(self): return self.contig             # <<<<<<<<<<<<<<
@@ -3486,7 +3531,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_6contig_1__get__(PyObject *__pyx_v_se
  *     property pos:
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6contig___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3505,7 +3550,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(struct __pyx_obj_4cvc
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCFRecord.contig.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.contig.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3514,17 +3559,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(struct __pyx_obj_4cvc
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_3pos_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_3pos_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_3pos___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_3pos___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":144
+/* "pysam/cvcf.pyx":144
  * 
  *     property pos:
  *         def __get__(self): return self.pos             # <<<<<<<<<<<<<<
@@ -3532,7 +3577,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_3pos_1__get__(PyObject *__pyx_v_self)
  *     property id:
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3pos___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3551,7 +3596,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(struct __pyx_obj_4cvcf_V
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCFRecord.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3560,17 +3605,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(struct __pyx_obj_4cvcf_V
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_2id_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_2id_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_2id___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_2id___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":147
+/* "pysam/cvcf.pyx":147
  * 
  *     property id:
  *         def __get__(self): return self.fields[2]             # <<<<<<<<<<<<<<
@@ -3578,7 +3623,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_2id_1__get__(PyObject *__pyx_v_self)
  *     property ref:
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_2id___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3597,7 +3642,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(struct __pyx_obj_4cvcf_VC
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCFRecord.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3606,17 +3651,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(struct __pyx_obj_4cvcf_VC
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_3ref_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_3ref_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_3ref___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_3ref___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":150
+/* "pysam/cvcf.pyx":150
  * 
  *     property ref:
  *         def __get__(self): return self.fields[3]             # <<<<<<<<<<<<<<
@@ -3624,7 +3669,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_3ref_1__get__(PyObject *__pyx_v_self)
  *     property alt:
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3ref___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3643,7 +3688,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(struct __pyx_obj_4cvcf_V
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCFRecord.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3652,17 +3697,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(struct __pyx_obj_4cvcf_V
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_3alt_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_3alt_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_3alt_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_3alt_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_3alt___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_3alt___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":153
+/* "pysam/cvcf.pyx":153
  * 
  *     property alt:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -3670,7 +3715,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_3alt_1__get__(PyObject *__pyx_v_self)
  *             alt = self.fields[4]
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_v_alt = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -3682,7 +3727,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_V
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "cvcf.pyx":155
+  /* "pysam/cvcf.pyx":155
  *         def __get__(self):
  *             # convert v3.3 to v4.0 alleles below
  *             alt = self.fields[4]             # <<<<<<<<<<<<<<
@@ -3694,14 +3739,16 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_V
   __pyx_v_alt = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":156
+  /* "pysam/cvcf.pyx":156
  *             # convert v3.3 to v4.0 alleles below
  *             alt = self.fields[4]
  *             if alt == ".": alt = []             # <<<<<<<<<<<<<<
  *             else: alt = alt.upper().split(',')
  *             return alt
  */
-  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_alt, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __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 = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
     __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_GOTREF(__pyx_t_1);
@@ -3712,7 +3759,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_V
   }
   /*else*/ {
 
-    /* "cvcf.pyx":157
+    /* "pysam/cvcf.pyx":157
  *             alt = self.fields[4]
  *             if alt == ".": alt = []
  *             else: alt = alt.upper().split(',')             # <<<<<<<<<<<<<<
@@ -3736,7 +3783,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_V
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":158
+  /* "pysam/cvcf.pyx":158
  *             if alt == ".": alt = []
  *             else: alt = alt.upper().split(',')
  *             return alt             # <<<<<<<<<<<<<<
@@ -3753,7 +3800,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_V
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCFRecord.alt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.alt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_alt);
@@ -3763,17 +3810,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_4cvcf_V
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_4qual_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_4qual_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_4qual___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_4qual___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":161
+/* "pysam/cvcf.pyx":161
  * 
  *     property qual:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -3781,7 +3828,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_4qual_1__get__(PyObject *__pyx_v_self
  *             if qual == b".": qual = -1
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_v_qual = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -3802,7 +3849,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "cvcf.pyx":162
+  /* "pysam/cvcf.pyx":162
  *     property qual:
  *         def __get__(self):
  *             qual = self.fields[5]             # <<<<<<<<<<<<<<
@@ -3814,14 +3861,16 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
   __pyx_v_qual = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":163
+  /* "pysam/cvcf.pyx":163
  *         def __get__(self):
  *             qual = self.fields[5]
  *             if qual == b".": qual = -1             # <<<<<<<<<<<<<<
  *             else:
  *                 try:    qual = float(qual)
  */
-  __pyx_t_2 = __Pyx_PyBytes_Equals(__pyx_v_qual, ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, ((PyObject *)__pyx_kp_b_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __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 = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
     __Pyx_INCREF(__pyx_int_neg_1);
     __Pyx_DECREF(__pyx_v_qual);
@@ -3830,7 +3879,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":165
+    /* "pysam/cvcf.pyx":165
  *             if qual == b".": qual = -1
  *             else:
  *                 try:    qual = float(qual)             # <<<<<<<<<<<<<<
@@ -3857,7 +3906,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
       __pyx_L4_error:;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "cvcf.pyx":166
+      /* "pysam/cvcf.pyx":166
  *             else:
  *                 try:    qual = float(qual)
  *                 except: self.vcf.error(str(self),self.QUAL_NOT_NUMERICAL)             # <<<<<<<<<<<<<<
@@ -3865,7 +3914,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
  *     property filter:
  */
       /*except:*/ {
-        __Pyx_AddTraceback("cvcf.VCFRecord.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+        __Pyx_AddTraceback("pysam.cvcf.VCFRecord.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
         if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_GOTREF(__pyx_t_7);
@@ -3926,7 +3975,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
   __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_AddTraceback("cvcf.VCFRecord.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_qual);
@@ -3936,17 +3985,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj_4cvcf_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_6filter_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_6filter_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_6filter_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_6filter_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_6filter___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_6filter___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":169
+/* "pysam/cvcf.pyx":169
  * 
  *     property filter:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -3954,7 +4003,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_6filter_1__get__(PyObject *__pyx_v_se
  *             # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   char *__pyx_v_f;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -3969,7 +4018,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvc
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "cvcf.pyx":170
+  /* "pysam/cvcf.pyx":170
  *     property filter:
  *         def __get__(self):
  *             f = self.fields[6]             # <<<<<<<<<<<<<<
@@ -3978,7 +4027,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvc
  */
   __pyx_v_f = (__pyx_v_self->__pyx_base.fields[6]);
 
-  /* "cvcf.pyx":172
+  /* "pysam/cvcf.pyx":172
  *             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 []             # <<<<<<<<<<<<<<
@@ -3987,24 +4036,21 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvc
  */
   __pyx_t_1 = PyBytes_FromString(__pyx_v_f); 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_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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 172; __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 = 172; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_b__PASS), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 172; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b__0), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -4027,7 +4073,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvc
   }
   /*else*/ {
 
-    /* "cvcf.pyx":173
+    /* "pysam/cvcf.pyx":173
  *             # 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(';')             # <<<<<<<<<<<<<<
@@ -4054,7 +4100,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvc
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("cvcf.VCFRecord.filter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.filter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4063,17 +4109,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(struct __pyx_obj_4cvc
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_4info_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_4info_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_4info___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_4info___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":176
+/* "pysam/cvcf.pyx":176
  * 
  *     property info:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -4081,7 +4127,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_4info_1__get__(PyObject *__pyx_v_self
  *             # dictionary of keys, and list of values
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   char *__pyx_v_col;
   PyObject *__pyx_v_info = NULL;
   PyObject *__pyx_v_blurp = NULL;
@@ -4104,7 +4150,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "cvcf.pyx":177
+  /* "pysam/cvcf.pyx":177
  *     property info:
  *         def __get__(self):
  *             col = self.fields[7]             # <<<<<<<<<<<<<<
@@ -4113,7 +4159,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
  */
   __pyx_v_col = (__pyx_v_self->__pyx_base.fields[7]);
 
-  /* "cvcf.pyx":179
+  /* "pysam/cvcf.pyx":179
  *             col = self.fields[7]
  *             # dictionary of keys, and list of values
  *             info = {}             # <<<<<<<<<<<<<<
@@ -4125,7 +4171,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
   __pyx_v_info = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":180
+  /* "pysam/cvcf.pyx":180
  *             # dictionary of keys, and list of values
  *             info = {}
  *             if col != b".":             # <<<<<<<<<<<<<<
@@ -4134,14 +4180,13 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
  */
   __pyx_t_1 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":181
+    /* "pysam/cvcf.pyx":181
  *             info = {}
  *             if col != b".":
  *                 for blurp in col.split(';'):             # <<<<<<<<<<<<<<
@@ -4168,10 +4213,18 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
     for (;;) {
       if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
         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++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
         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++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
         __pyx_t_2 = __pyx_t_5(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -4187,7 +4240,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
       __pyx_v_blurp = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":182
+      /* "pysam/cvcf.pyx":182
  *             if col != b".":
  *                 for blurp in col.split(';'):
  *                     elts = blurp.split('=')             # <<<<<<<<<<<<<<
@@ -4203,7 +4256,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
       __pyx_v_elts = __pyx_t_6;
       __pyx_t_6 = 0;
 
-      /* "cvcf.pyx":183
+      /* "pysam/cvcf.pyx":183
  *                 for blurp in col.split(';'):
  *                     elts = blurp.split('=')
  *                     if len(elts) == 1: v = None             # <<<<<<<<<<<<<<
@@ -4219,7 +4272,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
         goto __pyx_L6;
       }
 
-      /* "cvcf.pyx":184
+      /* "pysam/cvcf.pyx":184
  *                     elts = blurp.split('=')
  *                     if len(elts) == 1: v = None
  *                     elif len(elts) == 2: v = elts[1]             # <<<<<<<<<<<<<<
@@ -4238,7 +4291,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
       }
       /*else*/ {
 
-        /* "cvcf.pyx":185
+        /* "pysam/cvcf.pyx":185
  *                     if len(elts) == 1: v = None
  *                     elif len(elts) == 2: v = elts[1]
  *                     else: self.vcf.error(str(self),self.ERROR_INFO_STRING)             # <<<<<<<<<<<<<<
@@ -4273,7 +4326,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
       }
       __pyx_L6:;
 
-      /* "cvcf.pyx":186
+      /* "pysam/cvcf.pyx":186
  *                     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))             # <<<<<<<<<<<<<<
@@ -4324,7 +4377,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":187
+  /* "pysam/cvcf.pyx":187
  *                     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             # <<<<<<<<<<<<<<
@@ -4345,7 +4398,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_AddTraceback("cvcf.VCFRecord.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_info);
@@ -4358,17 +4411,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj_4cvcf_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_6format_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_6format_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_6format___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_6format___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":190
+/* "pysam/cvcf.pyx":190
  * 
  *     property format:
  *          def __get__(self):             # <<<<<<<<<<<<<<
@@ -4376,7 +4429,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_6format_1__get__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -4386,7 +4439,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_4cvc
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "cvcf.pyx":191
+  /* "pysam/cvcf.pyx":191
  *     property format:
  *          def __get__(self):
  *              return self.fields[8].split(':')             # <<<<<<<<<<<<<<
@@ -4411,7 +4464,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_4cvc
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("cvcf.VCFRecord.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4420,17 +4473,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(struct __pyx_obj_4cvc
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_7samples_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_7samples_1__get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_7samples_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_7samples_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_7samples___get__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_7samples___get__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":194
+/* "pysam/cvcf.pyx":194
  * 
  *     property samples:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -4438,7 +4491,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_7samples_1__get__(PyObject *__pyx_v_s
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -4447,7 +4500,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_4cv
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "cvcf.pyx":195
+  /* "pysam/cvcf.pyx":195
  *     property samples:
  *         def __get__(self):
  *             return self.vcf._samples             # <<<<<<<<<<<<<<
@@ -4465,7 +4518,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_4cv
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCFRecord.samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4474,17 +4527,17 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(struct __pyx_obj_4cv
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
-static PyObject *__pyx_pw_4cvcf_9VCFRecord_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_4cvcf_9VCFRecord_8__getitem__(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self), ((PyObject *)__pyx_v_key));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_v_self), ((PyObject *)__pyx_v_key));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":197
+/* "pysam/cvcf.pyx":197
  *             return self.vcf._samples
  * 
  *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
@@ -4492,7 +4545,7 @@ static PyObject *__pyx_pw_4cvcf_9VCFRecord_9__getitem__(PyObject *__pyx_v_self,
  *         # parse sample columns
  */
 
-static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_key) {
+static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_self, PyObject *__pyx_v_key) {
   PyObject *__pyx_v_values = NULL;
   PyObject *__pyx_v_alt = NULL;
   PyObject *__pyx_v_format = NULL;
@@ -4520,7 +4573,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__getitem__", 0);
 
-  /* "cvcf.pyx":200
+  /* "pysam/cvcf.pyx":200
  * 
  *         # parse sample columns
  *         values = self.fields[self.vcf._sample2column[key]].split(':')             # <<<<<<<<<<<<<<
@@ -4545,7 +4598,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   __pyx_v_values = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":201
+  /* "pysam/cvcf.pyx":201
  *         # parse sample columns
  *         values = self.fields[self.vcf._sample2column[key]].split(':')
  *         alt = self.alt             # <<<<<<<<<<<<<<
@@ -4557,7 +4610,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   __pyx_v_alt = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":202
+  /* "pysam/cvcf.pyx":202
  *         values = self.fields[self.vcf._sample2column[key]].split(':')
  *         alt = self.alt
  *         format = self.format             # <<<<<<<<<<<<<<
@@ -4569,7 +4622,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   __pyx_v_format = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":204
+  /* "pysam/cvcf.pyx":204
  *         format = self.format
  * 
  *         if len(values) > len(format):             # <<<<<<<<<<<<<<
@@ -4581,7 +4634,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   __pyx_t_5 = (__pyx_t_3 > __pyx_t_4);
   if (__pyx_t_5) {
 
-    /* "cvcf.pyx":205
+    /* "pysam/cvcf.pyx":205
  * 
  *         if len(values) > len(format):
  *             self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\             # <<<<<<<<<<<<<<
@@ -4603,7 +4656,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_18); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
 
-    /* "cvcf.pyx":206
+    /* "pysam/cvcf.pyx":206
  *         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)))             # <<<<<<<<<<<<<<
@@ -4650,7 +4703,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":208
+  /* "pysam/cvcf.pyx":208
  *                            (len(values),key,len(format)))
  * 
  *         result = {}             # <<<<<<<<<<<<<<
@@ -4662,7 +4715,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   __pyx_v_result = __pyx_t_8;
   __pyx_t_8 = 0;
 
-  /* "cvcf.pyx":209
+  /* "pysam/cvcf.pyx":209
  * 
  *         result = {}
  *         for idx in range(len(format)):             # <<<<<<<<<<<<<<
@@ -4692,10 +4745,18 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   for (;;) {
     if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_8 = __pyx_t_10(__pyx_t_9);
       if (unlikely(!__pyx_t_8)) {
@@ -4711,7 +4772,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     __pyx_v_idx = __pyx_t_8;
     __pyx_t_8 = 0;
 
-    /* "cvcf.pyx":210
+    /* "pysam/cvcf.pyx":210
  *         result = {}
  *         for idx in range(len(format)):
  *             expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)             # <<<<<<<<<<<<<<
@@ -4743,7 +4804,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     __pyx_v_expected = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":211
+    /* "pysam/cvcf.pyx":211
  *         for idx in range(len(format)):
  *             expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)
  *             if idx < len(values): value = values[idx]             # <<<<<<<<<<<<<<
@@ -4753,8 +4814,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__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_1 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_6, Py_LT); if (unlikely(!__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_1 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 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;
@@ -4768,15 +4828,14 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     }
     /*else*/ {
 
-      /* "cvcf.pyx":213
+      /* "pysam/cvcf.pyx":213
  *             if idx < len(values): value = values[idx]
  *             else:
  *                 if expected == -1: value = "."             # <<<<<<<<<<<<<<
  *                 else: value = ",".join(["."]*expected)
  * 
  */
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_5) {
@@ -4787,7 +4846,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
       }
       /*else*/ {
 
-        /* "cvcf.pyx":214
+        /* "pysam/cvcf.pyx":214
  *             else:
  *                 if expected == -1: value = "."
  *                 else: value = ",".join(["."]*expected)             # <<<<<<<<<<<<<<
@@ -4823,7 +4882,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     }
     __pyx_L6:;
 
-    /* "cvcf.pyx":216
+    /* "pysam/cvcf.pyx":216
  *                 else: value = ",".join(["."]*expected)
  * 
  *             result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data))             # <<<<<<<<<<<<<<
@@ -4870,15 +4929,14 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":217
+    /* "pysam/cvcf.pyx":217
  * 
  *             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,
  *                            "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_5) {
@@ -4891,8 +4949,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -4902,7 +4959,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
     }
     if (__pyx_t_12) {
 
-      /* "cvcf.pyx":218
+      /* "pysam/cvcf.pyx":218
  *             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,             # <<<<<<<<<<<<<<
@@ -4924,7 +4981,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
       __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_20); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
 
-      /* "cvcf.pyx":219
+      /* "pysam/cvcf.pyx":219
  *             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]]))             # <<<<<<<<<<<<<<
@@ -4969,7 +5026,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
       __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
 
-      /* "cvcf.pyx":220
+      /* "pysam/cvcf.pyx":220
  *                 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]]))             # <<<<<<<<<<<<<<
@@ -4985,8 +5042,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_13 = PyObject_RichCompare(__pyx_t_8, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_13);
+      __pyx_t_13 = PyObject_RichCompare(__pyx_t_8, __pyx_v_expected, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
@@ -5037,7 +5093,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
       }
       __pyx_L9:;
 
-      /* "cvcf.pyx":221
+      /* "pysam/cvcf.pyx":221
  *                            "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]             # <<<<<<<<<<<<<<
@@ -5064,7 +5120,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   }
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-  /* "cvcf.pyx":223
+  /* "pysam/cvcf.pyx":223
  *                 result[format[idx]] = result[format[idx]][:expected]
  * 
  *         return result             # <<<<<<<<<<<<<<
@@ -5086,7 +5142,7 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_AddTraceback("cvcf.VCFRecord.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCFRecord.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_values);
@@ -5102,14 +5158,14 @@ static PyObject *__pyx_pf_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_4cvcf_V
 }
 
 /* Python wrapper */
-static int __pyx_pw_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pw_5pysam_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_5pysam_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcffile = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcffile,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcffile,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5122,8 +5178,7 @@ static int __pyx_pw_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcffile);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcffile)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -5140,16 +5195,16 @@ static int __pyx_pw_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObje
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.asVCFRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.asVCFRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_11asVCFRecord___init__(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self), __pyx_v_vcffile);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_11asVCFRecord___init__(((struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)__pyx_v_self), __pyx_v_vcffile);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":229
+/* "pysam/cvcf.pyx":229
  *     '''converts a :term:`tabix row` into a VCF record.'''
  *     cdef vcffile
  *     def __init__(self, vcffile ):             # <<<<<<<<<<<<<<
@@ -5157,12 +5212,12 @@ static int __pyx_pw_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObje
  *     def __call__(self, char * buffer, int len ):
  */
 
-static int __pyx_pf_4cvcf_11asVCFRecord___init__(struct __pyx_obj_4cvcf_asVCFRecord *__pyx_v_self, PyObject *__pyx_v_vcffile) {
+static int __pyx_pf_5pysam_4cvcf_11asVCFRecord___init__(struct __pyx_obj_5pysam_4cvcf_asVCFRecord *__pyx_v_self, PyObject *__pyx_v_vcffile) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__", 0);
 
-  /* "cvcf.pyx":230
+  /* "pysam/cvcf.pyx":230
  *     cdef vcffile
  *     def __init__(self, vcffile ):
  *         self.vcffile = vcffile             # <<<<<<<<<<<<<<
@@ -5181,15 +5236,15 @@ static int __pyx_pf_4cvcf_11asVCFRecord___init__(struct __pyx_obj_4cvcf_asVCFRec
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pw_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_5pysam_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5203,12 +5258,10 @@ static PyObject *__pyx_pw_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5229,16 +5282,16 @@ static PyObject *__pyx_pw_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self,
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.asVCFRecord.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.asVCFRecord.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_11asVCFRecord_2__call__(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_11asVCFRecord_2__call__(((struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":231
+/* "pysam/cvcf.pyx":231
  *     def __init__(self, vcffile ):
  *         self.vcffile = vcffile
  *     def __call__(self, char * buffer, int len ):             # <<<<<<<<<<<<<<
@@ -5246,8 +5299,8 @@ static PyObject *__pyx_pw_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self,
  *         r = VCFRecord( self.vcffile )
  */
 
-static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_asVCFRecord *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
-  struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_r = 0;
+static PyObject *__pyx_pf_5pysam_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_5pysam_4cvcf_asVCFRecord *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
+  struct __pyx_obj_5pysam_4cvcf_VCFRecord *__pyx_v_r = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5257,7 +5310,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_a
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__call__", 0);
 
-  /* "cvcf.pyx":233
+  /* "pysam/cvcf.pyx":233
  *     def __call__(self, char * buffer, int len ):
  *         cdef VCFRecord r
  *         r = VCFRecord( self.vcffile )             # <<<<<<<<<<<<<<
@@ -5269,24 +5322,24 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_a
   __Pyx_INCREF(__pyx_v_self->vcffile);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->vcffile);
   __Pyx_GIVEREF(__pyx_v_self->vcffile);
-  __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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_4cvcf_VCFRecord)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_v_r = ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_t_2);
+  __pyx_v_r = ((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":234
+  /* "pysam/cvcf.pyx":234
  *         cdef VCFRecord r
  *         r = VCFRecord( self.vcffile )
  *         r.copy( buffer, len )             # <<<<<<<<<<<<<<
  *         return r
  * 
  */
-  __pyx_t_2 = ((struct __pyx_vtabstruct_4cvcf_VCFRecord *)__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_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((struct __pyx_vtabstruct_5pysam_4cvcf_VCFRecord *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_5pysam_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":235
+  /* "pysam/cvcf.pyx":235
  *         r = VCFRecord( self.vcffile )
  *         r.copy( buffer, len )
  *         return r             # <<<<<<<<<<<<<<
@@ -5303,7 +5356,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_a
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("cvcf.asVCFRecord.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.asVCFRecord.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_r);
@@ -5312,7 +5365,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_a
   return __pyx_r;
 }
 
-/* "cvcf.pyx":314
+/* "pysam/cvcf.pyx":314
  *     _lines = None
  * 
  *     def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):             # <<<<<<<<<<<<<<
@@ -5320,7 +5373,7 @@ static PyObject *__pyx_pf_4cvcf_11asVCFRecord_2__call__(struct __pyx_obj_4cvcf_a
  *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_85__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_85__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5354,7 +5407,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_85__defaults__(CYTHON_UNUSED PyObject *__py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -5363,21 +5416,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_85__defaults__(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_4cvcf_3VCF_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v__copy = 0;
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_regions = 0;
   PyObject *__pyx_v_lines = 0;
   PyObject *__pyx_v_leftalign = 0;
-  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};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    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};
     PyObject* values[6] = {0,0,0,0,0,0};
     __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
     values[1] = ((PyObject *)((PyObject *)Py_None));
@@ -5401,8 +5453,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyObject *_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -5456,16 +5507,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyObject *_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF___init__(__pyx_self, __pyx_v_self, __pyx_v__copy, __pyx_v_reference, __pyx_v_regions, __pyx_v_lines, __pyx_v_leftalign);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF___init__(__pyx_self, __pyx_v_self, __pyx_v__copy, __pyx_v_reference, __pyx_v_regions, __pyx_v_lines, __pyx_v_leftalign);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v__copy, PyObject *__pyx_v_reference, PyObject *__pyx_v_regions, PyObject *__pyx_v_lines, PyObject *__pyx_v_leftalign) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v__copy, PyObject *__pyx_v_reference, PyObject *__pyx_v_regions, PyObject *__pyx_v_lines, PyObject *__pyx_v_leftalign) {
   PyObject *__pyx_v_id = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -5481,7 +5532,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__init__", 0);
 
-  /* "cvcf.pyx":316
+  /* "pysam/cvcf.pyx":316
  *     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             # <<<<<<<<<<<<<<
@@ -5508,10 +5559,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   for (;;) {
     if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_1 = __pyx_t_4(__pyx_t_2);
       if (unlikely(!__pyx_t_1)) {
@@ -5548,20 +5607,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":317
+  /* "pysam/cvcf.pyx":317
  *         # 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[:]
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v__copy, Py_None, Py_NE); 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_2 = PyObject_RichCompare(__pyx_v__copy, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_7) {
 
-    /* "cvcf.pyx":318
+    /* "pysam/cvcf.pyx":318
  *         for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
  *         if _copy != None:
  *             self._leftalign = _copy._leftalign             # <<<<<<<<<<<<<<
@@ -5573,7 +5631,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___leftalign, __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;
 
-    /* "cvcf.pyx":319
+    /* "pysam/cvcf.pyx":319
  *         if _copy != None:
  *             self._leftalign = _copy._leftalign
  *             self._header = _copy._header[:]             # <<<<<<<<<<<<<<
@@ -5588,7 +5646,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___header, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":320
+    /* "pysam/cvcf.pyx":320
  *             self._leftalign = _copy._leftalign
  *             self._header = _copy._header[:]
  *             self._version = _copy._version             # <<<<<<<<<<<<<<
@@ -5600,7 +5658,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":321
+    /* "pysam/cvcf.pyx":321
  *             self._header = _copy._header[:]
  *             self._version = _copy._version
  *             self._info = copy.deepcopy(_copy._info)             # <<<<<<<<<<<<<<
@@ -5626,7 +5684,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___info, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":322
+    /* "pysam/cvcf.pyx":322
  *             self._version = _copy._version
  *             self._info = copy.deepcopy(_copy._info)
  *             self._filter = copy.deepcopy(_copy._filter)             # <<<<<<<<<<<<<<
@@ -5652,7 +5710,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___filter, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":323
+    /* "pysam/cvcf.pyx":323
  *             self._info = copy.deepcopy(_copy._info)
  *             self._filter = copy.deepcopy(_copy._filter)
  *             self._format = copy.deepcopy(_copy._format)             # <<<<<<<<<<<<<<
@@ -5678,7 +5736,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___format, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":324
+    /* "pysam/cvcf.pyx":324
  *             self._filter = copy.deepcopy(_copy._filter)
  *             self._format = copy.deepcopy(_copy._format)
  *             self._samples = _copy._samples[:]             # <<<<<<<<<<<<<<
@@ -5693,7 +5751,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":325
+    /* "pysam/cvcf.pyx":325
  *             self._format = copy.deepcopy(_copy._format)
  *             self._samples = _copy._samples[:]
  *             self._sample2column = copy.deepcopy(_copy._sample2column)             # <<<<<<<<<<<<<<
@@ -5719,7 +5777,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sample2column, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":326
+    /* "pysam/cvcf.pyx":326
  *             self._samples = _copy._samples[:]
  *             self._sample2column = copy.deepcopy(_copy._sample2column)
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)             # <<<<<<<<<<<<<<
@@ -5745,7 +5803,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___ignored_errors, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":327
+    /* "pysam/cvcf.pyx":327
  *             self._sample2column = copy.deepcopy(_copy._sample2column)
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
  *             self._warn_errors = copy.deepcopy(_copy._warn_errors)             # <<<<<<<<<<<<<<
@@ -5771,7 +5829,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___warn_errors, __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;
 
-    /* "cvcf.pyx":328
+    /* "pysam/cvcf.pyx":328
  *             self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
  *             self._warn_errors = copy.deepcopy(_copy._warn_errors)
  *             self._reference = _copy._reference             # <<<<<<<<<<<<<<
@@ -5783,7 +5841,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___reference, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":329
+    /* "pysam/cvcf.pyx":329
  *             self._warn_errors = copy.deepcopy(_copy._warn_errors)
  *             self._reference = _copy._reference
  *             self._regions = _copy._regions             # <<<<<<<<<<<<<<
@@ -5798,7 +5856,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   }
   __pyx_L5:;
 
-  /* "cvcf.pyx":330
+  /* "pysam/cvcf.pyx":330
  *             self._reference = _copy._reference
  *             self._regions = _copy._regions
  *         if reference: self._reference = reference             # <<<<<<<<<<<<<<
@@ -5812,7 +5870,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":331
+  /* "pysam/cvcf.pyx":331
  *             self._regions = _copy._regions
  *         if reference: self._reference = reference
  *         if regions: self._regions = regions             # <<<<<<<<<<<<<<
@@ -5826,7 +5884,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   }
   __pyx_L7:;
 
-  /* "cvcf.pyx":332
+  /* "pysam/cvcf.pyx":332
  *         if reference: self._reference = reference
  *         if regions: self._regions = regions
  *         if leftalign: self._leftalign = leftalign             # <<<<<<<<<<<<<<
@@ -5840,7 +5898,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   }
   __pyx_L8:;
 
-  /* "cvcf.pyx":333
+  /* "pysam/cvcf.pyx":333
  *         if regions: self._regions = regions
  *         if leftalign: self._leftalign = leftalign
  *         self._lines = lines             # <<<<<<<<<<<<<<
@@ -5856,7 +5914,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_AddTraceback("cvcf.VCF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_id);
@@ -5866,22 +5924,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__pyx_self
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_3error = {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pw_4cvcf_3VCF_3error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_3error = {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_3error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_error = 0;
   PyObject *__pyx_v_opt = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("error (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "cvcf.pyx":335
+    /* "pysam/cvcf.pyx":335
  *         self._lines = lines
  * 
  *     def error(self,line,error,opt=None):             # <<<<<<<<<<<<<<
@@ -5903,18 +5960,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObject *__py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5946,16 +6000,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObject *__py
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_2error(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_error, __pyx_v_opt);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_2error(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_error, __pyx_v_opt);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_error, PyObject *__pyx_v_opt) {
   PyObject *__pyx_v_errorlabel = NULL;
   PyObject *__pyx_v_errorstring = NULL;
   PyObject *__pyx_v_errwarn = NULL;
@@ -5972,7 +6026,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("error", 0);
 
-  /* "cvcf.pyx":336
+  /* "pysam/cvcf.pyx":336
  * 
  *     def error(self,line,error,opt=None):
  *         if error in self._ignored_errors: return             # <<<<<<<<<<<<<<
@@ -5981,7 +6035,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___ignored_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = ((PySequence_Contains(__pyx_t_1, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_error, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 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;
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
@@ -5991,7 +6045,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":337
+  /* "pysam/cvcf.pyx":337
  *     def error(self,line,error,opt=None):
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')             # <<<<<<<<<<<<<<
@@ -6011,27 +6065,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
     PyObject* sequence = __pyx_t_3;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    Py_ssize_t size = Py_SIZE(sequence);
+    #else
+    Py_ssize_t size = PySequence_Size(sequence);
+    #endif
+    if (unlikely(size != 2)) {
+      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
-      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
     } else {
-      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
     }
     __Pyx_INCREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_t_4);
+    #else
+    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #endif
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  } else {
+  } else
+  {
     Py_ssize_t index = -1;
     __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
@@ -6042,12 +6102,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
     index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = NULL;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+    __pyx_t_6 = NULL;
+    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
@@ -6056,7 +6117,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_v_errorstring = __pyx_t_4;
   __pyx_t_4 = 0;
 
-  /* "cvcf.pyx":338
+  /* "pysam/cvcf.pyx":338
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')
  *         if opt: errorstring = errorstring % opt             # <<<<<<<<<<<<<<
@@ -6074,7 +6135,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":339
+  /* "pysam/cvcf.pyx":339
  *         errorlabel, errorstring = self._errors[error].split(':')
  *         if opt: errorstring = errorstring % opt
  *         errwarn = ["Error","Warning"][error in self._warn_errors]             # <<<<<<<<<<<<<<
@@ -6091,7 +6152,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Warning));
   __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 = 339; __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 = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_error, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __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 = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -6099,7 +6160,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_v_errwarn = __pyx_t_4;
   __pyx_t_4 = 0;
 
-  /* "cvcf.pyx":340
+  /* "pysam/cvcf.pyx":340
  *         if opt: errorstring = errorstring % opt
  *         errwarn = ["Error","Warning"][error in self._warn_errors]
  *         errorstring += " in line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)             # <<<<<<<<<<<<<<
@@ -6135,7 +6196,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_v_errorstring = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":341
+  /* "pysam/cvcf.pyx":341
  *         errwarn = ["Error","Warning"][error in self._warn_errors]
  *         errorstring += " in line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)
  *         if error in self._warn_errors: return             # <<<<<<<<<<<<<<
@@ -6144,7 +6205,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
  */
   __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 = 341; __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_error, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
@@ -6154,7 +6215,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   }
   __pyx_L7:;
 
-  /* "cvcf.pyx":342
+  /* "pysam/cvcf.pyx":342
  *         errorstring += " in line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)
  *         if error in self._warn_errors: return
  *         raise ValueError(errorstring)             # <<<<<<<<<<<<<<
@@ -6180,7 +6241,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("cvcf.VCF.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_errorlabel);
@@ -6191,7 +6252,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
   return __pyx_r;
 }
 
-/* "cvcf.pyx":344
+/* "pysam/cvcf.pyx":344
  *         raise ValueError(errorstring)
  * 
  *     def parse_format(self,line,format,filter=False):             # <<<<<<<<<<<<<<
@@ -6199,7 +6260,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx_self,
  *             if not format.startswith('<'):
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_87__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_87__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -6221,7 +6282,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_87__defaults__(CYTHON_UNUSED PyObject *__py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -6230,19 +6291,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_87__defaults__(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_5parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_5parse_format = {__Pyx_NAMESTR("parse_format"), (PyCFunction)__pyx_pw_4cvcf_3VCF_5parse_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_5parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_5parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_5parse_format = {__Pyx_NAMESTR("parse_format"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_5parse_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_5parse_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;
   PyObject *__pyx_v_filter = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__format,&__pyx_n_s__filter,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_format (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__format,&__pyx_n_s__filter,0};
     PyObject* values[4] = {0,0,0,0};
     __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
     values[3] = __pyx_dynamic_args->__pyx_arg_filter;
@@ -6260,18 +6320,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_5parse_format(PyObject *__pyx_self, PyObjec
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -6303,16 +6360,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_5parse_format(PyObject *__pyx_self, PyObjec
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_4parse_format(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_format, __pyx_v_filter);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_4parse_format(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_format, __pyx_v_filter);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_format, PyObject *__pyx_v_filter) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_format, PyObject *__pyx_v_filter) {
   PyObject *__pyx_v_data = NULL;
   PyObject *__pyx_v_idx = NULL;
   PyObject *__pyx_v_elts = NULL;
@@ -6343,7 +6400,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   __Pyx_RefNannySetupContext("parse_format", 0);
   __Pyx_INCREF(__pyx_v_format);
 
-  /* "cvcf.pyx":345
+  /* "pysam/cvcf.pyx":345
  * 
  *     def parse_format(self,line,format,filter=False):
  *         if self._version == 40:             # <<<<<<<<<<<<<<
@@ -6352,14 +6409,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); 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_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_40, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __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 = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":346
+    /* "pysam/cvcf.pyx":346
  *     def parse_format(self,line,format,filter=False):
  *         if self._version == 40:
  *             if not format.startswith('<'):             # <<<<<<<<<<<<<<
@@ -6376,7 +6432,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_4 = (!__pyx_t_3);
     if (__pyx_t_4) {
 
-      /* "cvcf.pyx":347
+      /* "pysam/cvcf.pyx":347
  *         if self._version == 40:
  *             if not format.startswith('<'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)             # <<<<<<<<<<<<<<
@@ -6401,7 +6457,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":348
+      /* "pysam/cvcf.pyx":348
  *             if not format.startswith('<'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format = "<"+format             # <<<<<<<<<<<<<<
@@ -6417,7 +6473,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     }
     __pyx_L4:;
 
-    /* "cvcf.pyx":349
+    /* "pysam/cvcf.pyx":349
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format = "<"+format
  *             if not format.endswith('>'):             # <<<<<<<<<<<<<<
@@ -6434,7 +6490,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
 
-      /* "cvcf.pyx":350
+      /* "pysam/cvcf.pyx":350
  *                 format = "<"+format
  *             if not format.endswith('>'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)             # <<<<<<<<<<<<<<
@@ -6459,7 +6515,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":351
+      /* "pysam/cvcf.pyx":351
  *             if not format.endswith('>'):
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format += ">"             # <<<<<<<<<<<<<<
@@ -6475,7 +6531,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     }
     __pyx_L5:;
 
-    /* "cvcf.pyx":352
+    /* "pysam/cvcf.pyx":352
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format += ">"
  *             format = format[1:-1]             # <<<<<<<<<<<<<<
@@ -6491,7 +6547,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":353
+  /* "pysam/cvcf.pyx":353
  *                 format += ">"
  *             format = format[1:-1]
  *         data = {'id':None,'number':None,'type':None,'descr':None}             # <<<<<<<<<<<<<<
@@ -6507,7 +6563,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   __pyx_v_data = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":354
+  /* "pysam/cvcf.pyx":354
  *             format = format[1:-1]
  *         data = {'id':None,'number':None,'type':None,'descr':None}
  *         idx = 0             # <<<<<<<<<<<<<<
@@ -6517,7 +6573,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   __Pyx_INCREF(__pyx_int_0);
   __pyx_v_idx = __pyx_int_0;
 
-  /* "cvcf.pyx":355
+  /* "pysam/cvcf.pyx":355
  *         data = {'id':None,'number':None,'type':None,'descr':None}
  *         idx = 0
  *         while len(format.strip())>0:             # <<<<<<<<<<<<<<
@@ -6535,7 +6591,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_3 = (__pyx_t_6 > 0);
     if (!__pyx_t_3) break;
 
-    /* "cvcf.pyx":356
+    /* "pysam/cvcf.pyx":356
  *         idx = 0
  *         while len(format.strip())>0:
  *             elts = format.strip().split(',')             # <<<<<<<<<<<<<<
@@ -6557,7 +6613,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_v_elts = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":357
+    /* "pysam/cvcf.pyx":357
  *         while len(format.strip())>0:
  *             elts = format.strip().split(',')
  *             first, rest = elts[0], ','.join(elts[1:])             # <<<<<<<<<<<<<<
@@ -6586,7 +6642,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_v_rest = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":358
+    /* "pysam/cvcf.pyx":358
  *             elts = format.strip().split(',')
  *             first, rest = elts[0], ','.join(elts[1:])
  *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):             # <<<<<<<<<<<<<<
@@ -6598,8 +6654,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_31), NULL); 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_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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -6609,8 +6664,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __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 = 358; __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -6625,8 +6679,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
         __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_35), 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_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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6641,7 +6694,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     }
     if (__pyx_t_4) {
 
-      /* "cvcf.pyx":359
+      /* "pysam/cvcf.pyx":359
  *             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)             # <<<<<<<<<<<<<<
@@ -6650,8 +6703,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
       __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_int_40, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -6677,15 +6729,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       }
       __pyx_L9:;
 
-      /* "cvcf.pyx":360
+      /* "pysam/cvcf.pyx":360
  *             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_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __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 = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_4) {
@@ -6710,7 +6761,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       }
       __pyx_L10:;
 
-      /* "cvcf.pyx":361
+      /* "pysam/cvcf.pyx":361
  *                 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             # <<<<<<<<<<<<<<
@@ -6744,7 +6795,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     }
     __pyx_L8:;
 
-    /* "cvcf.pyx":362
+    /* "pysam/cvcf.pyx":362
  *                 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]             # <<<<<<<<<<<<<<
@@ -6772,7 +6823,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       goto __pyx_L11;
     }
 
-    /* "cvcf.pyx":363
+    /* "pysam/cvcf.pyx":363
  *                 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]             # <<<<<<<<<<<<<<
@@ -6800,7 +6851,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       goto __pyx_L11;
     }
 
-    /* "cvcf.pyx":364
+    /* "pysam/cvcf.pyx":364
  *             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]             # <<<<<<<<<<<<<<
@@ -6828,7 +6879,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       goto __pyx_L11;
     }
 
-    /* "cvcf.pyx":365
+    /* "pysam/cvcf.pyx":365
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):             # <<<<<<<<<<<<<<
@@ -6844,7 +6895,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_4) {
 
-      /* "cvcf.pyx":366
+      /* "pysam/cvcf.pyx":366
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):
  *                 elts = format.split('"')             # <<<<<<<<<<<<<<
@@ -6860,7 +6911,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __pyx_v_elts = __pyx_t_7;
       __pyx_t_7 = 0;
 
-      /* "cvcf.pyx":367
+      /* "pysam/cvcf.pyx":367
  *             elif first.startswith('Description='):
  *                 elts = format.split('"')
  *                 if len(elts)<3:             # <<<<<<<<<<<<<<
@@ -6871,7 +6922,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __pyx_t_4 = (__pyx_t_6 < 3);
       if (__pyx_t_4) {
 
-        /* "cvcf.pyx":368
+        /* "pysam/cvcf.pyx":368
  *                 elts = format.split('"')
  *                 if len(elts)<3:
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)             # <<<<<<<<<<<<<<
@@ -6896,7 +6947,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
         __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-        /* "cvcf.pyx":369
+        /* "pysam/cvcf.pyx":369
  *                 if len(elts)<3:
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)
  *                     elts = first.split('=') + [rest]             # <<<<<<<<<<<<<<
@@ -6924,7 +6975,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       }
       __pyx_L12:;
 
-      /* "cvcf.pyx":370
+      /* "pysam/cvcf.pyx":370
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)
  *                     elts = first.split('=') + [rest]
  *                 data['descr'] = elts[1]             # <<<<<<<<<<<<<<
@@ -6936,7 +6987,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-      /* "cvcf.pyx":371
+      /* "pysam/cvcf.pyx":371
  *                     elts = first.split('=') + [rest]
  *                 data['descr'] = elts[1]
  *                 rest = '"'.join(elts[2:])             # <<<<<<<<<<<<<<
@@ -6960,7 +7011,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __pyx_v_rest = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":372
+      /* "pysam/cvcf.pyx":372
  *                 data['descr'] = elts[1]
  *                 rest = '"'.join(elts[2:])
  *                 if rest.startswith(','): rest = rest[1:]             # <<<<<<<<<<<<<<
@@ -6987,7 +7038,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     }
     /*else*/ {
 
-      /* "cvcf.pyx":374
+      /* "pysam/cvcf.pyx":374
  *                 if rest.startswith(','): rest = rest[1:]
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -7014,7 +7065,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     }
     __pyx_L11:;
 
-    /* "cvcf.pyx":375
+    /* "pysam/cvcf.pyx":375
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             format = rest             # <<<<<<<<<<<<<<
@@ -7025,7 +7076,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __Pyx_DECREF(__pyx_v_format);
     __pyx_v_format = __pyx_v_rest;
 
-    /* "cvcf.pyx":376
+    /* "pysam/cvcf.pyx":376
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             format = rest
  *             idx += 1             # <<<<<<<<<<<<<<
@@ -7038,7 +7089,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_v_idx = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":377
+    /* "pysam/cvcf.pyx":377
  *             format = rest
  *             idx += 1
  *             if filter and idx==1: idx=3  # skip number and type fields for FILTER format strings             # <<<<<<<<<<<<<<
@@ -7047,8 +7098,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_filter); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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 = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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 = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_9 = __pyx_t_3;
@@ -7064,7 +7114,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_L14:;
   }
 
-  /* "cvcf.pyx":378
+  /* "pysam/cvcf.pyx":378
  *             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)             # <<<<<<<<<<<<<<
@@ -7098,17 +7148,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L15:;
 
-  /* "cvcf.pyx":379
+  /* "pysam/cvcf.pyx":379
  *             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 'descr' not in data:             # <<<<<<<<<<<<<<
  *             # missing description
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
-  __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__descr), ((PyObject *)__pyx_v_data), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":381
+    /* "pysam/cvcf.pyx":381
  *         if 'descr' not in data:
  *             # missing description
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -7133,7 +7183,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":382
+    /* "pysam/cvcf.pyx":382
  *             # missing description
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             data['descr'] = ""             # <<<<<<<<<<<<<<
@@ -7145,7 +7195,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L16:;
 
-  /* "cvcf.pyx":383
+  /* "pysam/cvcf.pyx":383
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *             data['descr'] = ""
  *         if not data['type'] and not data['number']:             # <<<<<<<<<<<<<<
@@ -7169,7 +7219,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":385
+    /* "pysam/cvcf.pyx":385
  *         if not data['type'] and not data['number']:
  *             # fine, ##filter format
  *             return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')             # <<<<<<<<<<<<<<
@@ -7216,7 +7266,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L17:;
 
-  /* "cvcf.pyx":386
+  /* "pysam/cvcf.pyx":386
  *             # fine, ##filter format
  *             return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')
  *         if not data['type'] in ["Integer","Float","Character","String","Flag"]:             # <<<<<<<<<<<<<<
@@ -7225,27 +7275,37 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
   __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (!((int)__pyx_t_4)) {
-    __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __pyx_t_3 = ((int)__pyx_t_9);
   } else {
     __pyx_t_3 = ((int)__pyx_t_4);
   }
   if (!__pyx_t_3) {
-    __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Character), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __pyx_t_9 = ((int)__pyx_t_4);
   } else {
     __pyx_t_9 = __pyx_t_3;
   }
   if (!__pyx_t_9) {
-    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__String), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __pyx_t_4 = ((int)__pyx_t_3);
   } else {
     __pyx_t_4 = __pyx_t_9;
   }
   if (!__pyx_t_4) {
-    __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __pyx_t_3 = ((int)__pyx_t_9);
   } else {
     __pyx_t_3 = __pyx_t_4;
@@ -7254,7 +7314,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":387
+    /* "pysam/cvcf.pyx":387
  *             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)             # <<<<<<<<<<<<<<
@@ -7282,7 +7342,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L18:;
 
-  /* "cvcf.pyx":389
+  /* "pysam/cvcf.pyx":389
  *             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             # <<<<<<<<<<<<<<
@@ -7291,9 +7351,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
   __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   if (!((int)__pyx_t_4)) {
-    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = ((int)__pyx_t_3);
   } else {
     __pyx_t_9 = ((int)__pyx_t_4);
@@ -7306,7 +7370,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   /*else*/ {
 
-    /* "cvcf.pyx":390
+    /* "pysam/cvcf.pyx":390
  *         # 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'] = '.'             # <<<<<<<<<<<<<<
@@ -7317,7 +7381,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L19:;
 
-  /* "cvcf.pyx":391
+  /* "pysam/cvcf.pyx":391
  *         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)             # <<<<<<<<<<<<<<
@@ -7351,7 +7415,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L20:;
 
-  /* "cvcf.pyx":392
+  /* "pysam/cvcf.pyx":392
  *         else:                                   data['missing'] = '.'
  *         if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         try:             # <<<<<<<<<<<<<<
@@ -7365,7 +7429,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __Pyx_XGOTREF(__pyx_t_13);
     /*try:*/ {
 
-      /* "cvcf.pyx":393
+      /* "pysam/cvcf.pyx":393
  *         if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         try:
  *             n = int(data['number'])             # <<<<<<<<<<<<<<
@@ -7385,7 +7449,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __pyx_v_n = __pyx_t_5;
       __pyx_t_5 = 0;
 
-      /* "cvcf.pyx":394
+      /* "pysam/cvcf.pyx":394
  *         try:
  *             n = int(data['number'])
  *             t = self.NT_NUMBER             # <<<<<<<<<<<<<<
@@ -7408,7 +7472,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":395
+    /* "pysam/cvcf.pyx":395
  *             n = int(data['number'])
  *             t = self.NT_NUMBER
  *         except ValueError:             # <<<<<<<<<<<<<<
@@ -7417,13 +7481,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_14 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
     if (__pyx_t_14) {
-      __Pyx_AddTraceback("cvcf.VCF.parse_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      __Pyx_AddTraceback("pysam.cvcf.VCF.parse_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_GOTREF(__pyx_t_10);
 
-      /* "cvcf.pyx":396
+      /* "pysam/cvcf.pyx":396
  *             t = self.NT_NUMBER
  *         except ValueError:
  *             n = -1             # <<<<<<<<<<<<<<
@@ -7434,7 +7498,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       __Pyx_XDECREF(__pyx_v_n);
       __pyx_v_n = __pyx_int_neg_1;
 
-      /* "cvcf.pyx":397
+      /* "pysam/cvcf.pyx":397
  *         except ValueError:
  *             n = -1
  *             if data['number'] == '.':                   t = self.NT_UNKNOWN             # <<<<<<<<<<<<<<
@@ -7443,27 +7507,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
       __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 = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __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 = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_7;
-        __pyx_t_7 = 0;
+        __pyx_v_t = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":398
+      /* "pysam/cvcf.pyx":398
  *             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
  */
-      __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 = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_53), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_53), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7474,7 +7542,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":399
+      /* "pysam/cvcf.pyx":399
  *             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             # <<<<<<<<<<<<<<
@@ -7483,27 +7551,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
       __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 = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_54), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_54), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __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 = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_7;
-        __pyx_t_7 = 0;
+        __pyx_v_t = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":400
+      /* "pysam/cvcf.pyx":400
  *             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
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
  */
-      __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 = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_55), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_55), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7514,7 +7586,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":401
+      /* "pysam/cvcf.pyx":401
  *             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             # <<<<<<<<<<<<<<
@@ -7523,27 +7595,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
       __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 = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_56), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_56), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __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 = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_7;
-        __pyx_t_7 = 0;
+        __pyx_v_t = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":402
+      /* "pysam/cvcf.pyx":402
  *             elif data['number'] == '#genotypes':        t = self.NT_GENOTYPES
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES             # <<<<<<<<<<<<<<
  *             # abbreviations added in VCF version v4.1
  *             elif data['number'] == 'A': t = self.NT_ALLELES
  */
-      __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 = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_56), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_56), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7554,7 +7630,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":404
+      /* "pysam/cvcf.pyx":404
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
  *             # abbreviations added in VCF version v4.1
  *             elif data['number'] == 'A': t = self.NT_ALLELES             # <<<<<<<<<<<<<<
@@ -7563,27 +7639,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  */
       __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 = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__A), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __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 = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_7;
-        __pyx_t_7 = 0;
+        __pyx_v_t = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L31;
       }
 
-      /* "cvcf.pyx":405
+      /* "pysam/cvcf.pyx":405
  *             # abbreviations added in VCF version v4.1
  *             elif data['number'] == 'A': t = self.NT_ALLELES
  *             elif data['number'] == 'G': t = self.NT_GENOTYPES             # <<<<<<<<<<<<<<
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
-      __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_n_s__G), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__G), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7595,7 +7675,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
       }
       /*else*/ {
 
-        /* "cvcf.pyx":407
+        /* "pysam/cvcf.pyx":407
  *             elif data['number'] == 'G': t = self.NT_GENOTYPES
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -7640,54 +7720,55 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
     __pyx_L28_try_end:;
   }
 
-  /* "cvcf.pyx":409
+  /* "pysam/cvcf.pyx":409
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  *         # if number is 0 - type must be Flag
  *         if n == 0 and data['type'] != 'Flag':             # <<<<<<<<<<<<<<
  *             self.error( line, self.ZERO_FOR_NON_FLAG_FIELD)
  *             # force type 'Flag' if no number
  */
-  __pyx_t_10 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_10 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_9) {
     __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 = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_n_s__Flag), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Flag), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__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_3 = __pyx_t_4;
   } else {
     __pyx_t_3 = __pyx_t_9;
   }
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":410
+    /* "pysam/cvcf.pyx":410
  *         # if number is 0 - type must be Flag
  *         if n == 0 and data['type'] != 'Flag':
  *             self.error( line, self.ZERO_FOR_NON_FLAG_FIELD)             # <<<<<<<<<<<<<<
  *             # force type 'Flag' if no number
  *             data['type'] = 'Flag'
  */
-    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_57); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __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 = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_57); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_5), NULL); 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_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    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, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-    /* "cvcf.pyx":412
+    /* "pysam/cvcf.pyx":412
  *             self.error( line, self.ZERO_FOR_NON_FLAG_FIELD)
  *             # force type 'Flag' if no number
  *             data['type'] = 'Flag'             # <<<<<<<<<<<<<<
@@ -7699,7 +7780,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L32:;
 
-  /* "cvcf.pyx":414
+  /* "pysam/cvcf.pyx":414
  *             data['type'] = 'Flag'
  * 
  *         return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing'])             # <<<<<<<<<<<<<<
@@ -7707,13 +7788,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  *     def format_format( self, fmt, filter=False ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   if (unlikely(!__pyx_v_t)) { __Pyx_RaiseUnboundLocalError("t"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __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 = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_15 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing)); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -7728,19 +7809,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   __Pyx_INCREF(__pyx_v_n);
   PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_n);
   __Pyx_GIVEREF(__pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
+  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_15);
   __Pyx_GIVEREF(__pyx_t_15);
   __pyx_t_5 = 0;
-  __pyx_t_10 = 0;
+  __pyx_t_1 = 0;
   __pyx_t_2 = 0;
   __pyx_t_15 = 0;
-  __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_15 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_15);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
   __pyx_r = __pyx_t_15;
   __pyx_t_15 = 0;
@@ -7755,7 +7836,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("cvcf.VCF.parse_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_data);
@@ -7771,7 +7852,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
   return __pyx_r;
 }
 
-/* "cvcf.pyx":416
+/* "pysam/cvcf.pyx":416
  *         return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing'])
  * 
  *     def format_format( self, fmt, filter=False ):             # <<<<<<<<<<<<<<
@@ -7779,7 +7860,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject *__pyx
  *         if fmt.number != None and not filter:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_89__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_89__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -7801,7 +7882,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_89__defaults__(CYTHON_UNUSED PyObject *__py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -7810,18 +7891,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_89__defaults__(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_7format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_7format_format = {__Pyx_NAMESTR("format_format"), (PyCFunction)__pyx_pw_4cvcf_3VCF_7format_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_7format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_7format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_7format_format = {__Pyx_NAMESTR("format_format"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_7format_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_7format_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;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fmt,&__pyx_n_s__filter,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("format_format (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fmt,&__pyx_n_s__filter,0};
     PyObject* values[3] = {0,0,0};
     __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
     values[2] = __pyx_dynamic_args->__pyx_arg_filter;
@@ -7838,12 +7918,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_7format_format(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fmt);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fmt)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("format_format", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -7873,16 +7951,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_7format_format(PyObject *__pyx_self, PyObje
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("format_format", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.format_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.format_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_6format_format(__pyx_self, __pyx_v_self, __pyx_v_fmt, __pyx_v_filter);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_6format_format(__pyx_self, __pyx_v_self, __pyx_v_fmt, __pyx_v_filter);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_filter) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_filter) {
   PyObject *__pyx_v_values = NULL;
   PyObject *__pyx_v_nmb = NULL;
   PyObject *__pyx_v_format = NULL;
@@ -7908,7 +7986,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("format_format", 0);
 
-  /* "cvcf.pyx":417
+  /* "pysam/cvcf.pyx":417
  * 
  *     def format_format( self, fmt, filter=False ):
  *         values = [('ID',fmt.id)]             # <<<<<<<<<<<<<<
@@ -7933,7 +8011,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   __pyx_v_values = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":418
+  /* "pysam/cvcf.pyx":418
  *     def format_format( self, fmt, filter=False ):
  *         values = [('ID',fmt.id)]
  *         if fmt.number != None and not filter:             # <<<<<<<<<<<<<<
@@ -7942,8 +8020,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__number); 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);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __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 = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -7956,7 +8033,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   }
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":419
+    /* "pysam/cvcf.pyx":419
  *         values = [('ID',fmt.id)]
  *         if fmt.number != None and not filter:
  *             if fmt.numbertype == self.NT_UNKNOWN: nmb = "."             # <<<<<<<<<<<<<<
@@ -7967,8 +8044,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -7979,7 +8055,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":420
+    /* "pysam/cvcf.pyx":420
  *         if fmt.number != None and not filter:
  *             if fmt.numbertype == self.NT_UNKNOWN: nmb = "."
  *             elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number)             # <<<<<<<<<<<<<<
@@ -7990,8 +8066,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8012,7 +8087,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":421
+    /* "pysam/cvcf.pyx":421
  *             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"             # <<<<<<<<<<<<<<
@@ -8023,8 +8098,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); 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_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); 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 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8035,7 +8109,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":422
+    /* "pysam/cvcf.pyx":422
  *             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"             # <<<<<<<<<<<<<<
@@ -8046,8 +8120,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); 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_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8058,7 +8131,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":423
+    /* "pysam/cvcf.pyx":423
  *             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"             # <<<<<<<<<<<<<<
@@ -8069,8 +8142,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8081,7 +8153,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":424
+    /* "pysam/cvcf.pyx":424
  *             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"             # <<<<<<<<<<<<<<
@@ -8092,8 +8164,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8105,7 +8176,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     }
     /*else*/ {
 
-      /* "cvcf.pyx":426
+      /* "pysam/cvcf.pyx":426
  *             elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes"
  *             else:
  *                 raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)             # <<<<<<<<<<<<<<
@@ -8131,7 +8202,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     }
     __pyx_L4:;
 
-    /* "cvcf.pyx":427
+    /* "pysam/cvcf.pyx":427
  *             else:
  *                 raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)
  *             values.append( ('Number',nmb) )             # <<<<<<<<<<<<<<
@@ -8149,7 +8220,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __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 = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":428
+    /* "pysam/cvcf.pyx":428
  *                 raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)
  *             values.append( ('Number',nmb) )
  *             values.append( ('Type', fmt.type) )             # <<<<<<<<<<<<<<
@@ -8172,7 +8243,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":429
+  /* "pysam/cvcf.pyx":429
  *             values.append( ('Number',nmb) )
  *             values.append( ('Type', fmt.type) )
  *         values.append( ('Description', '"' + fmt.description + '"') )             # <<<<<<<<<<<<<<
@@ -8198,7 +8269,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   __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 = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":430
+  /* "pysam/cvcf.pyx":430
  *             values.append( ('Type', fmt.type) )
  *         values.append( ('Description', '"' + fmt.description + '"') )
  *         if self._version == 33:             # <<<<<<<<<<<<<<
@@ -8207,14 +8278,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":431
+    /* "pysam/cvcf.pyx":431
  *         values.append( ('Description', '"' + fmt.description + '"') )
  *         if self._version == 33:
  *             format = ",".join([v for k,v in values])             # <<<<<<<<<<<<<<
@@ -8228,30 +8298,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __pyx_t_6 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
     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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
       if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
         PyObject* sequence = __pyx_t_9;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        Py_ssize_t size = Py_SIZE(sequence);
+        #else
+        Py_ssize_t size = PySequence_Size(sequence);
+        #endif
+        if (unlikely(size != 2)) {
+          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
-          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
           __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
-          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
           __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
           __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
         }
         __Pyx_INCREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_t_11);
+        #else
+        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      } else {
+      } else
+      {
         Py_ssize_t index = -1;
         __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_12);
@@ -8262,12 +8342,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
         index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L8_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_11);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_13 = NULL;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         goto __pyx_L9_unpacking_done;
         __pyx_L8_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+        __pyx_t_13 = NULL;
+        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_L9_unpacking_done:;
       }
@@ -8277,7 +8358,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       __Pyx_XDECREF(__pyx_v_v);
       __pyx_v_v = __pyx_t_11;
       __pyx_t_11 = 0;
-      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8296,7 +8377,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   }
   /*else*/ {
 
-    /* "cvcf.pyx":433
+    /* "pysam/cvcf.pyx":433
  *             format = ",".join([v for k,v in values])
  *         else:
  *             format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">"             # <<<<<<<<<<<<<<
@@ -8310,30 +8391,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
     __pyx_t_2 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
     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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
       if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
         PyObject* sequence = __pyx_t_9;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        Py_ssize_t size = Py_SIZE(sequence);
+        #else
+        Py_ssize_t size = PySequence_Size(sequence);
+        #endif
+        if (unlikely(size != 2)) {
+          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
-          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
           __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
-          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
           __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
           __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
         }
         __Pyx_INCREF(__pyx_t_11);
         __Pyx_INCREF(__pyx_t_10);
+        #else
+        __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      } else {
+      } else
+      {
         Py_ssize_t index = -1;
         __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_12);
@@ -8344,12 +8435,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
         index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L12_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_10);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_13 = NULL;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         goto __pyx_L13_unpacking_done;
         __pyx_L12_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+        __pyx_t_13 = NULL;
+        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_L13_unpacking_done:;
       }
@@ -8370,7 +8462,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
       __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_59), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __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 = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__Pyx_PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __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;
@@ -8395,7 +8487,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   }
   __pyx_L5:;
 
-  /* "cvcf.pyx":434
+  /* "pysam/cvcf.pyx":434
  *         else:
  *             format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">"
  *         return format             # <<<<<<<<<<<<<<
@@ -8417,7 +8509,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
   __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_AddTraceback("cvcf.VCF.format_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.format_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_values);
@@ -8431,19 +8523,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_9get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_9get_expected = {__Pyx_NAMESTR("get_expected"), (PyCFunction)__pyx_pw_4cvcf_3VCF_9get_expected, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_9get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_9get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_9get_expected = {__Pyx_NAMESTR("get_expected"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_9get_expected, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_9get_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;
   PyObject *__pyx_v_alt = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,&__pyx_n_s__formatdict,&__pyx_n_s__alt,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("get_expected (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,&__pyx_n_s__formatdict,&__pyx_n_s__alt,0};
     PyObject* values[4] = {0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8459,24 +8550,20 @@ static PyObject *__pyx_pw_4cvcf_3VCF_9get_expected(PyObject *__pyx_self, PyObjec
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt);
-        if (likely(values[3])) kw_args--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8501,16 +8588,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_9get_expected(PyObject *__pyx_self, PyObjec
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.get_expected", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.get_expected", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_8get_expected(__pyx_self, __pyx_v_self, __pyx_v_format, __pyx_v_formatdict, __pyx_v_alt);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_8get_expected(__pyx_self, __pyx_v_self, __pyx_v_format, __pyx_v_formatdict, __pyx_v_alt);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":436
+/* "pysam/cvcf.pyx":436
  *         return format
  * 
  *     def get_expected(self, format, formatdict, alt):             # <<<<<<<<<<<<<<
@@ -8518,7 +8605,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_9get_expected(PyObject *__pyx_self, PyObjec
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_alt) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_alt) {
   PyObject *__pyx_v_fmt = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -8533,7 +8620,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("get_expected", 0);
 
-  /* "cvcf.pyx":437
+  /* "pysam/cvcf.pyx":437
  * 
  *     def get_expected(self, format, formatdict, alt):
  *         fmt = formatdict[format]             # <<<<<<<<<<<<<<
@@ -8545,7 +8632,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __pyx_v_fmt = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":438
+  /* "pysam/cvcf.pyx":438
  *     def get_expected(self, format, formatdict, alt):
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1             # <<<<<<<<<<<<<<
@@ -8556,8 +8643,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8571,7 +8657,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":439
+  /* "pysam/cvcf.pyx":439
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  *         if fmt.numbertype == self.NT_NUMBER: return fmt.number             # <<<<<<<<<<<<<<
@@ -8582,8 +8668,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_3);
   __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 = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8599,7 +8684,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L4:;
 
-  /* "cvcf.pyx":440
+  /* "pysam/cvcf.pyx":440
  *         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             # <<<<<<<<<<<<<<
@@ -8610,8 +8695,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); 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_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8628,7 +8712,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L5:;
 
-  /* "cvcf.pyx":441
+  /* "pysam/cvcf.pyx":441
  *         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)             # <<<<<<<<<<<<<<
@@ -8639,8 +8723,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8657,7 +8740,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":442
+  /* "pysam/cvcf.pyx":442
  *         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             # <<<<<<<<<<<<<<
@@ -8668,8 +8751,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); 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_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); 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_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8687,7 +8769,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L7:;
 
-  /* "cvcf.pyx":443
+  /* "pysam/cvcf.pyx":443
  *         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)             # <<<<<<<<<<<<<<
@@ -8698,8 +8780,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8717,7 +8798,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   }
   __pyx_L8:;
 
-  /* "cvcf.pyx":444
+  /* "pysam/cvcf.pyx":444
  *         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             # <<<<<<<<<<<<<<
@@ -8735,7 +8816,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCF.get_expected", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.get_expected", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_fmt);
@@ -8745,20 +8826,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject *__pyx
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_11_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_11_add_definition = {__Pyx_NAMESTR("_add_definition"), (PyCFunction)__pyx_pw_4cvcf_3VCF_11_add_definition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_11_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_11_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_11_add_definition = {__Pyx_NAMESTR("_add_definition"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_11_add_definition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_11_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;
   PyObject *__pyx_v_data = 0;
   PyObject *__pyx_v_line = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__formatdict,&__pyx_n_s__key,&__pyx_n_s__data,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_add_definition (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__formatdict,&__pyx_n_s__key,&__pyx_n_s__data,&__pyx_n_s__line,0};
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8775,30 +8855,25 @@ static PyObject *__pyx_pw_4cvcf_3VCF_11_add_definition(PyObject *__pyx_self, PyO
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
-        if (likely(values[3])) kw_args--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[4])) kw_args--;
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8825,16 +8900,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_11_add_definition(PyObject *__pyx_self, PyO
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF._add_definition", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF._add_definition", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_10_add_definition(__pyx_self, __pyx_v_self, __pyx_v_formatdict, __pyx_v_key, __pyx_v_data, __pyx_v_line);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(__pyx_self, __pyx_v_self, __pyx_v_formatdict, __pyx_v_key, __pyx_v_data, __pyx_v_line);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":447
+/* "pysam/cvcf.pyx":447
  * 
  * 
  *     def _add_definition(self, formatdict, key, data, line ):             # <<<<<<<<<<<<<<
@@ -8842,7 +8917,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_11_add_definition(PyObject *__pyx_self, PyO
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_key, PyObject *__pyx_v_data, PyObject *__pyx_v_line) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_key, PyObject *__pyx_v_data, PyObject *__pyx_v_line) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -8855,14 +8930,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   __Pyx_RefNannySetupContext("_add_definition", 0);
   __Pyx_INCREF(__pyx_v_data);
 
-  /* "cvcf.pyx":448
+  /* "pysam/cvcf.pyx":448
  * 
  *     def _add_definition(self, formatdict, key, data, line ):
  *         if key in formatdict: return             # <<<<<<<<<<<<<<
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  *         if data == None:
  */
-  __pyx_t_1 = ((PySequence_Contains(__pyx_v_formatdict, __pyx_v_key))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_key, __pyx_v_formatdict, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8871,7 +8946,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":449
+  /* "pysam/cvcf.pyx":449
  *     def _add_definition(self, formatdict, key, data, line ):
  *         if key in formatdict: return
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)             # <<<<<<<<<<<<<<
@@ -8899,20 +8974,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":450
+  /* "pysam/cvcf.pyx":450
  *         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
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_data, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_data, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_1) {
 
-    /* "cvcf.pyx":451
+    /* "pysam/cvcf.pyx":451
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  *         if data == None:
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")             # <<<<<<<<<<<<<<
@@ -8950,7 +9024,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
     if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "cvcf.pyx":452
+    /* "pysam/cvcf.pyx":452
  *         if data == None:
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
  *             return             # <<<<<<<<<<<<<<
@@ -8964,7 +9038,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   }
   __pyx_L4:;
 
-  /* "cvcf.pyx":453
+  /* "pysam/cvcf.pyx":453
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
  *             return
  *         if data == []: data = [""]             # unsure what type -- say string             # <<<<<<<<<<<<<<
@@ -8973,8 +9047,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
  */
   __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_data, ((PyObject *)__pyx_t_4), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_data, ((PyObject *)__pyx_t_4), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __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_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -8991,7 +9064,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   }
   __pyx_L5:;
 
-  /* "cvcf.pyx":454
+  /* "pysam/cvcf.pyx":454
  *             return
  *         if data == []: data = [""]             # unsure what type -- say string
  *         if type(data[0]) == type(0.0):             # <<<<<<<<<<<<<<
@@ -9002,15 +9075,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_4 = PyFloat_FromDouble(0.0); 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_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)Py_TYPE(__pyx_t_4)), Py_EQ); 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_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)Py_TYPE(__pyx_t_4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 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_1) {
 
-    /* "cvcf.pyx":455
+    /* "pysam/cvcf.pyx":455
  *         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)             # <<<<<<<<<<<<<<
@@ -9048,7 +9120,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
     if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "cvcf.pyx":456
+    /* "pysam/cvcf.pyx":456
  *         if type(data[0]) == type(0.0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)
  *             return             # <<<<<<<<<<<<<<
@@ -9062,7 +9134,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":457
+  /* "pysam/cvcf.pyx":457
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)
  *             return
  *         if type(data[0]) == type(0):             # <<<<<<<<<<<<<<
@@ -9071,14 +9143,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
  */
   __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_data, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_4)), ((PyObject *)Py_TYPE(__pyx_int_0)), Py_EQ); 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);
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_4)), ((PyObject *)Py_TYPE(__pyx_int_0)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_1) {
 
-    /* "cvcf.pyx":458
+    /* "pysam/cvcf.pyx":458
  *             return
  *         if type(data[0]) == type(0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)             # <<<<<<<<<<<<<<
@@ -9116,7 +9187,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
     if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-    /* "cvcf.pyx":459
+    /* "pysam/cvcf.pyx":459
  *         if type(data[0]) == type(0):
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)
  *             return             # <<<<<<<<<<<<<<
@@ -9130,7 +9201,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   }
   __pyx_L7:;
 
-  /* "cvcf.pyx":460
+  /* "pysam/cvcf.pyx":460
  *             formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)
  *             return
  *         formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".")             # <<<<<<<<<<<<<<
@@ -9174,7 +9245,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("cvcf.VCF._add_definition", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF._add_definition", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_data);
@@ -9183,7 +9254,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
   return __pyx_r;
 }
 
-/* "cvcf.pyx":464
+/* "pysam/cvcf.pyx":464
  * 
  *     # todo: trim trailing missing values
  *     def format_formatdata( self, data, format, key=True, value=True, separator=":" ):             # <<<<<<<<<<<<<<
@@ -9191,7 +9262,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyObject *_
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_91__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_91__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -9219,7 +9290,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_91__defaults__(CYTHON_UNUSED PyObject *__py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -9228,21 +9299,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_91__defaults__(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_13format_formatdata = {__Pyx_NAMESTR("format_formatdata"), (PyCFunction)__pyx_pw_4cvcf_3VCF_13format_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_13format_formatdata = {__Pyx_NAMESTR("format_formatdata"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_13format_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_13format_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;
   PyObject *__pyx_v_key = 0;
   PyObject *__pyx_v_value = 0;
   PyObject *__pyx_v_separator = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__data,&__pyx_n_s__format,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__separator,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("format_formatdata (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__data,&__pyx_n_s__format,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__separator,0};
     PyObject* values[6] = {0,0,0,0,0,0};
     __pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self);
     values[3] = __pyx_dynamic_args->__pyx_arg_key;
@@ -9264,18 +9334,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -9321,16 +9388,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_self, P
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.format_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.format_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_12format_formatdata(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_format, __pyx_v_key, __pyx_v_value, __pyx_v_separator);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(__pyx_self, __pyx_v_self, __pyx_v_data, __pyx_v_format, __pyx_v_key, __pyx_v_value, __pyx_v_separator);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_format, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_separator) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_format, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_separator) {
   PyObject *__pyx_v_output = NULL;
   PyObject *__pyx_v_sdata = NULL;
   PyObject *__pyx_v_d = NULL;
@@ -9360,7 +9427,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   __Pyx_RefNannySetupContext("format_formatdata", 0);
   __Pyx_INCREF(__pyx_v_data);
 
-  /* "cvcf.pyx":465
+  /* "pysam/cvcf.pyx":465
  *     # todo: trim trailing missing values
  *     def format_formatdata( self, data, format, key=True, value=True, separator=":" ):
  *         output, sdata = [], []             # <<<<<<<<<<<<<<
@@ -9376,7 +9443,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   __pyx_v_sdata = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":466
+  /* "pysam/cvcf.pyx":466
  *     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             # <<<<<<<<<<<<<<
@@ -9385,14 +9452,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
  */
   __pyx_t_2 = PyList_New(0); 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 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(((PyObject *)__pyx_t_2))), Py_EQ); 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_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(((PyObject *)__pyx_t_2))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__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 = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":467
+    /* "pysam/cvcf.pyx":467
  *         output, sdata = [], []
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  *             d = {}             # <<<<<<<<<<<<<<
@@ -9404,7 +9470,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __pyx_v_d = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":468
+    /* "pysam/cvcf.pyx":468
  *         if type(data) == type([]): # for FORMAT field, make data with dummy values
  *             d = {}
  *             for k in data: d[k] = []             # <<<<<<<<<<<<<<
@@ -9422,10 +9488,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     for (;;) {
       if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
         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++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
         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++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
         __pyx_t_2 = __pyx_t_5(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -9447,7 +9521,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":469
+    /* "pysam/cvcf.pyx":469
  *             d = {}
  *             for k in data: d[k] = []
  *             data = d             # <<<<<<<<<<<<<<
@@ -9461,7 +9535,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":471
+  /* "pysam/cvcf.pyx":471
  *             data = d
  *         # convert missing values; and silently add definitions if required
  *         for k in data:             # <<<<<<<<<<<<<<
@@ -9479,10 +9553,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
       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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
       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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_2 = __pyx_t_5(__pyx_t_1);
       if (unlikely(!__pyx_t_2)) {
@@ -9498,7 +9580,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __pyx_v_k = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":472
+    /* "pysam/cvcf.pyx":472
  *         # convert missing values; and silently add definitions if required
  *         for k in data:
  *             self._add_definition( format, k, data[k], "(output)" )             # <<<<<<<<<<<<<<
@@ -9529,7 +9611,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":473
+    /* "pysam/cvcf.pyx":473
  *         for k in data:
  *             self._add_definition( format, k, data[k], "(output)" )
  *             for idx,v in enumerate(data[k]):             # <<<<<<<<<<<<<<
@@ -9552,10 +9634,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     for (;;) {
       if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
         if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_7 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_7 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
         __pyx_t_7 = __pyx_t_9(__pyx_t_2);
         if (unlikely(!__pyx_t_7)) {
@@ -9579,7 +9669,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       __pyx_t_6 = __pyx_t_7;
       __pyx_t_7 = 0;
 
-      /* "cvcf.pyx":474
+      /* "pysam/cvcf.pyx":474
  *             self._add_definition( format, k, data[k], "(output)" )
  *             for idx,v in enumerate(data[k]):
  *                 if v == format[k].missingvalue: data[k][idx] = "."             # <<<<<<<<<<<<<<
@@ -9591,8 +9681,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       __pyx_t_10 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, __pyx_t_10, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -9610,7 +9699,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":476
+  /* "pysam/cvcf.pyx":476
  *                 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:             # <<<<<<<<<<<<<<
@@ -9628,10 +9717,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_6 = __pyx_t_5(__pyx_t_1);
       if (unlikely(!__pyx_t_6)) {
@@ -9647,14 +9744,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __pyx_v_k = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":477
+    /* "pysam/cvcf.pyx":477
  *         # 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:
  */
-    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_k, ((PyObject *)__pyx_n_s__GT), Py_NE); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_v_k, ((PyObject *)__pyx_n_s__GT), Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __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 = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     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 = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -9674,7 +9773,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":478
+  /* "pysam/cvcf.pyx":478
  *         for k in data:
  *             if k != 'GT': sdata.append( (k,data[k]) )
  *         sdata.sort()             # <<<<<<<<<<<<<<
@@ -9683,17 +9782,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
  */
   __pyx_t_11 = PyList_Sort(((PyObject *)__pyx_v_sdata)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":479
+  /* "pysam/cvcf.pyx":479
  *             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:
  */
-  __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 = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__GT), __pyx_v_data, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":480
+    /* "pysam/cvcf.pyx":480
  *         sdata.sort()
  *         if 'GT' in data:
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata             # <<<<<<<<<<<<<<
@@ -9738,7 +9837,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   }
   __pyx_L14:;
 
-  /* "cvcf.pyx":481
+  /* "pysam/cvcf.pyx":481
  *         if 'GT' in data:
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
  *         for k,v in sdata:             # <<<<<<<<<<<<<<
@@ -9748,30 +9847,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   __pyx_t_6 = ((PyObject *)__pyx_v_sdata); __Pyx_INCREF(__pyx_t_6); __pyx_t_4 = 0;
   for (;;) {
     if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
-    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #else
+    __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #endif
     if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
       PyObject* sequence = __pyx_t_2;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      Py_ssize_t size = Py_SIZE(sequence);
+      #else
+      Py_ssize_t size = PySequence_Size(sequence);
+      #endif
+      if (unlikely(size != 2)) {
+        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
-        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_t_7);
+      #else
+      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    } else {
+    } else
+    {
       Py_ssize_t index = -1;
       __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
@@ -9782,12 +9891,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       index = 1; __pyx_t_7 = __pyx_t_12(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L17_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_7);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = NULL;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L18_unpacking_done;
       __pyx_L17_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+      __pyx_t_12 = NULL;
+      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L18_unpacking_done:;
     }
@@ -9798,7 +9908,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __pyx_v_v = __pyx_t_7;
     __pyx_t_7 = 0;
 
-    /* "cvcf.pyx":482
+    /* "pysam/cvcf.pyx":482
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
  *         for k,v in sdata:
  *             if v == []: v = None             # <<<<<<<<<<<<<<
@@ -9807,8 +9917,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
  */
     __pyx_t_2 = PyList_New(0); 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_7 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_t_2), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -9820,7 +9929,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     }
     __pyx_L19:;
 
-    /* "cvcf.pyx":483
+    /* "pysam/cvcf.pyx":483
  *         for k,v in sdata:
  *             if v == []: v = None
  *             if key and value:             # <<<<<<<<<<<<<<
@@ -9836,15 +9945,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     }
     if (__pyx_t_14) {
 
-      /* "cvcf.pyx":484
+      /* "pysam/cvcf.pyx":484
  *             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)
  */
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); 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_t_7 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_14) {
@@ -9882,7 +9990,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       }
       /*else*/ {
 
-        /* "cvcf.pyx":485
+        /* "pysam/cvcf.pyx":485
  *             if key and value:
  *                 if v != None: output.append( k+"="+','.join(map(str,v)) )
  *                 else: output.append( k )             # <<<<<<<<<<<<<<
@@ -9895,7 +10003,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       goto __pyx_L20;
     }
 
-    /* "cvcf.pyx":486
+    /* "pysam/cvcf.pyx":486
  *                 if v != None: output.append( k+"="+','.join(map(str,v)) )
  *                 else: output.append( k )
  *             elif key: output.append(k)             # <<<<<<<<<<<<<<
@@ -9908,7 +10016,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       goto __pyx_L20;
     }
 
-    /* "cvcf.pyx":487
+    /* "pysam/cvcf.pyx":487
  *                 else: output.append( k )
  *             elif key: output.append(k)
  *             elif value:             # <<<<<<<<<<<<<<
@@ -9918,15 +10026,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_14) {
 
-      /* "cvcf.pyx":488
+      /* "pysam/cvcf.pyx":488
  *             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
  */
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_14) {
@@ -9958,7 +10065,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
       }
       /*else*/ {
 
-        /* "cvcf.pyx":489
+        /* "pysam/cvcf.pyx":489
  *             elif value:
  *                 if v != None: output.append( ','.join(map(str,v)) )
  *                 else: output.append( "." )                    # should not happen             # <<<<<<<<<<<<<<
@@ -9977,7 +10084,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   }
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-  /* "cvcf.pyx":491
+  /* "pysam/cvcf.pyx":491
  *                 else: output.append( "." )                    # should not happen
  *         # snip off trailing missing data
  *         while len(output) > 1:             # <<<<<<<<<<<<<<
@@ -9986,19 +10093,24 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
  */
   while (1) {
     if (unlikely(((PyObject *)__pyx_v_output) == Py_None)) {
-      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_output)); 
+    __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_output)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_14 = (__pyx_t_4 > 1);
     if (!__pyx_t_14) break;
 
-    /* "cvcf.pyx":492
+    /* "pysam/cvcf.pyx":492
  *         # snip off trailing missing data
  *         while len(output) > 1:
  *             last = output[-1].replace(',','').replace('.','')             # <<<<<<<<<<<<<<
  *             if len(last)>0: break
  *             output = output[:-1]
  */
+    if (unlikely(((PyObject *)__pyx_v_output) == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
     __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_output), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -10017,7 +10129,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     __pyx_v_last = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":493
+    /* "pysam/cvcf.pyx":493
  *         while len(output) > 1:
  *             last = output[-1].replace(',','').replace('.','')
  *             if len(last)>0: break             # <<<<<<<<<<<<<<
@@ -10032,7 +10144,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
     }
     __pyx_L25:;
 
-    /* "cvcf.pyx":494
+    /* "pysam/cvcf.pyx":494
  *             last = output[-1].replace(',','').replace('.','')
  *             if len(last)>0: break
  *             output = output[:-1]             # <<<<<<<<<<<<<<
@@ -10047,7 +10159,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   }
   __pyx_L24_break:;
 
-  /* "cvcf.pyx":495
+  /* "pysam/cvcf.pyx":495
  *             if len(last)>0: break
  *             output = output[:-1]
  *         return separator.join(output)             # <<<<<<<<<<<<<<
@@ -10078,7 +10190,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_AddTraceback("cvcf.VCF.format_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.format_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_output);
@@ -10095,19 +10207,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED PyObject
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_15enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_15enter_default_format = {__Pyx_NAMESTR("enter_default_format"), (PyCFunction)__pyx_pw_4cvcf_3VCF_15enter_default_format, METH_O, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_15enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_15enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_15enter_default_format = {__Pyx_NAMESTR("enter_default_format"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_15enter_default_format, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_15enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("enter_default_format (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_14enter_default_format(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_14enter_default_format(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":498
+/* "pysam/cvcf.pyx":498
  * 
  * 
  *     def enter_default_format(self):             # <<<<<<<<<<<<<<
@@ -10115,7 +10226,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_15enter_default_format(PyObject *__pyx_self
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_v_f = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -10142,7 +10253,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("enter_default_format", 0);
 
-  /* "cvcf.pyx":499
+  /* "pysam/cvcf.pyx":499
  * 
  *     def enter_default_format(self):
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),             # <<<<<<<<<<<<<<
@@ -10178,7 +10289,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":500
+  /* "pysam/cvcf.pyx":500
  *     def enter_default_format(self):
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),             # <<<<<<<<<<<<<<
@@ -10214,7 +10325,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
-  /* "cvcf.pyx":501
+  /* "pysam/cvcf.pyx":501
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.'),             # <<<<<<<<<<<<<<
@@ -10250,7 +10361,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
-  /* "cvcf.pyx":502
+  /* "pysam/cvcf.pyx":502
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.'),
  *                   FORMAT('GL',self.NT_UNKNOWN,-1,'Float','Genotype likelihoods','.'),             # <<<<<<<<<<<<<<
@@ -10286,7 +10397,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
 
-  /* "cvcf.pyx":503
+  /* "pysam/cvcf.pyx":503
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.'),
  *                   FORMAT('GL',self.NT_UNKNOWN,-1,'Float','Genotype likelihoods','.'),
  *                   FORMAT('GLE',self.NT_UNKNOWN,-1,'Float','Genotype likelihoods','.'),             # <<<<<<<<<<<<<<
@@ -10322,7 +10433,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
 
-  /* "cvcf.pyx":504
+  /* "pysam/cvcf.pyx":504
  *                   FORMAT('GL',self.NT_UNKNOWN,-1,'Float','Genotype likelihoods','.'),
  *                   FORMAT('GLE',self.NT_UNKNOWN,-1,'Float','Genotype likelihoods','.'),
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),             # <<<<<<<<<<<<<<
@@ -10358,7 +10469,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
-  /* "cvcf.pyx":505
+  /* "pysam/cvcf.pyx":505
  *                   FORMAT('GLE',self.NT_UNKNOWN,-1,'Float','Genotype likelihoods','.'),
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
  *                   FORMAT('PL',self.NT_GENOTYPES,-1,'Integer','Phred-scaled genotype likelihoods', '.'),             # <<<<<<<<<<<<<<
@@ -10394,7 +10505,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
 
-  /* "cvcf.pyx":506
+  /* "pysam/cvcf.pyx":506
  *                   FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
  *                   FORMAT('PL',self.NT_GENOTYPES,-1,'Integer','Phred-scaled genotype likelihoods', '.'),
  *                   FORMAT('GP',self.NT_GENOTYPES,-1,'Float','Genotype posterior probabilities','.'),             # <<<<<<<<<<<<<<
@@ -10430,7 +10541,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
 
-  /* "cvcf.pyx":507
+  /* "pysam/cvcf.pyx":507
  *                   FORMAT('PL',self.NT_GENOTYPES,-1,'Integer','Phred-scaled genotype likelihoods', '.'),
  *                   FORMAT('GP',self.NT_GENOTYPES,-1,'Float','Genotype posterior probabilities','.'),
  *                   FORMAT('GQ',self.NT_GENOTYPES,-1,'Integer','Conditional genotype quality','.'),             # <<<<<<<<<<<<<<
@@ -10466,7 +10577,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
 
-  /* "cvcf.pyx":508
+  /* "pysam/cvcf.pyx":508
  *                   FORMAT('GP',self.NT_GENOTYPES,-1,'Float','Genotype posterior probabilities','.'),
  *                   FORMAT('GQ',self.NT_GENOTYPES,-1,'Integer','Conditional genotype quality','.'),
  *                   FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid             # <<<<<<<<<<<<<<
@@ -10502,7 +10613,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
 
-  /* "cvcf.pyx":509
+  /* "pysam/cvcf.pyx":509
  *                   FORMAT('GQ',self.NT_GENOTYPES,-1,'Integer','Conditional genotype quality','.'),
  *                   FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid
  *                   FORMAT('PS',self.NT_UNKNOWN,-1,'Integer','Phase set','.'),             # <<<<<<<<<<<<<<
@@ -10538,7 +10649,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
 
-  /* "cvcf.pyx":510
+  /* "pysam/cvcf.pyx":510
  *                   FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid
  *                   FORMAT('PS',self.NT_UNKNOWN,-1,'Integer','Phase set','.'),
  *                   FORMAT('PQ',self.NT_NUMBER,1,'Integer','Phasing quality',-1),             # <<<<<<<<<<<<<<
@@ -10574,7 +10685,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
 
-  /* "cvcf.pyx":511
+  /* "pysam/cvcf.pyx":511
  *                   FORMAT('PS',self.NT_UNKNOWN,-1,'Integer','Phase set','.'),
  *                   FORMAT('PQ',self.NT_NUMBER,1,'Integer','Phasing quality',-1),
  *                   FORMAT('EC',self.NT_ALLELES,1,'Integer','Expected alternate allel counts',-1),             # <<<<<<<<<<<<<<
@@ -10610,7 +10721,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
 
-  /* "cvcf.pyx":512
+  /* "pysam/cvcf.pyx":512
  *                   FORMAT('PQ',self.NT_NUMBER,1,'Integer','Phasing quality',-1),
  *                   FORMAT('EC',self.NT_ALLELES,1,'Integer','Expected alternate allel counts',-1),
  *                   FORMAT('MQ',self.NT_NUMBER,1,'Integer','RMS mapping quality',-1),             # <<<<<<<<<<<<<<
@@ -10693,7 +10804,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
   for (;;) {
 
-    /* "cvcf.pyx":499
+    /* "pysam/cvcf.pyx":499
  * 
  *     def enter_default_format(self):
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),             # <<<<<<<<<<<<<<
@@ -10701,12 +10812,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.'),
  */
     if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_14)) break;
-    __pyx_t_16 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_17); __Pyx_INCREF(__pyx_t_16); __pyx_t_17++;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    __pyx_t_16 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_17); __Pyx_INCREF(__pyx_t_16); __pyx_t_17++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #else
+    __pyx_t_16 = PySequence_ITEM(__pyx_t_14, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #endif
     __Pyx_XDECREF(__pyx_v_f);
     __pyx_v_f = __pyx_t_16;
     __pyx_t_16 = 0;
 
-    /* "cvcf.pyx":514
+    /* "pysam/cvcf.pyx":514
  *                   FORMAT('MQ',self.NT_NUMBER,1,'Integer','RMS mapping quality',-1),
  *                   ]:
  *             if f.id not in self._format:             # <<<<<<<<<<<<<<
@@ -10717,12 +10832,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
     __Pyx_GOTREF(__pyx_t_16);
     __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_18 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_13, __pyx_t_16))); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_18 = (__Pyx_PySequence_Contains(__pyx_t_16, __pyx_t_13, Py_NE)); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
     if (__pyx_t_18) {
 
-      /* "cvcf.pyx":515
+      /* "pysam/cvcf.pyx":515
  *                   ]:
  *             if f.id not in self._format:
  *                 self._format[f.id] = f             # <<<<<<<<<<<<<<
@@ -10761,7 +10876,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
   __Pyx_XDECREF(__pyx_t_16);
-  __Pyx_AddTraceback("cvcf.VCF.enter_default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.enter_default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_f);
@@ -10771,17 +10886,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED PyObje
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_17parse_header = {__Pyx_NAMESTR("parse_header"), (PyCFunction)__pyx_pw_4cvcf_3VCF_17parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_17parse_header = {__Pyx_NAMESTR("parse_header"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_17parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_header (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -10795,12 +10909,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -10821,16 +10933,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObje
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("parse_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_16parse_header(__pyx_self, __pyx_v_self, __pyx_v_line);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_16parse_header(__pyx_self, __pyx_v_self, __pyx_v_line);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":517
+/* "pysam/cvcf.pyx":517
  *                 self._format[f.id] = f
  * 
  *     def parse_header( self, line ):             # <<<<<<<<<<<<<<
@@ -10838,7 +10950,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObje
  *         elts = line[2:].split('=')
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
   PyObject *__pyx_v_elts = NULL;
   PyObject *__pyx_v_key = NULL;
   PyObject *__pyx_v_value = NULL;
@@ -10855,7 +10967,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("parse_header", 0);
 
-  /* "cvcf.pyx":518
+  /* "pysam/cvcf.pyx":518
  * 
  *     def parse_header( self, line ):
  *         assert line.startswith('##')             # <<<<<<<<<<<<<<
@@ -10876,7 +10988,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   }
   #endif
 
-  /* "cvcf.pyx":519
+  /* "pysam/cvcf.pyx":519
  *     def parse_header( self, line ):
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')             # <<<<<<<<<<<<<<
@@ -10894,7 +11006,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   __pyx_v_elts = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":520
+  /* "pysam/cvcf.pyx":520
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')
  *         key = elts[0].strip()             # <<<<<<<<<<<<<<
@@ -10912,7 +11024,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   __pyx_v_key = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":521
+  /* "pysam/cvcf.pyx":521
  *         elts = line[2:].split('=')
  *         key = elts[0].strip()
  *         value = '='.join(elts[1:]).strip()             # <<<<<<<<<<<<<<
@@ -10941,27 +11053,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   __pyx_v_value = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":522
+  /* "pysam/cvcf.pyx":522
  *         key = elts[0].strip()
  *         value = '='.join(elts[1:]).strip()
  *         if key == "fileformat":             # <<<<<<<<<<<<<<
  *             if value == "VCFv3.3":
  *                 self._version = 33
  */
-  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __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 = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":523
+    /* "pysam/cvcf.pyx":523
  *         value = '='.join(elts[1:]).strip()
  *         if key == "fileformat":
  *             if value == "VCFv3.3":             # <<<<<<<<<<<<<<
  *                 self._version = 33
  *             elif value == "VCFv4.0":
  */
-    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_value, ((PyObject *)__pyx_kp_s_79), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_79), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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 = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_3) {
 
-      /* "cvcf.pyx":524
+      /* "pysam/cvcf.pyx":524
  *         if key == "fileformat":
  *             if value == "VCFv3.3":
  *                 self._version = 33             # <<<<<<<<<<<<<<
@@ -10972,17 +11088,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":525
+    /* "pysam/cvcf.pyx":525
  *             if value == "VCFv3.3":
  *                 self._version = 33
  *             elif value == "VCFv4.0":             # <<<<<<<<<<<<<<
  *                 self._version = 40
  *             elif value == "VCFv4.1":
  */
-    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_value, ((PyObject *)__pyx_kp_s_80), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_80), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __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 = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_3) {
 
-      /* "cvcf.pyx":526
+      /* "pysam/cvcf.pyx":526
  *                 self._version = 33
  *             elif value == "VCFv4.0":
  *                 self._version = 40             # <<<<<<<<<<<<<<
@@ -10993,17 +11111,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
       goto __pyx_L4;
     }
 
-    /* "cvcf.pyx":527
+    /* "pysam/cvcf.pyx":527
  *             elif value == "VCFv4.0":
  *                 self._version = 40
  *             elif value == "VCFv4.1":             # <<<<<<<<<<<<<<
  *                 # AH - for testing
  *                 self._version = 40
  */
-    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_value, ((PyObject *)__pyx_kp_s_81), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_81), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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 (__pyx_t_3) {
 
-      /* "cvcf.pyx":529
+      /* "pysam/cvcf.pyx":529
  *             elif value == "VCFv4.1":
  *                 # AH - for testing
  *                 self._version = 40             # <<<<<<<<<<<<<<
@@ -11015,7 +11135,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     }
     /*else*/ {
 
-      /* "cvcf.pyx":531
+      /* "pysam/cvcf.pyx":531
  *                 self._version = 40
  *             else:
  *                 self.error(line,self.UNKNOWN_FORMAT_STRING)             # <<<<<<<<<<<<<<
@@ -11044,17 +11164,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     goto __pyx_L3;
   }
 
-  /* "cvcf.pyx":532
+  /* "pysam/cvcf.pyx":532
  *             else:
  *                 self.error(line,self.UNKNOWN_FORMAT_STRING)
  *         elif key == "INFO":             # <<<<<<<<<<<<<<
  *             f = self.parse_format(line, value)
  *             self._info[ f.id ] = f
  */
-  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":533
+    /* "pysam/cvcf.pyx":533
  *                 self.error(line,self.UNKNOWN_FORMAT_STRING)
  *         elif key == "INFO":
  *             f = self.parse_format(line, value)             # <<<<<<<<<<<<<<
@@ -11078,7 +11200,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     __pyx_v_f = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":534
+    /* "pysam/cvcf.pyx":534
  *         elif key == "INFO":
  *             f = self.parse_format(line, value)
  *             self._info[ f.id ] = f             # <<<<<<<<<<<<<<
@@ -11095,17 +11217,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     goto __pyx_L3;
   }
 
-  /* "cvcf.pyx":535
+  /* "pysam/cvcf.pyx":535
  *             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_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __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 = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":536
+    /* "pysam/cvcf.pyx":536
  *             self._info[ f.id ] = f
  *         elif key == "FILTER":
  *             f = self.parse_format(line, value, filter=True)             # <<<<<<<<<<<<<<
@@ -11136,7 +11260,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     __pyx_v_f = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":537
+    /* "pysam/cvcf.pyx":537
  *         elif key == "FILTER":
  *             f = self.parse_format(line, value, filter=True)
  *             self._filter[ f.id ] = f             # <<<<<<<<<<<<<<
@@ -11153,17 +11277,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     goto __pyx_L3;
   }
 
-  /* "cvcf.pyx":538
+  /* "pysam/cvcf.pyx":538
  *             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_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":539
+    /* "pysam/cvcf.pyx":539
  *             self._filter[ f.id ] = f
  *         elif key == "FORMAT":
  *             f = self.parse_format(line, value)             # <<<<<<<<<<<<<<
@@ -11187,7 +11313,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
     __pyx_v_f = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":540
+    /* "pysam/cvcf.pyx":540
  *         elif key == "FORMAT":
  *             f = self.parse_format(line, value)
  *             self._format[ f.id ] = f             # <<<<<<<<<<<<<<
@@ -11205,7 +11331,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   }
   /*else*/ {
 
-    /* "cvcf.pyx":543
+    /* "pysam/cvcf.pyx":543
  *         else:
  *             # keep other keys in the header field
  *             self._header.append( (key,value) )             # <<<<<<<<<<<<<<
@@ -11237,7 +11363,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("cvcf.VCF.parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_elts);
@@ -11250,17 +11376,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_19write_header = {__Pyx_NAMESTR("write_header"), (PyCFunction)__pyx_pw_4cvcf_3VCF_19write_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_19write_header = {__Pyx_NAMESTR("write_header"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_19write_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_header (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -11274,12 +11399,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -11300,16 +11423,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObje
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("write_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_18write_header(__pyx_self, __pyx_v_self, __pyx_v_stream);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_18write_header(__pyx_self, __pyx_v_self, __pyx_v_stream);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":546
+/* "pysam/cvcf.pyx":546
  * 
  * 
  *     def write_header( self, stream ):             # <<<<<<<<<<<<<<
@@ -11317,7 +11440,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObje
  *         for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
   PyObject *__pyx_v_key = NULL;
   PyObject *__pyx_v_value = NULL;
   PyObject *__pyx_v_var = NULL;
@@ -11334,15 +11457,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
   PyObject *__pyx_t_7 = NULL;
   PyObject *(*__pyx_t_8)(PyObject *);
   Py_ssize_t __pyx_t_9;
-  PyObject *__pyx_t_10 = NULL;
+  Py_ssize_t __pyx_t_10;
   int __pyx_t_11;
-  PyObject *__pyx_t_12 = NULL;
+  int __pyx_t_12;
+  PyObject *__pyx_t_13 = NULL;
+  PyObject *__pyx_t_14 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("write_header", 0);
 
-  /* "cvcf.pyx":547
+  /* "pysam/cvcf.pyx":547
  * 
  *     def write_header( self, stream ):
  *         stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))             # <<<<<<<<<<<<<<
@@ -11383,7 +11508,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-  /* "cvcf.pyx":548
+  /* "pysam/cvcf.pyx":548
  *     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))             # <<<<<<<<<<<<<<
@@ -11404,10 +11529,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
   for (;;) {
     if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_4 = __pyx_t_6(__pyx_t_2);
       if (unlikely(!__pyx_t_4)) {
@@ -11421,27 +11554,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
     }
     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
       PyObject* sequence = __pyx_t_4;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      Py_ssize_t size = Py_SIZE(sequence);
+      #else
+      Py_ssize_t size = PySequence_Size(sequence);
+      #endif
+      if (unlikely(size != 2)) {
+        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
-        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_t_3);
+      #else
+      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    } else {
+    } else
+    {
       Py_ssize_t index = -1;
       __pyx_t_7 = PyObject_GetIter(__pyx_t_4); 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);
@@ -11452,12 +11591,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
       index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_3);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = NULL;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L6_unpacking_done;
       __pyx_L5_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+      __pyx_t_8 = NULL;
+      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L6_unpacking_done:;
     }
@@ -11493,7 +11633,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":549
+  /* "pysam/cvcf.pyx":549
  *         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")]:             # <<<<<<<<<<<<<<
@@ -11545,30 +11685,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   for (;;) {
     if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
-    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #else
+    __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #endif
     if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
       PyObject* sequence = __pyx_t_2;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      Py_ssize_t size = Py_SIZE(sequence);
+      #else
+      Py_ssize_t size = PySequence_Size(sequence);
+      #endif
+      if (unlikely(size != 2)) {
+        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
-        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_3);
       __Pyx_INCREF(__pyx_t_1);
+      #else
+      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    } else {
+    } else
+    {
       Py_ssize_t index = -1;
       __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
@@ -11579,12 +11729,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
       index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_1);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = NULL;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L10_unpacking_done;
       __pyx_L9_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+      __pyx_t_8 = NULL;
+      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L10_unpacking_done:;
     }
@@ -11595,45 +11746,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
     __pyx_v_label = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":550
+    /* "pysam/cvcf.pyx":550
  *         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"))))             # <<<<<<<<<<<<<<
  * 
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_var, __pyx_n_s__itervalues); 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);
-    __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 = 550; __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_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
-      __pyx_t_6 = NULL;
-    } else {
-      __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); 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);
-      __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
+    __pyx_t_9 = 0;
+    if (unlikely(__pyx_v_var == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "itervalues");
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
-        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++;
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
-        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++;
-      } else {
-        __pyx_t_1 = __pyx_t_6(__pyx_t_2);
-        if (unlikely(!__pyx_t_1)) {
-          if (PyErr_Occurred()) {
-            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
-          break;
-        }
-        __Pyx_GOTREF(__pyx_t_1);
-      }
+    __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_var, 0, ((PyObject *)__pyx_n_s__itervalues), (&__pyx_t_10), (&__pyx_t_11)); 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);
+    __Pyx_XDECREF(__pyx_t_2);
+    __pyx_t_2 = __pyx_t_1;
+    __pyx_t_1 = 0;
+    while (1) {
+      __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_10, &__pyx_t_9, NULL, &__pyx_t_1, NULL, __pyx_t_11);
+      if (unlikely(__pyx_t_12 == 0)) break;
+      if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_XDECREF(__pyx_v_f);
       __pyx_v_f = __pyx_t_1;
       __pyx_t_1 = 0;
@@ -11646,39 +11780,37 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
-      __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-      __pyx_t_11 = __Pyx_PyString_Equals(__pyx_v_label, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__filter), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
+      __pyx_t_14 = PyObject_RichCompare(__pyx_v_label, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__filter), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+      __pyx_t_14 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_14);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_13);
       __Pyx_INCREF(__pyx_v_label);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_label);
+      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_label);
       __Pyx_GIVEREF(__pyx_v_label);
-      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
-      __Pyx_GIVEREF(__pyx_t_12);
-      __pyx_t_12 = 0;
-      __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_84), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-      __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 = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_12));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
-      __pyx_t_12 = 0;
-      __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
+      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
+      __Pyx_GIVEREF(__pyx_t_14);
+      __pyx_t_14 = 0;
+      __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_84), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
+      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+      __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_13);
+      PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_14));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
+      __pyx_t_14 = 0;
+      __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_14);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
@@ -11692,9 +11824,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_AddTraceback("cvcf.VCF.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_13);
+  __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_key);
@@ -11708,17 +11840,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_21parse_heading = {__Pyx_NAMESTR("parse_heading"), (PyCFunction)__pyx_pw_4cvcf_3VCF_21parse_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_21parse_heading = {__Pyx_NAMESTR("parse_heading"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_21parse_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_heading (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -11732,12 +11863,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_heading", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -11758,16 +11887,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("parse_heading", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_20parse_heading(__pyx_self, __pyx_v_self, __pyx_v_line);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(__pyx_self, __pyx_v_self, __pyx_v_line);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":553
+/* "pysam/cvcf.pyx":553
  * 
  * 
  *     def parse_heading( self, line ):             # <<<<<<<<<<<<<<
@@ -11775,7 +11904,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObj
  *         assert not line.startswith('##')
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line) {
   PyObject *__pyx_v_headings = NULL;
   PyObject *__pyx_v_i = NULL;
   PyObject *__pyx_v_s = NULL;
@@ -11800,7 +11929,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("parse_heading", 0);
 
-  /* "cvcf.pyx":554
+  /* "pysam/cvcf.pyx":554
  * 
  *     def parse_heading( self, line ):
  *         assert line.startswith('#')             # <<<<<<<<<<<<<<
@@ -11821,7 +11950,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   }
   #endif
 
-  /* "cvcf.pyx":555
+  /* "pysam/cvcf.pyx":555
  *     def parse_heading( self, line ):
  *         assert line.startswith('#')
  *         assert not line.startswith('##')             # <<<<<<<<<<<<<<
@@ -11842,7 +11971,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   }
   #endif
 
-  /* "cvcf.pyx":556
+  /* "pysam/cvcf.pyx":556
  *         assert line.startswith('#')
  *         assert not line.startswith('##')
  *         headings = line[1:].split('\t')             # <<<<<<<<<<<<<<
@@ -11860,7 +11989,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   __pyx_v_headings = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":558
+  /* "pysam/cvcf.pyx":558
  *         headings = line[1:].split('\t')
  *         # test for 8, as FORMAT field might be missing
  *         if len(headings)==1 and len(line[1:].split()) >= 8:             # <<<<<<<<<<<<<<
@@ -11887,7 +12016,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   }
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":559
+    /* "pysam/cvcf.pyx":559
  *         # test for 8, as FORMAT field might be missing
  *         if len(headings)==1 and len(line[1:].split()) >= 8:
  *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)             # <<<<<<<<<<<<<<
@@ -11912,7 +12041,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":560
+    /* "pysam/cvcf.pyx":560
  *         if len(headings)==1 and len(line[1:].split()) >= 8:
  *             self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
  *             headings = line[1:].split()             # <<<<<<<<<<<<<<
@@ -11934,7 +12063,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":562
+  /* "pysam/cvcf.pyx":562
  *             headings = line[1:].split()
  * 
  *         for i,s in enumerate(self._required):             # <<<<<<<<<<<<<<
@@ -11957,10 +12086,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   for (;;) {
     if (!__pyx_t_8 && 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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_8 && 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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_7 = __pyx_t_8(__pyx_t_1);
       if (unlikely(!__pyx_t_7)) {
@@ -11984,7 +12121,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
     __pyx_t_2 = __pyx_t_7;
     __pyx_t_7 = 0;
 
-    /* "cvcf.pyx":564
+    /* "pysam/cvcf.pyx":564
  *         for i,s in enumerate(self._required):
  * 
  *             if len(headings)<=i or headings[i] != s:             # <<<<<<<<<<<<<<
@@ -11994,16 +12131,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
     __pyx_t_9 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     if (!__pyx_t_6) {
       __pyx_t_10 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_10, __pyx_v_s, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_10, __pyx_v_s, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -12013,7 +12148,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
     }
     if (__pyx_t_5) {
 
-      /* "cvcf.pyx":566
+      /* "pysam/cvcf.pyx":566
  *             if len(headings)<=i or headings[i] != s:
  * 
  *                 if len(headings) <= i:             # <<<<<<<<<<<<<<
@@ -12023,14 +12158,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
       __pyx_t_9 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_5) {
 
-        /* "cvcf.pyx":567
+        /* "pysam/cvcf.pyx":567
  * 
  *                 if len(headings) <= i:
  *                     err = "(%sth entry not found)" % (i+1)             # <<<<<<<<<<<<<<
@@ -12049,7 +12183,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
       }
       /*else*/ {
 
-        /* "cvcf.pyx":569
+        /* "pysam/cvcf.pyx":569
  *                     err = "(%sth entry not found)" % (i+1)
  *                 else:
  *                     err = "(found %s, expected %s)" % (headings[i],s)             # <<<<<<<<<<<<<<
@@ -12075,7 +12209,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
       }
       __pyx_L7:;
 
-      /* "cvcf.pyx":573
+      /* "pysam/cvcf.pyx":573
  *                 #self.error(line,self.BADLY_FORMATTED_HEADING,err)
  *                 # allow FORMAT column to be absent
  *                 if len(headings) == 8:             # <<<<<<<<<<<<<<
@@ -12086,7 +12220,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
       __pyx_t_5 = (__pyx_t_9 == 8);
       if (__pyx_t_5) {
 
-        /* "cvcf.pyx":574
+        /* "pysam/cvcf.pyx":574
  *                 # allow FORMAT column to be absent
  *                 if len(headings) == 8:
  *                     headings.append("FORMAT")             # <<<<<<<<<<<<<<
@@ -12100,7 +12234,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
       }
       /*else*/ {
 
-        /* "cvcf.pyx":576
+        /* "pysam/cvcf.pyx":576
  *                     headings.append("FORMAT")
  *                 else:
  *                     self.error(line,self.BADLY_FORMATTED_HEADING,err)             # <<<<<<<<<<<<<<
@@ -12136,7 +12270,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":578
+  /* "pysam/cvcf.pyx":578
  *                     self.error(line,self.BADLY_FORMATTED_HEADING,err)
  * 
  *         self._samples = headings[9:]             # <<<<<<<<<<<<<<
@@ -12148,7 +12282,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __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;
 
-  /* "cvcf.pyx":579
+  /* "pysam/cvcf.pyx":579
  * 
  *         self._samples = headings[9:]
  *         self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] )             # <<<<<<<<<<<<<<
@@ -12173,10 +12307,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   for (;;) {
     if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_11)) break;
-      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
-      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_10 = __pyx_t_8(__pyx_t_11);
       if (unlikely(!__pyx_t_10)) {
@@ -12209,7 +12351,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
     PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     __pyx_t_10 = 0;
-    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
   }
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
@@ -12234,7 +12376,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_AddTraceback("cvcf.VCF.parse_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_headings);
@@ -12249,17 +12391,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObject *__p
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_23write_heading = {__Pyx_NAMESTR("write_heading"), (PyCFunction)__pyx_pw_4cvcf_3VCF_23write_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_23write_heading = {__Pyx_NAMESTR("write_heading"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_23write_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_heading (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12273,12 +12414,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_heading", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -12299,16 +12438,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("write_heading", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.write_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_22write_heading(__pyx_self, __pyx_v_self, __pyx_v_stream);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_22write_heading(__pyx_self, __pyx_v_self, __pyx_v_stream);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":581
+/* "pysam/cvcf.pyx":581
  *         self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] )
  * 
  *     def write_heading( self, stream ):             # <<<<<<<<<<<<<<
@@ -12316,7 +12455,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObj
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -12329,7 +12468,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__p
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("write_heading", 0);
 
-  /* "cvcf.pyx":582
+  /* "pysam/cvcf.pyx":582
  * 
  *     def write_heading( self, stream ):
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")             # <<<<<<<<<<<<<<
@@ -12382,7 +12521,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__p
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("cvcf.VCF.write_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write_heading", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -12391,17 +12530,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_22write_heading(CYTHON_UNUSED PyObject *__p
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_25convertGT = {__Pyx_NAMESTR("convertGT"), (PyCFunction)__pyx_pw_4cvcf_3VCF_25convertGT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_25convertGT = {__Pyx_NAMESTR("convertGT"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_25convertGT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_GTstring = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTstring,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("convertGT (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTstring,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12415,12 +12553,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTstring);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTstring)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("convertGT", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -12441,16 +12577,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("convertGT", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_24convertGT(__pyx_self, __pyx_v_self, __pyx_v_GTstring);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_24convertGT(__pyx_self, __pyx_v_self, __pyx_v_GTstring);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":584
+/* "pysam/cvcf.pyx":584
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")
  * 
  *     def convertGT(self, GTstring):             # <<<<<<<<<<<<<<
@@ -12458,12 +12594,12 @@ static PyObject *__pyx_pw_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject
  *         try:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_GTstring) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_GTstring) {
   PyObject *__pyx_v_gts = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
@@ -12483,29 +12619,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("convertGT", 0);
 
-  /* "cvcf.pyx":585
+  /* "pysam/cvcf.pyx":585
  * 
  *     def convertGT(self, GTstring):
  *         if GTstring == ".": return ["."]             # <<<<<<<<<<<<<<
  *         try:
  *             gts = gtsRegEx.split(GTstring)
  */
-  __pyx_t_1 = __Pyx_PyString_Equals(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __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 = 585; __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_t_2 = PyList_New(1); 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_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
-    PyList_SET_ITEM(__pyx_t_2, 0, ((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_2);
-    __pyx_t_2 = 0;
+    __pyx_r = ((PyObject *)__pyx_t_1);
+    __pyx_t_1 = 0;
     goto __pyx_L0;
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":586
+  /* "pysam/cvcf.pyx":586
  *     def convertGT(self, GTstring):
  *         if GTstring == ".": return ["."]
  *         try:             # <<<<<<<<<<<<<<
@@ -12519,31 +12657,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
     __Pyx_XGOTREF(__pyx_t_5);
     /*try:*/ {
 
-      /* "cvcf.pyx":587
+      /* "pysam/cvcf.pyx":587
  *         if GTstring == ".": return ["."]
  *         try:
  *             gts = gtsRegEx.split(GTstring)             # <<<<<<<<<<<<<<
  *             if len(gts) == 1: return [int(gts[0])]
  *             if len(gts) != 2: raise ValueError()
  */
-      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gtsRegEx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gtsRegEx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_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 = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __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 = 587; __pyx_clineno = __LINE__; goto __pyx_L4_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 = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_v_GTstring);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_GTstring);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_GTstring);
       __Pyx_GIVEREF(__pyx_v_GTstring);
-      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __pyx_v_gts = __pyx_t_7;
       __pyx_t_7 = 0;
 
-      /* "cvcf.pyx":588
+      /* "pysam/cvcf.pyx":588
  *         try:
  *             gts = gtsRegEx.split(GTstring)
  *             if len(gts) == 1: return [int(gts[0])]             # <<<<<<<<<<<<<<
@@ -12551,32 +12689,32 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
  *             if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
  */
       __pyx_t_8 = PyObject_Length(__pyx_v_gts); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __pyx_t_1 = (__pyx_t_8 == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (__pyx_t_8 == 1);
+      if (__pyx_t_2) {
         __Pyx_XDECREF(__pyx_r);
         __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
+        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(((PyObject *)__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 = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
+        __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 = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_7 = 0;
-        __pyx_r = ((PyObject *)__pyx_t_2);
-        __pyx_t_2 = 0;
+        __pyx_r = ((PyObject *)__pyx_t_1);
+        __pyx_t_1 = 0;
         goto __pyx_L8_try_return;
         goto __pyx_L12;
       }
       __pyx_L12:;
 
-      /* "cvcf.pyx":589
+      /* "pysam/cvcf.pyx":589
  *             gts = gtsRegEx.split(GTstring)
  *             if len(gts) == 1: return [int(gts[0])]
  *             if len(gts) != 2: raise ValueError()             # <<<<<<<<<<<<<<
@@ -12584,41 +12722,45 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
  */
       __pyx_t_8 = PyObject_Length(__pyx_v_gts); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __pyx_t_1 = (__pyx_t_8 != 2);
-      if (__pyx_t_1) {
-        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = (__pyx_t_8 != 2);
+      if (__pyx_t_2) {
+        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         goto __pyx_L13;
       }
       __pyx_L13:;
 
-      /* "cvcf.pyx":590
+      /* "pysam/cvcf.pyx":590
  *             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:
  */
-      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (__pyx_t_1) {
-        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      if (__pyx_t_2) {
+        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_t_10 = __pyx_t_9;
       } else {
-        __pyx_t_10 = __pyx_t_1;
+        __pyx_t_10 = __pyx_t_2;
       }
       if (__pyx_t_10) {
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
@@ -12633,13 +12775,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_12);
-        PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
+        __Pyx_GIVEREF(__pyx_t_1);
         PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         PyList_SET_ITEM(__pyx_t_12, 2, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
-        __pyx_t_2 = 0;
+        __pyx_t_1 = 0;
         __pyx_t_7 = 0;
         __pyx_t_6 = 0;
         __pyx_r = ((PyObject *)__pyx_t_12);
@@ -12649,7 +12791,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
       }
       __pyx_L14:;
 
-      /* "cvcf.pyx":591
+      /* "pysam/cvcf.pyx":591
  *             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])]             # <<<<<<<<<<<<<<
@@ -12679,27 +12821,27 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
       __Pyx_GOTREF(__pyx_t_6);
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
+      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_12);
+      __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 = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
       __Pyx_GIVEREF(__pyx_t_12);
-      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
+      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
       __Pyx_GIVEREF(__pyx_t_6);
-      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
+      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __pyx_t_12 = 0;
       __pyx_t_6 = 0;
       __pyx_t_7 = 0;
-      __pyx_r = ((PyObject *)__pyx_t_2);
-      __pyx_t_2 = 0;
+      __pyx_r = ((PyObject *)__pyx_t_1);
+      __pyx_t_1 = 0;
       goto __pyx_L8_try_return;
     }
     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -12716,9 +12858,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":592
+    /* "pysam/cvcf.pyx":592
  *             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:             # <<<<<<<<<<<<<<
@@ -12727,13 +12869,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
     if (__pyx_t_13) {
-      __Pyx_AddTraceback("cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_AddTraceback("pysam.cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_GOTREF(__pyx_t_6);
 
-      /* "cvcf.pyx":593
+      /* "pysam/cvcf.pyx":593
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
  *         except ValueError:
  *             self.error(self._line,self.BAD_GENOTYPE,GTstring)             # <<<<<<<<<<<<<<
@@ -12763,7 +12905,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
       __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
       __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
 
-      /* "cvcf.pyx":594
+      /* "pysam/cvcf.pyx":594
  *         except ValueError:
  *             self.error(self._line,self.BAD_GENOTYPE,GTstring)
  *             return [".","|","."]             # <<<<<<<<<<<<<<
@@ -12784,11 +12926,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
       __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
       __pyx_r = ((PyObject *)__pyx_t_15);
       __pyx_t_15 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L7_except_return;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L5_exception_handled;
@@ -12816,14 +12958,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_12);
   __Pyx_XDECREF(__pyx_t_14);
   __Pyx_XDECREF(__pyx_t_15);
   __Pyx_XDECREF(__pyx_t_16);
-  __Pyx_AddTraceback("cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_gts);
@@ -12833,17 +12975,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_27convertGTback = {__Pyx_NAMESTR("convertGTback"), (PyCFunction)__pyx_pw_4cvcf_3VCF_27convertGTback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_27convertGTback = {__Pyx_NAMESTR("convertGTback"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_27convertGTback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_GTdata = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTdata,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("convertGTback (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTdata,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12857,12 +12998,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTdata);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTdata)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("convertGTback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -12883,16 +13022,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("convertGTback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.convertGTback", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.convertGTback", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_26convertGTback(__pyx_self, __pyx_v_self, __pyx_v_GTdata);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_26convertGTback(__pyx_self, __pyx_v_self, __pyx_v_GTdata);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":596
+/* "pysam/cvcf.pyx":596
  *             return [".","|","."]
  * 
  *     def convertGTback(self, GTdata):             # <<<<<<<<<<<<<<
@@ -12900,7 +13039,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObj
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_GTdata) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_GTdata) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -12911,7 +13050,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__p
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("convertGTback", 0);
 
-  /* "cvcf.pyx":597
+  /* "pysam/cvcf.pyx":597
  * 
  *     def convertGTback(self, GTdata):
  *         return ''.join(map(str,GTdata))             # <<<<<<<<<<<<<<
@@ -12951,7 +13090,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__p
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCF.convertGTback", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.convertGTback", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -12960,20 +13099,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_26convertGTback(CYTHON_UNUSED PyObject *__p
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_29parse_formatdata = {__Pyx_NAMESTR("parse_formatdata"), (PyCFunction)__pyx_pw_4cvcf_3VCF_29parse_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_29parse_formatdata = {__Pyx_NAMESTR("parse_formatdata"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_29parse_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_29parse_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;
   PyObject *__pyx_v_formatdict = 0;
   PyObject *__pyx_v_line = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__formatdict,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_formatdata (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__formatdict,&__pyx_n_s__line,0};
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12990,30 +13128,25 @@ static PyObject *__pyx_pw_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict);
-        if (likely(values[3])) kw_args--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[4])) kw_args--;
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -13040,16 +13173,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_self, Py
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_28parse_formatdata(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_value, __pyx_v_formatdict, __pyx_v_line);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(__pyx_self, __pyx_v_self, __pyx_v_key, __pyx_v_value, __pyx_v_formatdict, __pyx_v_line);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":599
+/* "pysam/cvcf.pyx":599
  *         return ''.join(map(str,GTdata))
  * 
  *     def parse_formatdata( self, key, value, formatdict, line ):             # <<<<<<<<<<<<<<
@@ -13057,7 +13190,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_self, Py
  *         f = formatdict.get(key,None)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_line) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_formatdict, PyObject *__pyx_v_line) {
   PyObject *__pyx_v_f = NULL;
   PyObject *__pyx_v_values = NULL;
   PyObject *__pyx_v_idx = NULL;
@@ -13088,7 +13221,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("parse_formatdata", 0);
 
-  /* "cvcf.pyx":601
+  /* "pysam/cvcf.pyx":601
  *     def parse_formatdata( self, key, value, formatdict, line ):
  *         # To do: check that the right number of values is present
  *         f = formatdict.get(key,None)             # <<<<<<<<<<<<<<
@@ -13112,20 +13245,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
   __pyx_v_f = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":602
+  /* "pysam/cvcf.pyx":602
  *         # 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]
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __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 = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":603
+    /* "pysam/cvcf.pyx":603
  *         f = formatdict.get(key,None)
  *         if f == None:
  *             self._add_definition(formatdict, key, value, line )             # <<<<<<<<<<<<<<
@@ -13154,7 +13286,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":604
+    /* "pysam/cvcf.pyx":604
  *         if f == None:
  *             self._add_definition(formatdict, key, value, line )
  *             f = formatdict[key]             # <<<<<<<<<<<<<<
@@ -13170,7 +13302,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":605
+  /* "pysam/cvcf.pyx":605
  *             self._add_definition(formatdict, key, value, line )
  *             f = formatdict[key]
  *         if f.type == "Flag":             # <<<<<<<<<<<<<<
@@ -13179,11 +13311,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); 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_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
-    /* "cvcf.pyx":606
+    /* "pysam/cvcf.pyx":606
  *             f = formatdict[key]
  *         if f.type == "Flag":
  *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)             # <<<<<<<<<<<<<<
@@ -13192,28 +13326,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
     __pyx_t_4 = (__pyx_v_value != Py_None);
     if (__pyx_t_4) {
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_96); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __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 = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_96); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __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 = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__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_2);
-      __Pyx_GIVEREF(__pyx_t_2);
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __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;
+      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
+      __Pyx_GIVEREF(__pyx_t_1);
+      __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       goto __pyx_L5;
     }
     __pyx_L5:;
 
-    /* "cvcf.pyx":607
+    /* "pysam/cvcf.pyx":607
  *         if f.type == "Flag":
  *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
  *             return []             # <<<<<<<<<<<<<<
@@ -13221,31 +13355,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  *         # deal with trailing data in some early VCF files
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = ((PyObject *)__pyx_t_2);
-    __pyx_t_2 = 0;
+    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_r = ((PyObject *)__pyx_t_1);
+    __pyx_t_1 = 0;
     goto __pyx_L0;
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "cvcf.pyx":608
+  /* "pysam/cvcf.pyx":608
  *             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_t_2 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __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_v_values = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":610
+  /* "pysam/cvcf.pyx":610
  *         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:             # <<<<<<<<<<<<<<
@@ -13254,9 +13388,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); 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);
-  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!((int)__pyx_t_4)) {
-    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_6 = ((int)__pyx_t_5);
   } else {
     __pyx_t_6 = ((int)__pyx_t_4);
@@ -13269,17 +13407,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     if (__pyx_t_6) {
       __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__find); 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_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_98), NULL); 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);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_neg_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __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_3, __pyx_int_neg_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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 = 610; __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 = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_t_8 = __pyx_t_5;
     } else {
       __pyx_t_8 = __pyx_t_6;
@@ -13290,19 +13427,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
   }
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":611
+    /* "pysam/cvcf.pyx":611
  *         # 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 = 611; __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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __Pyx_INCREF(__pyx_v_line);
@@ -13310,41 +13447,41 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     __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_9, 2, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_3 = 0;
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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_9)); __pyx_t_9 = 0;
+    __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 = 611; __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;
 
-    /* "cvcf.pyx":612
+    /* "pysam/cvcf.pyx":612
  *         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_1 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__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_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __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 = 612; __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 = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_99), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__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_9); __pyx_t_9 = 0;
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __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_2); __pyx_t_2 = 0;
     if (__Pyx_SetItemInt(__pyx_v_values, -1, __pyx_t_9, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     goto __pyx_L6;
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":613
+  /* "pysam/cvcf.pyx":613
  *             self.error(line,self.ERROR_TRAILING_DATA,values[-1])
  *             values[-1] = values[-1].split(';')[0]
  *         if f.type == "Integer":             # <<<<<<<<<<<<<<
@@ -13353,11 +13490,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
   __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":614
+    /* "pysam/cvcf.pyx":614
  *             values[-1] = values[-1].split(';')[0]
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):             # <<<<<<<<<<<<<<
@@ -13365,46 +13504,54 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  *                     if v == ".": values[idx] = f.missingvalue
  */
     __Pyx_INCREF(__pyx_int_0);
-    __pyx_t_9 = __pyx_int_0;
+    __pyx_t_2 = __pyx_int_0;
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
+      __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0;
       __pyx_t_10 = NULL;
     } else {
-      __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext;
+      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_1)) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
-      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_1)) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
+      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_2 = __pyx_t_10(__pyx_t_1);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_1 = __pyx_t_10(__pyx_t_9);
+        if (unlikely(!__pyx_t_1)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_1);
       }
       __Pyx_XDECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_2;
-      __pyx_t_2 = 0;
-      __Pyx_INCREF(__pyx_t_9);
+      __pyx_v_v = __pyx_t_1;
+      __pyx_t_1 = 0;
+      __Pyx_INCREF(__pyx_t_2);
       __Pyx_XDECREF(__pyx_v_idx);
-      __pyx_v_idx = __pyx_t_9;
-      __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_9);
-      __pyx_t_9 = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_idx = __pyx_t_2;
+      __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_2);
+      __pyx_t_2 = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "cvcf.pyx":615
+      /* "pysam/cvcf.pyx":615
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):
  *                 try:             # <<<<<<<<<<<<<<
@@ -13418,38 +13565,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
         __Pyx_XGOTREF(__pyx_t_13);
         /*try:*/ {
 
-          /* "cvcf.pyx":616
+          /* "pysam/cvcf.pyx":616
  *             for idx,v in enumerate(values):
  *                 try:
  *                     if v == ".": values[idx] = f.missingvalue             # <<<<<<<<<<<<<<
  *                     else:        values[idx] = int(v)
  *                 except:
  */
-          __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+          __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           if (__pyx_t_6) {
-            __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_2);
-            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 616; __pyx_clineno = __LINE__; goto __pyx_L10_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 = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             goto __pyx_L18;
           }
           /*else*/ {
 
-            /* "cvcf.pyx":617
+            /* "pysam/cvcf.pyx":617
  *                 try:
  *                     if v == ".": values[idx] = f.missingvalue
  *                     else:        values[idx] = int(v)             # <<<<<<<<<<<<<<
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_INTEGER,"%s=%s" % (key, str(values)))
  */
-            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_2);
+            __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_GOTREF(__pyx_t_1);
             __Pyx_INCREF(__pyx_v_v);
-            PyTuple_SET_ITEM(__pyx_t_2, 0, __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*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __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 = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_GOTREF(__pyx_t_3);
-            __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+            __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 = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
           }
@@ -13460,10 +13609,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 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;
 
-        /* "cvcf.pyx":618
+        /* "pysam/cvcf.pyx":618
  *                     if v == ".": values[idx] = f.missingvalue
  *                     else:        values[idx] = int(v)
  *                 except:             # <<<<<<<<<<<<<<
@@ -13471,13 +13620,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  *                     return [0] * len(values)
  */
         /*except:*/ {
-          __Pyx_AddTraceback("cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
-          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+          __Pyx_AddTraceback("pysam.cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
+          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
           __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_GOTREF(__pyx_t_1);
           __Pyx_GOTREF(__pyx_t_14);
 
-          /* "cvcf.pyx":619
+          /* "pysam/cvcf.pyx":619
  *                     else:        values[idx] = int(v)
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_INTEGER,"%s=%s" % (key, str(values)))             # <<<<<<<<<<<<<<
@@ -13524,7 +13673,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
           __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
 
-          /* "cvcf.pyx":620
+          /* "pysam/cvcf.pyx":620
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_INTEGER,"%s=%s" % (key, str(values)))
  *                     return [0] * len(values)             # <<<<<<<<<<<<<<
@@ -13551,7 +13700,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
           __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
           goto __pyx_L13_except_return;
           __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_14); __pyx_t_14 = 0;
           goto __pyx_L11_exception_handled;
         }
@@ -13575,10 +13724,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
         __pyx_L17_try_end:;
       }
     }
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":621
+    /* "pysam/cvcf.pyx":621
  *                     self.error(line,self.ERROR_FORMAT_NOT_INTEGER,"%s=%s" % (key, str(values)))
  *                     return [0] * len(values)
  *             return values             # <<<<<<<<<<<<<<
@@ -13592,20 +13741,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     goto __pyx_L7;
   }
 
-  /* "cvcf.pyx":622
+  /* "pysam/cvcf.pyx":622
  *                     return [0] * len(values)
  *             return values
  *         elif f.type == "String":             # <<<<<<<<<<<<<<
  *             self._line = line
  *             if f.id == "GT": values = list(map( self.convertGT, values ))
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__String), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":623
+    /* "pysam/cvcf.pyx":623
  *             return values
  *         elif f.type == "String":
  *             self._line = line             # <<<<<<<<<<<<<<
@@ -13614,7 +13765,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___line, __pyx_v_line) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "cvcf.pyx":624
+    /* "pysam/cvcf.pyx":624
  *         elif f.type == "String":
  *             self._line = line
  *             if f.id == "GT": values = list(map( self.convertGT, values ))             # <<<<<<<<<<<<<<
@@ -13623,38 +13774,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
     __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__GT), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__GT), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_6) {
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__convertGT); if (unlikely(!__pyx_t_9)) {__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__convertGT); 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_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
-      __Pyx_GIVEREF(__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_1, 1, __pyx_v_values);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_values);
       __Pyx_GIVEREF(__pyx_v_values);
-      __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
-      __Pyx_GIVEREF(__pyx_t_9);
-      __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = 0;
+      __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_v_values);
-      __pyx_v_values = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_values = __pyx_t_2;
+      __pyx_t_2 = 0;
       goto __pyx_L21;
     }
     __pyx_L21:;
 
-    /* "cvcf.pyx":625
+    /* "pysam/cvcf.pyx":625
  *             self._line = line
  *             if f.id == "GT": values = list(map( self.convertGT, values ))
  *             return values             # <<<<<<<<<<<<<<
@@ -13668,20 +13821,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     goto __pyx_L7;
   }
 
-  /* "cvcf.pyx":626
+  /* "pysam/cvcf.pyx":626
  *             if f.id == "GT": values = list(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)
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); 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_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Character), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__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_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":627
+    /* "pysam/cvcf.pyx":627
  *             return values
  *         elif f.type == "Character":
  *             for v in values:             # <<<<<<<<<<<<<<
@@ -13699,26 +13854,34 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     for (;;) {
       if (!__pyx_t_10 && 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++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else if (!__pyx_t_10 && 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++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_1 = __pyx_t_10(__pyx_t_9);
-        if (unlikely(!__pyx_t_1)) {
+        __pyx_t_2 = __pyx_t_10(__pyx_t_9);
+        if (unlikely(!__pyx_t_2)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_2);
       }
       __Pyx_XDECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_1;
-      __pyx_t_1 = 0;
+      __pyx_v_v = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":628
+      /* "pysam/cvcf.pyx":628
  *         elif f.type == "Character":
  *             for v in values:
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)             # <<<<<<<<<<<<<<
@@ -13728,22 +13891,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
       __pyx_t_19 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_6 = (__pyx_t_19 != 1);
       if (__pyx_t_6) {
-        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_14 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_101); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_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_14);
+        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14);
         __Pyx_GIVEREF(__pyx_t_14);
         __pyx_t_14 = 0;
-        __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_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(__pyx_t_14); __pyx_t_14 = 0;
         goto __pyx_L24;
       }
@@ -13751,7 +13914,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     }
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-    /* "cvcf.pyx":629
+    /* "pysam/cvcf.pyx":629
  *             for v in values:
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
  *             return values             # <<<<<<<<<<<<<<
@@ -13765,7 +13928,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
     goto __pyx_L7;
   }
 
-  /* "cvcf.pyx":630
+  /* "pysam/cvcf.pyx":630
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
  *             return values
  *         elif f.type == "Float":             # <<<<<<<<<<<<<<
@@ -13774,11 +13937,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  */
   __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":631
+    /* "pysam/cvcf.pyx":631
  *             return values
  *         elif f.type == "Float":
  *             for idx,v in enumerate(values):             # <<<<<<<<<<<<<<
@@ -13786,66 +13951,76 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  *             try: return list(map(float,values))
  */
     __Pyx_INCREF(__pyx_int_0);
-    __pyx_t_9 = __pyx_int_0;
+    __pyx_t_14 = __pyx_int_0;
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_14 = __pyx_v_values; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
+      __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0;
       __pyx_t_10 = NULL;
     } else {
-      __pyx_t_7 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_14);
-      __pyx_t_10 = Py_TYPE(__pyx_t_14)->tp_iternext;
+      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); 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 = Py_TYPE(__pyx_t_9)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_14)) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
-      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_14)) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
+      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_2 = __pyx_t_10(__pyx_t_14);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_1 = __pyx_t_10(__pyx_t_9);
+        if (unlikely(!__pyx_t_1)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_1);
       }
       __Pyx_XDECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_2;
-      __pyx_t_2 = 0;
-      __Pyx_INCREF(__pyx_t_9);
+      __pyx_v_v = __pyx_t_1;
+      __pyx_t_1 = 0;
+      __Pyx_INCREF(__pyx_t_14);
       __Pyx_XDECREF(__pyx_v_idx);
-      __pyx_v_idx = __pyx_t_9;
-      __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_9);
-      __pyx_t_9 = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_idx = __pyx_t_14;
+      __pyx_t_1 = PyNumber_Add(__pyx_t_14, __pyx_int_1); 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_DECREF(__pyx_t_14);
+      __pyx_t_14 = __pyx_t_1;
+      __pyx_t_1 = 0;
 
-      /* "cvcf.pyx":632
+      /* "pysam/cvcf.pyx":632
  *         elif f.type == "Float":
  *             for idx,v in enumerate(values):
  *                 if v == ".": values[idx] = f.missingvalue             # <<<<<<<<<<<<<<
  *             try: return list(map(float,values))
  *             except:
  */
-      __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_6) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 632; __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 = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L27;
       }
       __pyx_L27:;
     }
-    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
 
-    /* "cvcf.pyx":633
+    /* "pysam/cvcf.pyx":633
  *             for idx,v in enumerate(values):
  *                 if v == ".": values[idx] = f.missingvalue
  *             try: return list(map(float,values))             # <<<<<<<<<<<<<<
@@ -13859,27 +14034,27 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
       __Pyx_XGOTREF(__pyx_t_11);
       /*try:*/ {
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __Pyx_GOTREF(__pyx_t_14);
         __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
-        PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
+        PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
         __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
         __Pyx_INCREF(__pyx_v_values);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_values);
+        PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_values);
         __Pyx_GIVEREF(__pyx_v_values);
-        __pyx_t_14 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
-        __Pyx_GOTREF(__pyx_t_14);
-        __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 = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_14);
-        __Pyx_GIVEREF(__pyx_t_14);
-        __pyx_t_14 = 0;
-        __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+        __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-        __pyx_r = __pyx_t_14;
-        __pyx_t_14 = 0;
+        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
+        __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+        __pyx_r = __pyx_t_9;
+        __pyx_t_9 = 0;
         goto __pyx_L32_try_return;
       }
       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
@@ -13898,12 +14073,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
       __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
       __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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_1); __pyx_t_1 = 0;
       __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-      /* "cvcf.pyx":634
+      /* "pysam/cvcf.pyx":634
  *                 if v == ".": values[idx] = f.missingvalue
  *             try: return list(map(float,values))
  *             except:             # <<<<<<<<<<<<<<
@@ -13911,21 +14086,21 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
  *                 return [0.0] * len(values)
  */
       /*except:*/ {
-        __Pyx_AddTraceback("cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_9, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
-        __Pyx_GOTREF(__pyx_t_14);
+        __Pyx_AddTraceback("pysam.cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
+        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_14, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_14);
+        __Pyx_GOTREF(__pyx_t_1);
 
-        /* "cvcf.pyx":635
+        /* "pysam/cvcf.pyx":635
  *             try: return list(map(float,values))
  *             except:
  *                 self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,"%s=%s" % (key, str(values)))             # <<<<<<<<<<<<<<
  *                 return [0.0] * len(values)
  *         else:
  */
-        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_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 = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
@@ -13958,13 +14133,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
         __Pyx_GIVEREF(((PyObject *)__pyx_t_17));
         __pyx_t_3 = 0;
         __pyx_t_17 = 0;
-        __pyx_t_17 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
+        __pyx_t_17 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_17);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
 
-        /* "cvcf.pyx":636
+        /* "pysam/cvcf.pyx":636
  *             except:
  *                 self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,"%s=%s" % (key, str(values)))
  *                 return [0.0] * len(values)             # <<<<<<<<<<<<<<
@@ -13987,13 +14162,13 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
         __pyx_r = ((PyObject *)__pyx_t_18);
         __pyx_t_18 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
         goto __pyx_L31_except_return;
-        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         goto __pyx_L29_exception_handled;
       }
       __pyx_L30_except_error:;
@@ -14019,30 +14194,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
   }
   /*else*/ {
 
-    /* "cvcf.pyx":639
+    /* "pysam/cvcf.pyx":639
  *         else:
  *             # can't happen
  *             self.error(line,self.ERROR_INFO_STRING)             # <<<<<<<<<<<<<<
  * 
  *     def inregion(self, chrom, pos):
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __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 = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_14 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
+    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_9);
-    __Pyx_GIVEREF(__pyx_t_9);
-    __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_14);
+    __Pyx_GIVEREF(__pyx_t_14);
+    __pyx_t_14 = 0;
+    __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_14);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   }
   __pyx_L7:;
 
@@ -14058,7 +14233,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
   __Pyx_XDECREF(__pyx_t_16);
   __Pyx_XDECREF(__pyx_t_17);
   __Pyx_XDECREF(__pyx_t_18);
-  __Pyx_AddTraceback("cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_f);
@@ -14071,18 +14246,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyObject *
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_31inregion = {__Pyx_NAMESTR("inregion"), (PyCFunction)__pyx_pw_4cvcf_3VCF_31inregion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_31inregion = {__Pyx_NAMESTR("inregion"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_31inregion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_chrom = 0;
   PyObject *__pyx_v_pos = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__chrom,&__pyx_n_s__pos,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("inregion (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__chrom,&__pyx_n_s__pos,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -14097,18 +14271,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -14131,16 +14302,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.inregion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.inregion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_30inregion(__pyx_self, __pyx_v_self, __pyx_v_chrom, __pyx_v_pos);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_30inregion(__pyx_self, __pyx_v_self, __pyx_v_chrom, __pyx_v_pos);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":641
+/* "pysam/cvcf.pyx":641
  *             self.error(line,self.ERROR_INFO_STRING)
  * 
  *     def inregion(self, chrom, pos):             # <<<<<<<<<<<<<<
@@ -14148,7 +14319,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyObject *
  *         for r in self._regions:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_chrom, PyObject *__pyx_v_pos) {
   PyObject *__pyx_v_r = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -14166,7 +14337,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("inregion", 0);
 
-  /* "cvcf.pyx":642
+  /* "pysam/cvcf.pyx":642
  * 
  *     def inregion(self, chrom, pos):
  *         if not self._regions: return True             # <<<<<<<<<<<<<<
@@ -14189,7 +14360,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":643
+  /* "pysam/cvcf.pyx":643
  *     def inregion(self, chrom, pos):
  *         if not self._regions: return True
  *         for r in self._regions:             # <<<<<<<<<<<<<<
@@ -14210,10 +14381,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
   for (;;) {
     if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
       if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
       if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_1 = __pyx_t_6(__pyx_t_4);
       if (unlikely(!__pyx_t_1)) {
@@ -14229,7 +14408,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
     __pyx_v_r = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":644
+    /* "pysam/cvcf.pyx":644
  *         if not self._regions: return True
  *         for r in self._regions:
  *             if r[0] == chrom and r[1] <= pos < r[2]: return True             # <<<<<<<<<<<<<<
@@ -14238,22 +14417,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
  */
     __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_r, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_chrom, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_chrom, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     if (__pyx_t_3) {
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_r, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_v_pos, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_v_pos, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
         __Pyx_DECREF(__pyx_t_1);
         __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_r, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos, __pyx_t_8, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       }
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -14277,7 +14453,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-  /* "cvcf.pyx":645
+  /* "pysam/cvcf.pyx":645
  *         for r in self._regions:
  *             if r[0] == chrom and r[1] <= pos < r[2]: return True
  *         return False             # <<<<<<<<<<<<<<
@@ -14298,7 +14474,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("cvcf.VCF.inregion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.inregion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_r);
@@ -14307,7 +14483,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
   return __pyx_r;
 }
 
-/* "cvcf.pyx":647
+/* "pysam/cvcf.pyx":647
  *         return False
  * 
  *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
@@ -14315,7 +14491,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *__pyx_se
  *         if len(cols) != len(self._samples)+9:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_93__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_93__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -14337,7 +14513,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_93__defaults__(CYTHON_UNUSED PyObject *__py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -14346,18 +14522,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_93__defaults__(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_33parse_data = {__Pyx_NAMESTR("parse_data"), (PyCFunction)__pyx_pw_4cvcf_3VCF_33parse_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_33parse_data = {__Pyx_NAMESTR("parse_data"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_33parse_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_33parse_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;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__lineparse,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_data (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__lineparse,0};
     PyObject* values[3] = {0,0,0};
     __pyx_defaults4 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self);
     values[2] = __pyx_dynamic_args->__pyx_arg_lineparse;
@@ -14374,12 +14549,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_data", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -14409,17 +14582,17 @@ static PyObject *__pyx_pw_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("parse_data", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_32parse_data(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_lineparse);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_32parse_data(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_lineparse);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
-static PyObject *__pyx_gb_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
 
-/* "cvcf.pyx":790
+/* "pysam/cvcf.pyx":790
  *         if alt:
  *             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():             # <<<<<<<<<<<<<<
@@ -14427,25 +14600,25 @@ static PyObject *__pyx_gb_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObj
  *                 ref, alt = ref[:-1], [allele[:-1] for allele in alt]
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_10parse_data_genexpr(PyObject *__pyx_self) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10parse_data_genexpr(PyObject *__pyx_self) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("genexpr", 0);
-  __pyx_cur_scope = (struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *)__pyx_ptype_4cvcf___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_4cvcf___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
+  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)__pyx_ptype_5pysam_4cvcf___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_5pysam_4cvcf___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
   if (unlikely(!__pyx_cur_scope)) {
     __Pyx_RefNannyFinishContext();
     return NULL;
   }
   __Pyx_GOTREF(__pyx_cur_scope);
-  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *) __pyx_self;
+  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *) __pyx_self;
   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
   {
-    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cvcf_3VCF_10parse_data_2generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cvcf_3VCF_10parse_data_2generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_cur_scope);
     __Pyx_RefNannyFinishContext();
     return (PyObject *) gen;
@@ -14454,7 +14627,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10parse_data_genexpr(PyObject *__pyx_self)
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse_data.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
@@ -14463,9 +14636,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_10parse_data_genexpr(PyObject *__pyx_self)
   return __pyx_r;
 }
 
-static PyObject *__pyx_gb_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
 {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   Py_ssize_t __pyx_t_2;
@@ -14495,10 +14668,18 @@ static PyObject *__pyx_gb_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObj
   for (;;) {
     if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
       if (unlikely(!__pyx_t_4)) {
@@ -14553,11 +14734,12 @@ static PyObject *__pyx_gb_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObj
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
   __pyx_generator->resume_label = -1;
+  __Pyx_Generator_clear((PyObject*)__pyx_generator);
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
 
-/* "cvcf.pyx":647
+/* "pysam/cvcf.pyx":647
  *         return False
  * 
  *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
@@ -14565,8 +14747,8 @@ static PyObject *__pyx_gb_4cvcf_3VCF_10parse_data_2generator1(__pyx_GeneratorObj
  *         if len(cols) != len(self._samples)+9:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_lineparse) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *__pyx_cur_scope;
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_lineparse) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *__pyx_cur_scope;
   PyObject *__pyx_v_cols = NULL;
   PyObject *__pyx_v_chrom = NULL;
   PyObject *__pyx_v_pos = NULL;
@@ -14639,14 +14821,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("parse_data", 0);
-  __pyx_cur_scope = (struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *)__pyx_ptype_4cvcf___pyx_scope_struct__parse_data->tp_new(__pyx_ptype_4cvcf___pyx_scope_struct__parse_data, __pyx_empty_tuple, NULL);
+  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)__pyx_ptype_5pysam_4cvcf___pyx_scope_struct__parse_data->tp_new(__pyx_ptype_5pysam_4cvcf___pyx_scope_struct__parse_data, __pyx_empty_tuple, NULL);
   if (unlikely(!__pyx_cur_scope)) {
     __Pyx_RefNannyFinishContext();
     return NULL;
   }
   __Pyx_GOTREF(__pyx_cur_scope);
 
-  /* "cvcf.pyx":648
+  /* "pysam/cvcf.pyx":648
  * 
  *     def parse_data( self, line, lineparse=False ):
  *         cols = line.split('\t')             # <<<<<<<<<<<<<<
@@ -14661,7 +14843,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_cols = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":649
+  /* "pysam/cvcf.pyx":649
  *     def parse_data( self, line, lineparse=False ):
  *         cols = line.split('\t')
  *         if len(cols) != len(self._samples)+9:             # <<<<<<<<<<<<<<
@@ -14676,7 +14858,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_5 = (__pyx_t_3 != (__pyx_t_4 + 9));
   if (__pyx_t_5) {
 
-    /* "cvcf.pyx":652
+    /* "pysam/cvcf.pyx":652
  *             # gracefully deal with absent FORMAT column
  *             # and those missing samples
  *             if len(cols) == 8:             # <<<<<<<<<<<<<<
@@ -14687,7 +14869,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_t_5 = (__pyx_t_4 == 8);
     if (__pyx_t_5) {
 
-      /* "cvcf.pyx":653
+      /* "pysam/cvcf.pyx":653
  *             # and those missing samples
  *             if len(cols) == 8:
  *                 cols.append("")             # <<<<<<<<<<<<<<
@@ -14701,7 +14883,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     }
     /*else*/ {
 
-      /* "cvcf.pyx":655
+      /* "pysam/cvcf.pyx":655
  *                 cols.append("")
  *             else:
  *                 self.error(line,             # <<<<<<<<<<<<<<
@@ -14711,7 +14893,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
 
-      /* "cvcf.pyx":656
+      /* "pysam/cvcf.pyx":656
  *             else:
  *                 self.error(line,
  *                            self.BAD_NUMBER_OF_COLUMNS,             # <<<<<<<<<<<<<<
@@ -14721,7 +14903,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_104); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
 
-      /* "cvcf.pyx":657
+      /* "pysam/cvcf.pyx":657
  *                 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)))             # <<<<<<<<<<<<<<
@@ -14784,7 +14966,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":659
+  /* "pysam/cvcf.pyx":659
  *                            "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))
  * 
  *         chrom = cols[0]             # <<<<<<<<<<<<<<
@@ -14796,7 +14978,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_chrom = __pyx_t_9;
   __pyx_t_9 = 0;
 
-  /* "cvcf.pyx":662
+  /* "pysam/cvcf.pyx":662
  * 
  *         # get 0-based position
  *         try:    pos = int(cols[1])-1             # <<<<<<<<<<<<<<
@@ -14838,7 +15020,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-    /* "cvcf.pyx":663
+    /* "pysam/cvcf.pyx":663
  *         # get 0-based position
  *         try:    pos = int(cols[1])-1
  *         except: self.error(line,self.POS_NOT_NUMERICAL)             # <<<<<<<<<<<<<<
@@ -14846,7 +15028,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  * 
  */
     /*except:*/ {
-      __Pyx_AddTraceback("cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
       if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_GOTREF(__pyx_t_9);
@@ -14887,7 +15069,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_L12_try_end:;
   }
 
-  /* "cvcf.pyx":664
+  /* "pysam/cvcf.pyx":664
  *         try:    pos = int(cols[1])-1
  *         except: self.error(line,self.POS_NOT_NUMERICAL)
  *         if pos < 0: self.error(line,self.POS_NOT_POSITIVE)             # <<<<<<<<<<<<<<
@@ -14895,8 +15077,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *         # implement filtering
  */
   if (unlikely(!__pyx_v_pos)) { __Pyx_RaiseUnboundLocalError("pos"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __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 = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __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 = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_5) {
@@ -14921,7 +15102,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L15:;
 
-  /* "cvcf.pyx":667
+  /* "pysam/cvcf.pyx":667
  * 
  *         # implement filtering
  *         if not self.inregion(chrom,pos): return None             # <<<<<<<<<<<<<<
@@ -14954,7 +15135,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L16:;
 
-  /* "cvcf.pyx":670
+  /* "pysam/cvcf.pyx":670
  * 
  *         # end of first-pass parse for sortedVCF
  *         if lineparse: return chrom, pos, line             # <<<<<<<<<<<<<<
@@ -14982,7 +15163,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L17:;
 
-  /* "cvcf.pyx":672
+  /* "pysam/cvcf.pyx":672
  *         if lineparse: return chrom, pos, line
  * 
  *         id = cols[2]             # <<<<<<<<<<<<<<
@@ -14994,7 +15175,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_id = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":674
+  /* "pysam/cvcf.pyx":674
  *         id = cols[2]
  * 
  *         ref = cols[3].upper()             # <<<<<<<<<<<<<<
@@ -15012,17 +15193,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_ref = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":675
+  /* "pysam/cvcf.pyx":675
  * 
  *         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_14 = __Pyx_PyString_Equals(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_14) {
 
-    /* "cvcf.pyx":676
+    /* "pysam/cvcf.pyx":676
  *         ref = cols[3].upper()
  *         if ref == ".":
  *             self.error(line,self.MISSING_REF)             # <<<<<<<<<<<<<<
@@ -15047,7 +15230,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-    /* "cvcf.pyx":677
+    /* "pysam/cvcf.pyx":677
  *         if ref == ".":
  *             self.error(line,self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)             # <<<<<<<<<<<<<<
@@ -15056,8 +15239,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); 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_t_9 = PyObject_RichCompare(__pyx_t_10, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__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_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
@@ -15093,7 +15275,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     }
     /*else*/ {
 
-      /* "cvcf.pyx":678
+      /* "pysam/cvcf.pyx":678
  *             self.error(line,self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  *             else:                   ref = ""             # <<<<<<<<<<<<<<
@@ -15109,7 +15291,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":680
+    /* "pysam/cvcf.pyx":680
  *             else:                   ref = ""
  *         else:
  *             for c in ref:             # <<<<<<<<<<<<<<
@@ -15127,10 +15309,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     for (;;) {
       if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
         __pyx_t_8 = __pyx_t_15(__pyx_t_2);
         if (unlikely(!__pyx_t_8)) {
@@ -15146,14 +15336,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_v_c = __pyx_t_8;
       __pyx_t_8 = 0;
 
-      /* "cvcf.pyx":681
+      /* "pysam/cvcf.pyx":681
  *         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_14 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_n_s__ACGTN), __pyx_v_c))); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_14 = (__Pyx_PySequence_Contains(__pyx_v_c, ((PyObject *)__pyx_n_s__ACGTN), Py_NE)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_14) {
         __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -15178,14 +15368,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":682
+    /* "pysam/cvcf.pyx":682
  *             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_14 = ((PySequence_Contains(__pyx_v_ref, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__N), __pyx_v_ref, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_14) {
       __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
@@ -15224,7 +15414,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L18:;
 
-  /* "cvcf.pyx":685
+  /* "pysam/cvcf.pyx":685
  * 
  *         # make sure reference is sane
  *         if self._reference:             # <<<<<<<<<<<<<<
@@ -15237,7 +15427,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_14) {
 
-    /* "cvcf.pyx":686
+    /* "pysam/cvcf.pyx":686
  *         # make sure reference is sane
  *         if self._reference:
  *             left = max(0,pos-100)             # <<<<<<<<<<<<<<
@@ -15249,8 +15439,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_t_16 = 0;
     __pyx_t_2 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_2, Py_GT); 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_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -15264,27 +15453,29 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_10 = 0;
     }
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_INCREF(__pyx_t_8);
-    __pyx_v_left = __pyx_t_8;
+    __pyx_t_9 = __pyx_t_8;
+    __Pyx_INCREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_v_left = __pyx_t_9;
+    __pyx_t_9 = 0;
 
-    /* "cvcf.pyx":687
+    /* "pysam/cvcf.pyx":687
  *         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))
  */
-    __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __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 = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); 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_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __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 = 687; __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 = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_8); 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_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 = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
     __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);
     __Pyx_INCREF(__pyx_v_chrom);
@@ -15295,81 +15486,80 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_GIVEREF(__pyx_v_left);
     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
-    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9);
-    __Pyx_GIVEREF(__pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
+    __Pyx_GIVEREF(__pyx_t_8);
     __pyx_t_10 = 0;
-    __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__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_8); __pyx_t_8 = 0;
+    __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_v_faref_leftflank = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_v_faref_leftflank = __pyx_t_8;
+    __pyx_t_8 = 0;
 
-    /* "cvcf.pyx":688
+    /* "pysam/cvcf.pyx":688
  *             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
  */
-    __pyx_t_9 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_v_faref = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_t_8 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_v_faref = __pyx_t_8;
+    __pyx_t_8 = 0;
 
-    /* "cvcf.pyx":689
+    /* "pysam/cvcf.pyx":689
  *             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
  * 
  */
-    __pyx_t_9 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (__pyx_t_14) {
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __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 = 689; __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 = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_faref);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_faref);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_faref);
       __Pyx_GIVEREF(__pyx_v_faref);
       __Pyx_INCREF(__pyx_v_ref);
-      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_ref);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_ref);
       __Pyx_GIVEREF(__pyx_v_ref);
-      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_106), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_106), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-      __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 = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __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 = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_t_10));
+      PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_t_10));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
       __pyx_t_2 = 0;
       __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __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_8)); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L25;
     }
     __pyx_L25:;
 
-    /* "cvcf.pyx":690
+    /* "pysam/cvcf.pyx":690
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
  *             ref = faref             # <<<<<<<<<<<<<<
@@ -15383,7 +15573,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L24:;
 
-  /* "cvcf.pyx":693
+  /* "pysam/cvcf.pyx":693
  * 
  *         # convert v3.3 to v4.0 alleles below
  *         if cols[4] == ".": alt = []             # <<<<<<<<<<<<<<
@@ -15392,55 +15582,59 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
   __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_14) {
-    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
-    __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_10);
-    __pyx_t_10 = 0;
+    __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
+    __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_9);
+    __pyx_t_9 = 0;
     goto __pyx_L26;
   }
   /*else*/ {
 
-    /* "cvcf.pyx":694
+    /* "pysam/cvcf.pyx":694
  *         # convert v3.3 to v4.0 alleles below
  *         if cols[4] == ".": alt = []
  *         else: alt = cols[4].upper().split(',')             # <<<<<<<<<<<<<<
  * 
  *         if cols[5] == ".": qual = -1
  */
-    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __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_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __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_8, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __Pyx_GIVEREF(__pyx_t_10);
-    __pyx_cur_scope->__pyx_v_alt = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __Pyx_GIVEREF(__pyx_t_9);
+    __pyx_cur_scope->__pyx_v_alt = __pyx_t_9;
+    __pyx_t_9 = 0;
   }
   __pyx_L26:;
 
-  /* "cvcf.pyx":696
+  /* "pysam/cvcf.pyx":696
  *         else: alt = cols[4].upper().split(',')
  * 
  *         if cols[5] == ".": qual = -1             # <<<<<<<<<<<<<<
  *         else:
  *             try:    qual = float(cols[5])
  */
-  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_14) {
     __pyx_v_qual = -1.0;
@@ -15448,7 +15642,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":698
+    /* "pysam/cvcf.pyx":698
  *         if cols[5] == ".": qual = -1
  *         else:
  *             try:    qual = float(cols[5])             # <<<<<<<<<<<<<<
@@ -15476,11 +15670,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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;
 
-      /* "cvcf.pyx":699
+      /* "pysam/cvcf.pyx":699
  *         else:
  *             try:    qual = float(cols[5])
  *             except: self.error(line,self.QUAL_NOT_NUMERICAL)             # <<<<<<<<<<<<<<
@@ -15488,11 +15682,11 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *         # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
  */
       /*except:*/ {
-        __Pyx_AddTraceback("cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
+        __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __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 = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
@@ -15511,8 +15705,8 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L29_exception_handled;
       }
       __pyx_L30_except_error:;
@@ -15531,26 +15725,32 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L27:;
 
-  /* "cvcf.pyx":702
+  /* "pysam/cvcf.pyx":702
  * 
  *         # 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_9 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (!__pyx_t_14) {
     __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__PASS), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__PASS), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (!__pyx_t_5) {
-      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_18 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s__0), Py_EQ); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_kp_s__0), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_19 = __pyx_t_18;
     } else {
@@ -15569,7 +15769,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":703
+    /* "pysam/cvcf.pyx":703
  *         # 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(';')             # <<<<<<<<<<<<<<
@@ -15589,7 +15789,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L38:;
 
-  /* "cvcf.pyx":706
+  /* "pysam/cvcf.pyx":706
  * 
  *         # dictionary of keys, and list of values
  *         info = {}             # <<<<<<<<<<<<<<
@@ -15601,7 +15801,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_info = __pyx_t_9;
   __pyx_t_9 = 0;
 
-  /* "cvcf.pyx":707
+  /* "pysam/cvcf.pyx":707
  *         # dictionary of keys, and list of values
  *         info = {}
  *         if cols[7] != ".":             # <<<<<<<<<<<<<<
@@ -15610,73 +15810,83 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
   __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__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_5 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (__pyx_t_5) {
 
-    /* "cvcf.pyx":708
+    /* "pysam/cvcf.pyx":708
  *         info = {}
  *         if cols[7] != ".":
  *             for blurp in cols[7].split(';'):             # <<<<<<<<<<<<<<
  *                 elts = blurp.split('=')
  *                 if len(elts) == 1: v = None
  */
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__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_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__split); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
-      __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
+      __pyx_t_9 = __pyx_t_8; __Pyx_INCREF(__pyx_t_9); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_8); 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_15 = Py_TYPE(__pyx_t_9)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_9)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_9)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_9 = __pyx_t_15(__pyx_t_8);
-        if (unlikely(!__pyx_t_9)) {
+        __pyx_t_8 = __pyx_t_15(__pyx_t_9);
+        if (unlikely(!__pyx_t_8)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_8);
       }
       __Pyx_XDECREF(__pyx_v_blurp);
-      __pyx_v_blurp = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_blurp = __pyx_t_8;
+      __pyx_t_8 = 0;
 
-      /* "cvcf.pyx":709
+      /* "pysam/cvcf.pyx":709
  *         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_9 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); 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_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_110), NULL); 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_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_v_elts);
       __pyx_v_elts = __pyx_t_10;
       __pyx_t_10 = 0;
 
-      /* "cvcf.pyx":710
+      /* "pysam/cvcf.pyx":710
  *             for blurp in cols[7].split(';'):
  *                 elts = blurp.split('=')
  *                 if len(elts) == 1: v = None             # <<<<<<<<<<<<<<
@@ -15692,7 +15902,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         goto __pyx_L42;
       }
 
-      /* "cvcf.pyx":711
+      /* "pysam/cvcf.pyx":711
  *                 elts = blurp.split('=')
  *                 if len(elts) == 1: v = None
  *                 elif len(elts) == 2: v = elts[1]             # <<<<<<<<<<<<<<
@@ -15711,7 +15921,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       }
       /*else*/ {
 
-        /* "cvcf.pyx":712
+        /* "pysam/cvcf.pyx":712
  *                 if len(elts) == 1: v = None
  *                 elif len(elts) == 2: v = elts[1]
  *                 else: self.error(line,self.ERROR_INFO_STRING)             # <<<<<<<<<<<<<<
@@ -15720,37 +15930,37 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
         __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __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 = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__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_9);
-        __Pyx_GIVEREF(__pyx_t_9);
-        __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
+        __Pyx_GIVEREF(__pyx_t_8);
+        __pyx_t_8 = 0;
+        __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       }
       __pyx_L42:;
 
-      /* "cvcf.pyx":713
+      /* "pysam/cvcf.pyx":713
  *                 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,
  */
-      __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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
 
-      /* "cvcf.pyx":714
+      /* "pysam/cvcf.pyx":714
  *                 else: self.error(line,self.ERROR_INFO_STRING)
  *                 info[elts[0]] = self.parse_formatdata(elts[0],
  *                                                       v,             # <<<<<<<<<<<<<<
@@ -15759,7 +15969,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
       if (unlikely(!__pyx_v_v)) { __Pyx_RaiseUnboundLocalError("v"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
 
-      /* "cvcf.pyx":715
+      /* "pysam/cvcf.pyx":715
  *                 info[elts[0]] = self.parse_formatdata(elts[0],
  *                                                       v,
  *                                                       self._info,             # <<<<<<<<<<<<<<
@@ -15769,7 +15979,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
 
-      /* "cvcf.pyx":716
+      /* "pysam/cvcf.pyx":716
  *                                                       v,
  *                                                       self._info,
  *                                                       line)             # <<<<<<<<<<<<<<
@@ -15790,12 +16000,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __Pyx_GIVEREF(__pyx_v_line);
       __pyx_t_7 = 0;
       __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __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_8); __pyx_t_8 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-      /* "cvcf.pyx":713
+      /* "pysam/cvcf.pyx":713
  *                 elif len(elts) == 2: v = elts[1]
  *                 else: self.error(line,self.ERROR_INFO_STRING)
  *                 info[elts[0]] = self.parse_formatdata(elts[0],             # <<<<<<<<<<<<<<
@@ -15808,52 +16018,54 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     }
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     goto __pyx_L39;
   }
   __pyx_L39:;
 
-  /* "cvcf.pyx":719
+  /* "pysam/cvcf.pyx":719
  * 
  *         # Gracefully deal with absent FORMAT column
  *         if cols[8] == "": format = []             # <<<<<<<<<<<<<<
  *         else: format = cols[8].split(':')
  * 
  */
-  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_8, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_kp_s_1), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_5) {
-    __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_v_format = ((PyObject *)__pyx_t_8);
-    __pyx_t_8 = 0;
+    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_v_format = ((PyObject *)__pyx_t_10);
+    __pyx_t_10 = 0;
     goto __pyx_L43;
   }
   /*else*/ {
 
-    /* "cvcf.pyx":720
+    /* "pysam/cvcf.pyx":720
  *         # Gracefully deal with absent FORMAT column
  *         if cols[8] == "": format = []
  *         else: format = cols[8].split(':')             # <<<<<<<<<<<<<<
  * 
  *         # check: all filters are defined
  */
-    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_v_format = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_v_format = __pyx_t_10;
+    __pyx_t_10 = 0;
   }
   __pyx_L43:;
 
-  /* "cvcf.pyx":723
+  /* "pysam/cvcf.pyx":723
  * 
  *         # check: all filters are defined
  *         for f in filter:             # <<<<<<<<<<<<<<
@@ -15861,87 +16073,95 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  * 
  */
   if (PyList_CheckExact(__pyx_v_filter) || PyTuple_CheckExact(__pyx_v_filter)) {
-    __pyx_t_8 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+    __pyx_t_10 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+    __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
-    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_10)) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
+    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_10)) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
-      __pyx_t_10 = __pyx_t_15(__pyx_t_8);
-      if (unlikely(!__pyx_t_10)) {
+      __pyx_t_9 = __pyx_t_15(__pyx_t_10);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(__pyx_t_9);
     }
     __Pyx_XDECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_v_f = __pyx_t_9;
+    __pyx_t_9 = 0;
 
-    /* "cvcf.pyx":724
+    /* "pysam/cvcf.pyx":724
  *         # 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_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_f, __pyx_t_9, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     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 = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __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 = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_v_f);
-      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_f);
+      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       goto __pyx_L46;
     }
     __pyx_L46:;
   }
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-  /* "cvcf.pyx":727
+  /* "pysam/cvcf.pyx":727
  * 
  *         # check: format fields are defined
  *         if self._format:             # <<<<<<<<<<<<<<
  *             for f in format:
  *                 if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f)
  */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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 = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_5) {
 
-    /* "cvcf.pyx":728
+    /* "pysam/cvcf.pyx":728
  *         # check: format fields are defined
  *         if self._format:
  *             for f in format:             # <<<<<<<<<<<<<<
@@ -15949,22 +16169,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  * 
  */
     if (PyList_CheckExact(__pyx_v_format) || PyTuple_CheckExact(__pyx_v_format)) {
-      __pyx_t_8 = __pyx_v_format; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+      __pyx_t_10 = __pyx_v_format; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_10)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_10)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_1 = __pyx_t_15(__pyx_t_8);
+        __pyx_t_1 = __pyx_t_15(__pyx_t_10);
         if (unlikely(!__pyx_t_1)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -15978,7 +16206,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_v_f = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "cvcf.pyx":729
+      /* "pysam/cvcf.pyx":729
  *         if self._format:
  *             for f in format:
  *                 if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f)             # <<<<<<<<<<<<<<
@@ -15987,55 +16215,54 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
       __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_1, __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_f, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_5) {
         __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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 = 729; __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 = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
+        __Pyx_GIVEREF(__pyx_t_8);
         __Pyx_INCREF(__pyx_v_f);
-        PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_f);
+        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_f);
         __Pyx_GIVEREF(__pyx_v_f);
-        __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); 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_8 = 0;
+        __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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_10)); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L50;
       }
       __pyx_L50:;
     }
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     goto __pyx_L47;
   }
   __pyx_L47:;
 
-  /* "cvcf.pyx":732
+  /* "pysam/cvcf.pyx":732
  * 
  *         # convert v3.3 alleles
  *         if self._version == 33:             # <<<<<<<<<<<<<<
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
  *             newalts = []
  */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_10, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_5) {
 
-    /* "cvcf.pyx":733
+    /* "pysam/cvcf.pyx":733
  *         # convert v3.3 alleles
  *         if self._version == 33:
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)             # <<<<<<<<<<<<<<
@@ -16045,40 +16272,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_5 = (__pyx_t_4 != 1);
     if (__pyx_t_5) {
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __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 = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8);
-      __Pyx_GIVEREF(__pyx_t_8);
-      __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      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_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L52;
     }
     __pyx_L52:;
 
-    /* "cvcf.pyx":734
+    /* "pysam/cvcf.pyx":734
  *         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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_v_newalts = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_v_newalts = __pyx_t_10;
+    __pyx_t_10 = 0;
 
-    /* "cvcf.pyx":735
+    /* "pysam/cvcf.pyx":735
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
  *             newalts = []
  *             have_deletions = False             # <<<<<<<<<<<<<<
@@ -16087,7 +16314,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_have_deletions = 0;
 
-    /* "cvcf.pyx":736
+    /* "pysam/cvcf.pyx":736
  *             newalts = []
  *             have_deletions = False
  *             for a in alt:             # <<<<<<<<<<<<<<
@@ -16095,36 +16322,44 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  */
     if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-      __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+      __pyx_t_10 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); 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_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_10)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_10)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_10 = __pyx_t_15(__pyx_t_8);
-        if (unlikely(!__pyx_t_10)) {
+        __pyx_t_9 = __pyx_t_15(__pyx_t_10);
+        if (unlikely(!__pyx_t_9)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(__pyx_t_9);
       }
       __Pyx_XDECREF(__pyx_v_a);
-      __pyx_v_a = __pyx_t_10;
-      __pyx_t_10 = 0;
+      __pyx_v_a = __pyx_t_9;
+      __pyx_t_9 = 0;
 
-      /* "cvcf.pyx":737
+      /* "pysam/cvcf.pyx":737
  *             have_deletions = False
  *             for a in alt:
  *                 if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference             # <<<<<<<<<<<<<<
@@ -16134,69 +16369,69 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_3 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_5 = (__pyx_t_3 == 1);
       if (__pyx_t_5) {
-        __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 = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_9 = PyNumber_Add(__pyx_v_a, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); 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_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_8 = PyNumber_Add(__pyx_v_a, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_a = __pyx_t_8;
+        __pyx_t_8 = 0;
         goto __pyx_L55;
       }
 
-      /* "cvcf.pyx":738
+      /* "pysam/cvcf.pyx":738
  *             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_9 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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_9); __pyx_t_9 = 0;
-        __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_a = __pyx_t_9;
+        __pyx_t_9 = 0;
         goto __pyx_L55;
       }
 
-      /* "cvcf.pyx":739
+      /* "pysam/cvcf.pyx":739
  *                 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_10 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       if (__pyx_t_5) {
 
-        /* "cvcf.pyx":740
+        /* "pysam/cvcf.pyx":740
  *                 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             # <<<<<<<<<<<<<<
@@ -16205,7 +16440,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
         __pyx_v_have_deletions = 1;
 
-        /* "cvcf.pyx":741
+        /* "pysam/cvcf.pyx":741
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True
  *                     try:             # <<<<<<<<<<<<<<
@@ -16219,28 +16454,28 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
           __Pyx_XGOTREF(__pyx_t_13);
           /*try:*/ {
 
-            /* "cvcf.pyx":742
+            /* "pysam/cvcf.pyx":742
  *                     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_9 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__pyx_t_9);
-            __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__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(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_8);
+            __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
             __Pyx_GOTREF(__pyx_t_9);
-            __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+            __Pyx_GIVEREF(__pyx_t_8);
+            __pyx_t_8 = 0;
+            __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_8);
+            __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
             __Pyx_XDECREF(__pyx_v_l);
-            __pyx_v_l = __pyx_t_9;
-            __pyx_t_9 = 0;
+            __pyx_v_l = __pyx_t_8;
+            __pyx_t_8 = 0;
 
-            /* "cvcf.pyx":743
+            /* "pysam/cvcf.pyx":743
  *                     try:
  *                         l = int(a[1:])          # throws ValueError if sequence
  *                         if len(ref) < l:        # add to reference if necessary             # <<<<<<<<<<<<<<
@@ -16248,32 +16483,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                             ref += addns
  */
             __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__pyx_t_9);
-            __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__pyx_t_10);
+            __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_8);
+            __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_v_l, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             if (__pyx_t_5) {
 
-              /* "cvcf.pyx":744
+              /* "pysam/cvcf.pyx":744
  *                         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_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __Pyx_GOTREF(__pyx_t_8);
+              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+              __pyx_t_8 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __Pyx_GOTREF(__pyx_t_8);
               __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_7);
               __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
@@ -16283,22 +16517,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __Pyx_GIVEREF(__pyx_v_chrom);
               PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
-              __Pyx_GIVEREF(__pyx_t_9);
+              PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8);
+              __Pyx_GIVEREF(__pyx_t_8);
               PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7);
               __Pyx_GIVEREF(__pyx_t_7);
               __pyx_t_1 = 0;
-              __pyx_t_9 = 0;
+              __pyx_t_8 = 0;
               __pyx_t_7 = 0;
-              __pyx_t_7 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_7);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
               __Pyx_XDECREF(__pyx_v_addns);
               __pyx_v_addns = __pyx_t_7;
               __pyx_t_7 = 0;
 
-              /* "cvcf.pyx":745
+              /* "pysam/cvcf.pyx":745
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns             # <<<<<<<<<<<<<<
@@ -16311,7 +16545,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __pyx_v_ref = __pyx_t_7;
               __pyx_t_7 = 0;
 
-              /* "cvcf.pyx":746
+              /* "pysam/cvcf.pyx":746
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns             # <<<<<<<<<<<<<<
@@ -16323,22 +16557,26 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __pyx_t_2 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
               for (;;) {
                 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++;
+                #if CYTHON_COMPILING_IN_CPYTHON
+                __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                #else
+                __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                #endif
                 __Pyx_XDECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_10;
-                __pyx_t_10 = 0;
+                __pyx_v_na = __pyx_t_9;
+                __pyx_t_9 = 0;
                 __Pyx_INCREF(__pyx_t_7);
                 __Pyx_XDECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_7;
-                __pyx_t_10 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                __Pyx_GOTREF(__pyx_t_10);
+                __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                __Pyx_GOTREF(__pyx_t_9);
                 __Pyx_DECREF(__pyx_t_7);
-                __pyx_t_7 = __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 = 746; __pyx_clineno = __LINE__; goto __pyx_L56_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 = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+                __pyx_t_7 = __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 = 746; __pyx_clineno = __LINE__; goto __pyx_L56_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 = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
               }
               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
               __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -16346,7 +16584,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
             }
             __pyx_L64:;
 
-            /* "cvcf.pyx":747
+            /* "pysam/cvcf.pyx":747
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l             # <<<<<<<<<<<<<<
@@ -16367,12 +16605,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
           __pyx_L56_error:;
           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
           __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_2); __pyx_t_2 = 0;
           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-          /* "cvcf.pyx":748
+          /* "pysam/cvcf.pyx":748
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
  *                     except ValueError:             # <<<<<<<<<<<<<<
@@ -16381,26 +16619,26 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_t_20 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
           if (__pyx_t_20) {
-            __Pyx_AddTraceback("cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
-            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+            __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
             __Pyx_GOTREF(__pyx_t_7);
             __Pyx_GOTREF(__pyx_t_2);
-            __Pyx_GOTREF(__pyx_t_10);
+            __Pyx_GOTREF(__pyx_t_9);
 
-            /* "cvcf.pyx":749
+            /* "pysam/cvcf.pyx":749
  *                         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_9 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-            __Pyx_GOTREF(__pyx_t_9);
+            __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+            __Pyx_GOTREF(__pyx_t_8);
             __Pyx_XDECREF(__pyx_v_s);
-            __pyx_v_s = __pyx_t_9;
-            __pyx_t_9 = 0;
+            __pyx_v_s = __pyx_t_8;
+            __pyx_t_8 = 0;
 
-            /* "cvcf.pyx":750
+            /* "pysam/cvcf.pyx":750
  *                     except ValueError:
  *                         s = a[1:]
  *                         if len(ref) < len(s):   # add Ns to reference if necessary             # <<<<<<<<<<<<<<
@@ -16412,15 +16650,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
             __pyx_t_5 = (__pyx_t_3 < __pyx_t_21);
             if (__pyx_t_5) {
 
-              /* "cvcf.pyx":751
+              /* "pysam/cvcf.pyx":751
  *                         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_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __Pyx_GOTREF(__pyx_t_8);
               __pyx_t_21 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
               __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
               __Pyx_GOTREF(__pyx_t_1);
@@ -16449,15 +16687,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __pyx_t_6 = 0;
               __pyx_t_22 = 0;
               __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0;
               __Pyx_XDECREF(__pyx_v_addns);
               __pyx_v_addns = __pyx_t_1;
               __pyx_t_1 = 0;
 
-              /* "cvcf.pyx":752
+              /* "pysam/cvcf.pyx":752
  *                         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):             # <<<<<<<<<<<<<<
@@ -16471,41 +16709,43 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __Pyx_INCREF(__pyx_v_addns);
               PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_v_addns);
               __Pyx_GIVEREF(__pyx_v_addns);
-              __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __Pyx_GOTREF(__pyx_t_8);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0;
-              __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+              __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
               __pyx_t_14 = (!__pyx_t_5);
               if (__pyx_t_14) {
                 __pyx_t_21 = PyObject_Length(__pyx_v_addns); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_9);
-                __pyx_t_23 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_9); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_8);
+                __pyx_t_23 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_8); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_GOTREF(((PyObject *)__pyx_t_23));
-                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-                __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_addns, ((PyObject *)__pyx_t_23), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+                __pyx_t_8 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_23), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0;
+                __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                 __pyx_t_19 = __pyx_t_5;
               } else {
                 __pyx_t_19 = __pyx_t_14;
               }
               if (__pyx_t_19) {
 
-                /* "cvcf.pyx":753
+                /* "pysam/cvcf.pyx":753
  *                             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_23 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_8);
+                __pyx_t_23 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_114); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_GOTREF(__pyx_t_23);
-                __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_114); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_9);
 
-                /* "cvcf.pyx":754
+                /* "pysam/cvcf.pyx":754
  *                             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)))             # <<<<<<<<<<<<<<
@@ -16556,22 +16796,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
                 __Pyx_INCREF(__pyx_v_line);
                 PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_v_line);
                 __Pyx_GIVEREF(__pyx_v_line);
-                PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_9);
-                __Pyx_GIVEREF(__pyx_t_9);
+                PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
+                __Pyx_GIVEREF(__pyx_t_23);
                 PyTuple_SET_ITEM(__pyx_t_24, 2, ((PyObject *)__pyx_t_22));
                 __Pyx_GIVEREF(((PyObject *)__pyx_t_22));
-                __pyx_t_9 = 0;
+                __pyx_t_23 = 0;
                 __pyx_t_22 = 0;
-                __pyx_t_22 = PyObject_Call(__pyx_t_23, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __pyx_t_22 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_GOTREF(__pyx_t_22);
-                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                 __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0;
                 __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
                 goto __pyx_L70;
               }
               __pyx_L70:;
 
-              /* "cvcf.pyx":755
+              /* "pysam/cvcf.pyx":755
  *                                 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             # <<<<<<<<<<<<<<
@@ -16584,7 +16824,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __pyx_v_ref = __pyx_t_22;
               __pyx_t_22 = 0;
 
-              /* "cvcf.pyx":756
+              /* "pysam/cvcf.pyx":756
  *                                            "(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             # <<<<<<<<<<<<<<
@@ -16596,22 +16836,26 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
               __pyx_t_24 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_24); __pyx_t_21 = 0;
               for (;;) {
                 if (__pyx_t_21 >= PyList_GET_SIZE(__pyx_t_24)) break;
-                __pyx_t_23 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_21); __Pyx_INCREF(__pyx_t_23); __pyx_t_21++;
+                #if CYTHON_COMPILING_IN_CPYTHON
+                __pyx_t_8 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_21); __Pyx_INCREF(__pyx_t_8); __pyx_t_21++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                #else
+                __pyx_t_8 = PySequence_ITEM(__pyx_t_24, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                #endif
                 __Pyx_XDECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_23;
-                __pyx_t_23 = 0;
+                __pyx_v_na = __pyx_t_8;
+                __pyx_t_8 = 0;
                 __Pyx_INCREF(__pyx_t_22);
                 __Pyx_XDECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_22;
-                __pyx_t_23 = PyNumber_Add(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_23);
+                __pyx_t_8 = PyNumber_Add(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_8);
                 __Pyx_DECREF(__pyx_t_22);
-                __pyx_t_22 = __pyx_t_23;
-                __pyx_t_23 = 0;
-                __pyx_t_23 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_23);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_23) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+                __pyx_t_22 = __pyx_t_8;
+                __pyx_t_8 = 0;
+                __pyx_t_8 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_8);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
               }
               __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
               __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
@@ -16619,7 +16863,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
             }
             __pyx_L69:;
 
-            /* "cvcf.pyx":757
+            /* "pysam/cvcf.pyx":757
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  *                         a = ref[len(s):]        # new deletion, deleting from pos             # <<<<<<<<<<<<<<
@@ -16634,7 +16878,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
             __pyx_t_22 = 0;
             __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
             goto __pyx_L57_exception_handled;
           }
           __pyx_L58_except_error:;
@@ -16654,15 +16898,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       }
       /*else*/ {
 
-        /* "cvcf.pyx":759
+        /* "pysam/cvcf.pyx":759
  *                         a = ref[len(s):]        # new deletion, deleting from pos
  *                 else:
  *                     self.error(line,self.V33_BAD_ALLELE)             # <<<<<<<<<<<<<<
  *                 newalts.append(a)
  *             alt = newalts
  */
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); 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_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); 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_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 = 759; __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 = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -16673,15 +16917,15 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         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_10, ((PyObject *)__pyx_t_7), 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_9, ((PyObject *)__pyx_t_7), 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_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
       __pyx_L55:;
 
-      /* "cvcf.pyx":760
+      /* "pysam/cvcf.pyx":760
  *                 else:
  *                     self.error(line,self.V33_BAD_ALLELE)
  *                 newalts.append(a)             # <<<<<<<<<<<<<<
@@ -16690,9 +16934,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
       __pyx_t_25 = PyList_Append(__pyx_v_newalts, __pyx_v_a); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __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;
 
-    /* "cvcf.pyx":761
+    /* "pysam/cvcf.pyx":761
  *                     self.error(line,self.V33_BAD_ALLELE)
  *                 newalts.append(a)
  *             alt = newalts             # <<<<<<<<<<<<<<
@@ -16705,7 +16949,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_GIVEREF(((PyObject *)__pyx_v_newalts));
     __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_v_newalts);
 
-    /* "cvcf.pyx":763
+    /* "pysam/cvcf.pyx":763
  *             alt = newalts
  *             # deletion alleles exist, add dummy 1st reference allele, and account for leading base
  *             if have_deletions:             # <<<<<<<<<<<<<<
@@ -16714,28 +16958,27 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
     if (__pyx_v_have_deletions) {
 
-      /* "cvcf.pyx":764
+      /* "pysam/cvcf.pyx":764
  *             # 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_8 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_10 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_19) {
 
-        /* "cvcf.pyx":766
+        /* "pysam/cvcf.pyx":766
  *                 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_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __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 = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
@@ -16745,14 +16988,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __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 = 766; __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 = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __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 = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __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 = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __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 = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
         __Pyx_INCREF(__pyx_v_chrom);
@@ -16762,40 +17005,40 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         __Pyx_GIVEREF(__pyx_t_7);
         PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_2);
         __Pyx_GIVEREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_t_10);
-        __Pyx_GIVEREF(__pyx_t_10);
+        PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
         __pyx_t_7 = 0;
         __pyx_t_2 = 0;
-        __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __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_22)); __pyx_t_22 = 0;
-        __pyx_v_addn = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_addn = __pyx_t_9;
+        __pyx_t_9 = 0;
 
-        /* "cvcf.pyx":767
+        /* "pysam/cvcf.pyx":767
  *                     # 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_10 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_ref = __pyx_t_9;
+        __pyx_t_9 = 0;
 
-        /* "cvcf.pyx":768
+        /* "pysam/cvcf.pyx":768
  *                     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_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
           __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
           __pyx_t_15 = NULL;
@@ -16807,96 +17050,106 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         for (;;) {
           if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
             if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
-            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_10 = PySequence_ITEM(__pyx_t_22, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
           } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
             if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_10 = PySequence_ITEM(__pyx_t_22, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
           } else {
-            __pyx_t_8 = __pyx_t_15(__pyx_t_22);
-            if (unlikely(!__pyx_t_8)) {
+            __pyx_t_10 = __pyx_t_15(__pyx_t_22);
+            if (unlikely(!__pyx_t_10)) {
               if (PyErr_Occurred()) {
                 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               }
               break;
             }
-            __Pyx_GOTREF(__pyx_t_8);
+            __Pyx_GOTREF(__pyx_t_10);
           }
           __Pyx_XDECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_8;
-          __pyx_t_8 = 0;
-          __pyx_t_8 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          if (unlikely(PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_v_allele = __pyx_t_10;
+          __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          if (unlikely(__Pyx_PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         }
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_10));
+        __pyx_t_22 = ((PyObject *)__pyx_t_9);
+        __Pyx_INCREF(__pyx_t_22);
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
         __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
-        __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_10);
-        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __Pyx_GIVEREF(__pyx_t_22);
+        __pyx_cur_scope->__pyx_v_alt = __pyx_t_22;
+        __pyx_t_22 = 0;
         goto __pyx_L74;
       }
       /*else*/ {
 
-        /* "cvcf.pyx":770
+        /* "pysam/cvcf.pyx":770
  *                     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_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_9 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_chrom);
         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_22);
-        __Pyx_GIVEREF(__pyx_t_22);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
         __Pyx_INCREF(__pyx_v_pos);
         PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_pos);
         __Pyx_GIVEREF(__pyx_v_pos);
-        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
-        __pyx_t_22 = 0;
-        __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
+        __pyx_t_9 = 0;
+        __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-        __pyx_v_addn = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_addn = __pyx_t_10;
+        __pyx_t_10 = 0;
 
-        /* "cvcf.pyx":771
+        /* "pysam/cvcf.pyx":771
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  *                     ref = addn + ref             # <<<<<<<<<<<<<<
  *                     alt = [addn + allele for allele in alt]
  *                     pos -= 1
  */
-        __pyx_t_8 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_10 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_ref = __pyx_t_10;
+        __pyx_t_10 = 0;
 
-        /* "cvcf.pyx":772
+        /* "pysam/cvcf.pyx":772
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]             # <<<<<<<<<<<<<<
  *                     pos -= 1
  *         else:
  */
-        __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_10 = PyList_New(0); 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);
         if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
           __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
           __pyx_t_15 = NULL;
@@ -16908,49 +17161,59 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         for (;;) {
           if (!__pyx_t_15 && 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++;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_22 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_22 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
           } else if (!__pyx_t_15 && 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++;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_22 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
           } else {
-            __pyx_t_10 = __pyx_t_15(__pyx_t_2);
-            if (unlikely(!__pyx_t_10)) {
+            __pyx_t_22 = __pyx_t_15(__pyx_t_2);
+            if (unlikely(!__pyx_t_22)) {
               if (PyErr_Occurred()) {
                 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               }
               break;
             }
-            __Pyx_GOTREF(__pyx_t_10);
+            __Pyx_GOTREF(__pyx_t_22);
           }
           __Pyx_XDECREF(__pyx_v_allele);
-          __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 = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_10);
-          if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) {__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_v_allele = __pyx_t_22;
+          __pyx_t_22 = 0;
+          __pyx_t_22 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
+          if (unlikely(__Pyx_PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_22))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         }
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_8));
+        __pyx_t_2 = ((PyObject *)__pyx_t_10);
+        __Pyx_INCREF(__pyx_t_2);
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
         __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-        __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_8);
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_cur_scope->__pyx_v_alt = __pyx_t_2;
+        __pyx_t_2 = 0;
 
-        /* "cvcf.pyx":773
+        /* "pysam/cvcf.pyx":773
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]
  *                     pos -= 1             # <<<<<<<<<<<<<<
  *         else:
  *             # format v4.0 -- just check for nucleotides
  */
-        __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_v_pos);
-        __pyx_v_pos = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_pos = __pyx_t_2;
+        __pyx_t_2 = 0;
       }
       __pyx_L74:;
       goto __pyx_L73;
@@ -16960,7 +17223,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":776
+    /* "pysam/cvcf.pyx":776
  *         else:
  *             # format v4.0 -- just check for nucleotides
  *             for allele in alt:             # <<<<<<<<<<<<<<
@@ -16968,97 +17231,105 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                     self.error(line,self.V40_BAD_ALLELE,allele)
  */
     if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-      __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+      __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_2 = __pyx_t_15(__pyx_t_8);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_10 = __pyx_t_15(__pyx_t_2);
+        if (unlikely(!__pyx_t_10)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_10);
       }
       __Pyx_XDECREF(__pyx_v_allele);
-      __pyx_v_allele = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_allele = __pyx_t_10;
+      __pyx_t_10 = 0;
 
-      /* "cvcf.pyx":777
+      /* "pysam/cvcf.pyx":777
  *             # 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_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__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_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__match); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__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_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_14 = (!__pyx_t_19);
       if (__pyx_t_14) {
 
-        /* "cvcf.pyx":778
+        /* "pysam/cvcf.pyx":778
  *             for allele in alt:
  *                 if not alleleRegEx.match(allele):
  *                     self.error(line,self.V40_BAD_ALLELE,allele)             # <<<<<<<<<<<<<<
  * 
  *         # check for leading nucleotide in indel calls
  */
-        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __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 = 778; __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 = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __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 = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_v_allele);
-        PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_allele);
+        PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_v_allele);
         __Pyx_GIVEREF(__pyx_v_allele);
-        __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __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_22)); __pyx_t_22 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         goto __pyx_L81;
       }
       __pyx_L81:;
     }
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
   __pyx_L51:;
 
-  /* "cvcf.pyx":781
+  /* "pysam/cvcf.pyx":781
  * 
  *         # check for leading nucleotide in indel calls
  *         for allele in alt:             # <<<<<<<<<<<<<<
@@ -17066,36 +17337,44 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
  */
   if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-    __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+    __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); 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_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
-    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
+    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
-      __pyx_t_2 = __pyx_t_15(__pyx_t_8);
-      if (unlikely(!__pyx_t_2)) {
+      __pyx_t_10 = __pyx_t_15(__pyx_t_2);
+      if (unlikely(!__pyx_t_10)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_10);
     }
     __Pyx_XDECREF(__pyx_v_allele);
-    __pyx_v_allele = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_allele = __pyx_t_10;
+    __pyx_t_10 = 0;
 
-    /* "cvcf.pyx":782
+    /* "pysam/cvcf.pyx":782
  *         # check for leading nucleotide in indel calls
  *         for allele in alt:
  *             if len(allele) != len(ref):             # <<<<<<<<<<<<<<
@@ -17107,7 +17386,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_t_14 = (__pyx_t_21 != __pyx_t_3);
     if (__pyx_t_14) {
 
-      /* "cvcf.pyx":783
+      /* "pysam/cvcf.pyx":783
  *         for allele in alt:
  *             if len(allele) != len(ref):
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)             # <<<<<<<<<<<<<<
@@ -17117,103 +17396,102 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_3 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_14 = (__pyx_t_3 == 0);
       if (__pyx_t_14) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __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 = 783; __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 = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_10);
-        __Pyx_GIVEREF(__pyx_t_10);
-        __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __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_22)); __pyx_t_22 = 0;
+        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_22);
+        __Pyx_GIVEREF(__pyx_t_22);
+        __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         goto __pyx_L85;
       }
       __pyx_L85:;
 
-      /* "cvcf.pyx":784
+      /* "pysam/cvcf.pyx":784
  *             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_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_9 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_22 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_22, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __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_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __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_22, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __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_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_14) {
-        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_t_22); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __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 = 784; __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_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_22 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_19 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__N), __pyx_t_22, Py_NE)); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __pyx_t_5 = __pyx_t_19;
       } else {
         __pyx_t_5 = __pyx_t_14;
       }
       if (__pyx_t_5) {
 
-        /* "cvcf.pyx":785
+        /* "pysam/cvcf.pyx":785
  *                 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_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_116); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_116); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __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 = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_22);
-        __Pyx_GIVEREF(__pyx_t_22);
-        __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
+        __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         goto __pyx_L86;
       }
       __pyx_L86:;
@@ -17221,9 +17499,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     }
     __pyx_L84:;
   }
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":788
+  /* "pysam/cvcf.pyx":788
  * 
  *         # trim trailing bases in alleles
  *         if alt:             # <<<<<<<<<<<<<<
@@ -17233,148 +17511,154 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_alt); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "cvcf.pyx":789
+    /* "pysam/cvcf.pyx":789
  *         # trim trailing bases in alleles
  *         if alt:
  *             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_8 = __Pyx_GetName(__pyx_b, __pyx_n_s__len); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_22);
-    PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_8);
-    __Pyx_GIVEREF(__pyx_t_8);
+    __pyx_t_2 = __Pyx_GetName(__pyx_b, __pyx_n_s__len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __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 = 789; __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_INCREF(__pyx_cur_scope->__pyx_v_alt);
-    PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_cur_scope->__pyx_v_alt);
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_alt);
     __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alt);
-    __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
-    __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_22);
-    PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_8);
-    __Pyx_GIVEREF(__pyx_t_8);
-    __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
-    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = 0;
+    __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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __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 = 789; __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_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_4); 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_2); __pyx_t_2 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_22 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
     if (__pyx_t_5) {
-      __Pyx_INCREF(__pyx_t_8);
-      __pyx_t_22 = __pyx_t_8;
+      __Pyx_INCREF(__pyx_t_2);
+      __pyx_t_9 = __pyx_t_2;
     } else {
-      __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_4); 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_t_22 = __pyx_t_10;
-      __pyx_t_10 = 0;
+      __pyx_t_22 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __pyx_t_9 = __pyx_t_22;
+      __pyx_t_22 = 0;
     }
-    __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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_int_1);
-    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_1);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
     __Pyx_GIVEREF(__pyx_int_1);
-    __Pyx_INCREF(__pyx_t_22);
-    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_22);
-    __Pyx_GIVEREF(__pyx_t_22);
-    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-    __pyx_t_22 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_22);
-    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    if (PyList_CheckExact(__pyx_t_22) || PyTuple_CheckExact(__pyx_t_22)) {
-      __pyx_t_8 = __pyx_t_22; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+    __Pyx_INCREF(__pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
+    __Pyx_GIVEREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
+      __pyx_t_2 = __pyx_t_9; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_22 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-        __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
-        __pyx_t_22 = __pyx_t_15(__pyx_t_8);
-        if (unlikely(!__pyx_t_22)) {
+        __pyx_t_9 = __pyx_t_15(__pyx_t_2);
+        if (unlikely(!__pyx_t_9)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_GOTREF(__pyx_t_9);
       }
       __Pyx_XDECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_22;
-      __pyx_t_22 = 0;
+      __pyx_v_i = __pyx_t_9;
+      __pyx_t_9 = 0;
 
-      /* "cvcf.pyx":790
+      /* "pysam/cvcf.pyx":790
  *         if alt:
  *             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_22 = __pyx_pf_4cvcf_3VCF_10parse_data_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_22);
-      __Pyx_GIVEREF(__pyx_t_22);
-      __pyx_t_22 = 0;
-      __pyx_t_22 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_pf_5pysam_4cvcf_3VCF_10parse_data_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-      __pyx_t_3 = PySet_Size(__pyx_t_22); 
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_9);
+      __Pyx_GIVEREF(__pyx_t_9);
+      __pyx_t_9 = 0;
+      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
+      __pyx_t_3 = PySet_Size(__pyx_t_9); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_5 = (__pyx_t_3 > 1);
       if (!__pyx_t_5) {
-        __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_22 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_22, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __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 = 790; __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_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __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 = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_RichCompare(__pyx_t_22, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         __pyx_t_19 = __pyx_t_14;
       } else {
         __pyx_t_19 = __pyx_t_5;
       }
       if (__pyx_t_19) {
 
-        /* "cvcf.pyx":791
+        /* "pysam/cvcf.pyx":791
  *             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             # <<<<<<<<<<<<<<
@@ -17386,34 +17670,42 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       }
       __pyx_L90:;
 
-      /* "cvcf.pyx":792
+      /* "pysam/cvcf.pyx":792
  *                 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_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_3 = 0;
+        __pyx_t_9 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0;
         __pyx_t_26 = NULL;
       } else {
-        __pyx_t_3 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_26 = Py_TYPE(__pyx_t_22)->tp_iternext;
+        __pyx_t_3 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_26 = Py_TYPE(__pyx_t_9)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_26 && PyList_CheckExact(__pyx_t_22)) {
-          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_22)) break;
-          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
-        } else if (!__pyx_t_26 && PyTuple_CheckExact(__pyx_t_22)) {
-          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
+        if (!__pyx_t_26 && PyList_CheckExact(__pyx_t_9)) {
+          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
+        } else if (!__pyx_t_26 && PyTuple_CheckExact(__pyx_t_9)) {
+          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
         } else {
-          __pyx_t_7 = __pyx_t_26(__pyx_t_22);
+          __pyx_t_7 = __pyx_t_26(__pyx_t_9);
           if (unlikely(!__pyx_t_7)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -17428,51 +17720,51 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         __pyx_t_7 = 0;
         __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); 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 (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(__Pyx_PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_7))) {__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_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_22 = ((PyObject *)__pyx_t_2);
-      __Pyx_INCREF(__pyx_t_22);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = ((PyObject *)__pyx_t_10);
+      __Pyx_INCREF(__pyx_t_9);
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_10;
-      __pyx_t_10 = 0;
+      __pyx_v_ref = __pyx_t_22;
+      __pyx_t_22 = 0;
       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
       __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-      __Pyx_GIVEREF(__pyx_t_22);
-      __pyx_cur_scope->__pyx_v_alt = __pyx_t_22;
-      __pyx_t_22 = 0;
+      __Pyx_GIVEREF(__pyx_t_9);
+      __pyx_cur_scope->__pyx_v_alt = __pyx_t_9;
+      __pyx_t_9 = 0;
     }
     __pyx_L89_break:;
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     goto __pyx_L87;
   }
   __pyx_L87:;
 
-  /* "cvcf.pyx":795
+  /* "pysam/cvcf.pyx":795
  * 
  *         # left-align alleles, if a reference is available
  *         if self._leftalign and self._reference:             # <<<<<<<<<<<<<<
  *             while left < pos:
  *                 movable = True
  */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); 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_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 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;
   if (__pyx_t_19) {
-    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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 = 795; __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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_14 = __pyx_t_5;
   } else {
     __pyx_t_14 = __pyx_t_19;
   }
   if (__pyx_t_14) {
 
-    /* "cvcf.pyx":796
+    /* "pysam/cvcf.pyx":796
  *         # left-align alleles, if a reference is available
  *         if self._leftalign and self._reference:
  *             while left < pos:             # <<<<<<<<<<<<<<
@@ -17481,13 +17773,12 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
     while (1) {
       if (unlikely(!__pyx_v_left)) { __Pyx_RaiseUnboundLocalError("left"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_8 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (!__pyx_t_14) break;
 
-      /* "cvcf.pyx":797
+      /* "pysam/cvcf.pyx":797
  *         if self._leftalign and self._reference:
  *             while left < pos:
  *                 movable = True             # <<<<<<<<<<<<<<
@@ -17496,7 +17787,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
       __pyx_v_movable = 1;
 
-      /* "cvcf.pyx":798
+      /* "pysam/cvcf.pyx":798
  *             while left < pos:
  *                 movable = True
  *                 for allele in alt:             # <<<<<<<<<<<<<<
@@ -17504,36 +17795,44 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                         longest, shortest = allele, ref
  */
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
+        __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
         __pyx_t_15 = NULL;
       } else {
-        __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
+        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); 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_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
-          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
-          __pyx_t_22 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
-          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-          __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
+        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
+        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
         } else {
-          __pyx_t_22 = __pyx_t_15(__pyx_t_8);
-          if (unlikely(!__pyx_t_22)) {
+          __pyx_t_9 = __pyx_t_15(__pyx_t_2);
+          if (unlikely(!__pyx_t_9)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_22);
+          __Pyx_GOTREF(__pyx_t_9);
         }
         __Pyx_XDECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_22;
-        __pyx_t_22 = 0;
+        __pyx_v_allele = __pyx_t_9;
+        __pyx_t_9 = 0;
 
-        /* "cvcf.pyx":799
+        /* "pysam/cvcf.pyx":799
  *                 movable = True
  *                 for allele in alt:
  *                     if len(allele) > len(ref):             # <<<<<<<<<<<<<<
@@ -17545,48 +17844,48 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         __pyx_t_14 = (__pyx_t_3 > __pyx_t_21);
         if (__pyx_t_14) {
 
-          /* "cvcf.pyx":800
+          /* "pysam/cvcf.pyx":800
  *                 for allele in alt:
  *                     if len(allele) > len(ref):
  *                         longest, shortest = allele, ref             # <<<<<<<<<<<<<<
  *                     else:
  *                         longest, shortest = ref, allele
  */
-          __pyx_t_22 = __pyx_v_allele;
+          __pyx_t_9 = __pyx_v_allele;
+          __Pyx_INCREF(__pyx_t_9);
+          __pyx_t_22 = __pyx_v_ref;
           __Pyx_INCREF(__pyx_t_22);
-          __pyx_t_10 = __pyx_v_ref;
-          __Pyx_INCREF(__pyx_t_10);
           __Pyx_XDECREF(__pyx_v_longest);
-          __pyx_v_longest = __pyx_t_22;
-          __pyx_t_22 = 0;
+          __pyx_v_longest = __pyx_t_9;
+          __pyx_t_9 = 0;
           __Pyx_XDECREF(__pyx_v_shortest);
-          __pyx_v_shortest = __pyx_t_10;
-          __pyx_t_10 = 0;
+          __pyx_v_shortest = __pyx_t_22;
+          __pyx_t_22 = 0;
           goto __pyx_L98;
         }
         /*else*/ {
 
-          /* "cvcf.pyx":802
+          /* "pysam/cvcf.pyx":802
  *                         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_10 = __pyx_v_ref;
-          __Pyx_INCREF(__pyx_t_10);
-          __pyx_t_22 = __pyx_v_allele;
+          __pyx_t_22 = __pyx_v_ref;
           __Pyx_INCREF(__pyx_t_22);
+          __pyx_t_9 = __pyx_v_allele;
+          __Pyx_INCREF(__pyx_t_9);
           __Pyx_XDECREF(__pyx_v_longest);
-          __pyx_v_longest = __pyx_t_10;
-          __pyx_t_10 = 0;
-          __Pyx_XDECREF(__pyx_v_shortest);
-          __pyx_v_shortest = __pyx_t_22;
+          __pyx_v_longest = __pyx_t_22;
           __pyx_t_22 = 0;
+          __Pyx_XDECREF(__pyx_v_shortest);
+          __pyx_v_shortest = __pyx_t_9;
+          __pyx_t_9 = 0;
         }
         __pyx_L98:;
 
-        /* "cvcf.pyx":803
+        /* "pysam/cvcf.pyx":803
  *                     else:
  *                         longest, shortest = ref, allele
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():             # <<<<<<<<<<<<<<
@@ -17598,32 +17897,31 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         __pyx_t_14 = (__pyx_t_21 == __pyx_t_3);
         if (!__pyx_t_14) {
           __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_22 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
+          __pyx_t_22 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_22);
-          __pyx_t_10 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__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_9); __pyx_t_9 = 0;
+          __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
           __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_22 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_22);
-          __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 = 803; __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 = 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 = PyObject_RichCompare(__pyx_t_22, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__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_22); __pyx_t_22 = 0;
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_22 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
           __pyx_t_5 = __pyx_t_19;
         } else {
           __pyx_t_5 = __pyx_t_14;
         }
         if (__pyx_t_5) {
 
-          /* "cvcf.pyx":804
+          /* "pysam/cvcf.pyx":804
  *                         longest, shortest = ref, allele
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False             # <<<<<<<<<<<<<<
@@ -17635,40 +17933,39 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         }
         __pyx_L99:;
 
-        /* "cvcf.pyx":805
+        /* "pysam/cvcf.pyx":805
  *                     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_10 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __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 = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
         __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 = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_21 = (__pyx_t_3 - 1);
-        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_21, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_22 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_21, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __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_5 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_RichCompare(__pyx_t_22, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         if (__pyx_t_5) {
 
-          /* "cvcf.pyx":806
+          /* "pysam/cvcf.pyx":806
  *                         movable = False
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  *                         movable = False             # <<<<<<<<<<<<<<
@@ -17680,9 +17977,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         }
         __pyx_L100:;
       }
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":807
+      /* "pysam/cvcf.pyx":807
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
  *                         movable = False
  *                 if not movable:             # <<<<<<<<<<<<<<
@@ -17692,7 +17989,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_t_5 = (!__pyx_v_movable);
       if (__pyx_t_5) {
 
-        /* "cvcf.pyx":808
+        /* "pysam/cvcf.pyx":808
  *                         movable = False
  *                 if not movable:
  *                     break             # <<<<<<<<<<<<<<
@@ -17704,129 +18001,146 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       }
       __pyx_L101:;
 
-      /* "cvcf.pyx":809
+      /* "pysam/cvcf.pyx":809
  *                 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_8 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_8;
-      __pyx_t_8 = 0;
+      __pyx_v_ref = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":810
+      /* "pysam/cvcf.pyx":810
  *                     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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
+        __pyx_t_9 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_9); __pyx_t_4 = 0;
         __pyx_t_15 = NULL;
       } else {
-        __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
+        __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_15 = Py_TYPE(__pyx_t_9)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
-          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
-          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
-          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_9)) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_10 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
+        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_9)) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
         } else {
-          __pyx_t_2 = __pyx_t_15(__pyx_t_22);
-          if (unlikely(!__pyx_t_2)) {
+          __pyx_t_10 = __pyx_t_15(__pyx_t_9);
+          if (unlikely(!__pyx_t_10)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_GOTREF(__pyx_t_10);
         }
         __Pyx_XDECREF(__pyx_v_allele);
-        __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 = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_v_allele = __pyx_t_10;
+        __pyx_t_10 = 0;
+        __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __Pyx_INCREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_9 = ((PyObject *)__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_9);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
       __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-      __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_8);
-      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+      __Pyx_GIVEREF(__pyx_t_9);
+      __pyx_cur_scope->__pyx_v_alt = __pyx_t_9;
+      __pyx_t_9 = 0;
 
-      /* "cvcf.pyx":811
+      /* "pysam/cvcf.pyx":811
  *                 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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
+        __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
         __pyx_t_15 = NULL;
       } else {
-        __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
+        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
-          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
-          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
-          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
+        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+          #if CYTHON_COMPILING_IN_CPYTHON
+          __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #else
+          __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          #endif
         } else {
-          __pyx_t_2 = __pyx_t_15(__pyx_t_22);
-          if (unlikely(!__pyx_t_2)) {
+          __pyx_t_10 = __pyx_t_15(__pyx_t_2);
+          if (unlikely(!__pyx_t_10)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_GOTREF(__pyx_t_10);
         }
         __Pyx_XDECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_allele = __pyx_t_10;
+        __pyx_t_10 = 0;
         __pyx_t_21 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        if (unlikely(__Pyx_PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_INCREF(((PyObject *)__pyx_t_8));
-      PyTuple_SET_ITEM(__pyx_t_22, 0, ((PyObject *)__pyx_t_8));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
-      __pyx_t_22 = PyObject_RichCompare(__pyx_t_8, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_INCREF(((PyObject *)__pyx_t_9));
+      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_9));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (!__pyx_t_5) {
         __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_14 = (__pyx_t_4 == 0);
@@ -17836,7 +18150,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       }
       if (__pyx_t_19) {
 
-        /* "cvcf.pyx":812
+        /* "pysam/cvcf.pyx":812
  *                 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             # <<<<<<<<<<<<<<
@@ -17844,93 +18158,103 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                     pos -= 1
  */
         if (unlikely(!__pyx_v_faref_leftflank)) { __Pyx_RaiseUnboundLocalError("faref_leftflank"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-        __pyx_t_22 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_8 = PyNumber_Subtract(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_8); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_8 = PyNumber_Add(__pyx_t_22, __pyx_v_ref); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); 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);
+        __pyx_t_9 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_9); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_ref); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_ref = __pyx_t_9;
+        __pyx_t_9 = 0;
 
-        /* "cvcf.pyx":813
+        /* "pysam/cvcf.pyx":813
  *                 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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-          __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
+          __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
           __pyx_t_15 = NULL;
         } else {
-          __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
-          __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
+          __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
         }
         for (;;) {
-          if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
-            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
-            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
-          } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
-            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+          if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
+            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
+          } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
+            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
           } else {
-            __pyx_t_2 = __pyx_t_15(__pyx_t_22);
-            if (unlikely(!__pyx_t_2)) {
+            __pyx_t_10 = __pyx_t_15(__pyx_t_2);
+            if (unlikely(!__pyx_t_10)) {
               if (PyErr_Occurred()) {
                 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               }
               break;
             }
-            __Pyx_GOTREF(__pyx_t_2);
+            __Pyx_GOTREF(__pyx_t_10);
           }
           __Pyx_XDECREF(__pyx_v_allele);
-          __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 = 813; __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 = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_v_allele = __pyx_t_10;
+          __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __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 = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_22 = PyNumber_Subtract(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
           __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 = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_22); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __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_8, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+          __pyx_t_22 = PyNumber_Add(__pyx_t_10, __pyx_v_allele); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          if (unlikely(__Pyx_PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_22))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         }
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __Pyx_INCREF(((PyObject *)__pyx_t_8));
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = ((PyObject *)__pyx_t_9);
+        __Pyx_INCREF(__pyx_t_2);
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
         __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-        __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_8);
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_cur_scope->__pyx_v_alt = __pyx_t_2;
+        __pyx_t_2 = 0;
 
-        /* "cvcf.pyx":814
+        /* "pysam/cvcf.pyx":814
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
  *                     pos -= 1             # <<<<<<<<<<<<<<
  * 
  *         # parse sample columns
  */
-        __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_v_pos);
-        __pyx_v_pos = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_pos = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L104;
       }
       __pyx_L104:;
@@ -17940,88 +18264,96 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L93:;
 
-  /* "cvcf.pyx":817
+  /* "pysam/cvcf.pyx":817
  * 
  *         # parse sample columns
  *         samples = []             # <<<<<<<<<<<<<<
  *         for sample in cols[9:]:
  *             dict = {}
  */
-  __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_v_samples = __pyx_t_8;
-  __pyx_t_8 = 0;
+  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_v_samples = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":818
+  /* "pysam/cvcf.pyx":818
  *         # parse sample columns
  *         samples = []
  *         for sample in cols[9:]:             # <<<<<<<<<<<<<<
  *             dict = {}
  *             values = sample.split(':')
  */
-  __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __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_22 = __pyx_t_8; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
+  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
+    __pyx_t_9 = __pyx_t_2; __Pyx_INCREF(__pyx_t_9); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_22);
-    __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
+    __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_15 = Py_TYPE(__pyx_t_9)->tp_iternext;
   }
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   for (;;) {
-    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
-    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_9)) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
+    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_9)) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
-      __pyx_t_8 = __pyx_t_15(__pyx_t_22);
-      if (unlikely(!__pyx_t_8)) {
+      __pyx_t_2 = __pyx_t_15(__pyx_t_9);
+      if (unlikely(!__pyx_t_2)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(__pyx_t_2);
     }
     __Pyx_XDECREF(__pyx_v_sample);
-    __pyx_v_sample = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_v_sample = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":819
+    /* "pysam/cvcf.pyx":819
  *         samples = []
  *         for sample in cols[9:]:
  *             dict = {}             # <<<<<<<<<<<<<<
  *             values = sample.split(':')
  *             if len(values) > len(format):
  */
-    __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_XDECREF(((PyObject *)__pyx_v_dict));
-    __pyx_v_dict = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_v_dict = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":820
+    /* "pysam/cvcf.pyx":820
  *         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_t_8 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_22 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_22);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_XDECREF(__pyx_v_values);
-    __pyx_v_values = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_v_values = __pyx_t_22;
+    __pyx_t_22 = 0;
 
-    /* "cvcf.pyx":821
+    /* "pysam/cvcf.pyx":821
  *             dict = {}
  *             values = sample.split(':')
  *             if len(values) > len(format):             # <<<<<<<<<<<<<<
@@ -18033,33 +18365,33 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_t_19 = (__pyx_t_21 > __pyx_t_3);
     if (__pyx_t_19) {
 
-      /* "cvcf.pyx":822
+      /* "pysam/cvcf.pyx":822
  *             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_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_24);
-      PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_10);
+      __Pyx_GIVEREF(__pyx_t_10);
       __Pyx_INCREF(__pyx_v_sample);
       PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_v_sample);
       __Pyx_GIVEREF(__pyx_v_sample);
       PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      __pyx_t_2 = 0;
+      __pyx_t_10 = 0;
       __pyx_t_7 = 0;
       __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_24)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_7));
@@ -18069,22 +18401,22 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_8);
-      __Pyx_GIVEREF(__pyx_t_8);
+      PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       PyTuple_SET_ITEM(__pyx_t_24, 2, ((PyObject *)__pyx_t_7));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
-      __pyx_t_8 = 0;
+      __pyx_t_2 = 0;
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L111;
     }
     __pyx_L111:;
 
-    /* "cvcf.pyx":823
+    /* "pysam/cvcf.pyx":823
  *             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)):             # <<<<<<<<<<<<<<
@@ -18114,10 +18446,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
     for (;;) {
       if (!__pyx_t_26 && PyList_CheckExact(__pyx_t_24)) {
         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_24)) break;
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_7 = PySequence_ITEM(__pyx_t_24, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else if (!__pyx_t_26 && PyTuple_CheckExact(__pyx_t_24)) {
         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_24)) break;
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #else
+        __pyx_t_7 = PySequence_ITEM(__pyx_t_24, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        #endif
       } else {
         __pyx_t_7 = __pyx_t_26(__pyx_t_24);
         if (unlikely(!__pyx_t_7)) {
@@ -18133,7 +18473,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
       __pyx_v_idx = __pyx_t_7;
       __pyx_t_7 = 0;
 
-      /* "cvcf.pyx":824
+      /* "pysam/cvcf.pyx":824
  *                 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)             # <<<<<<<<<<<<<<
@@ -18142,30 +18482,30 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
       __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_expected); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
-      __Pyx_GIVEREF(__pyx_t_10);
-      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
-      __Pyx_GIVEREF(__pyx_t_8);
+      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_22);
+      __Pyx_GIVEREF(__pyx_t_22);
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alt);
-      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_cur_scope->__pyx_v_alt);
+      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_cur_scope->__pyx_v_alt);
       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alt);
-      __pyx_t_10 = 0;
-      __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_22 = 0;
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __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_2)); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_XDECREF(__pyx_v_expected);
-      __pyx_v_expected = __pyx_t_8;
-      __pyx_t_8 = 0;
+      __pyx_v_expected = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":825
+      /* "pysam/cvcf.pyx":825
  *             for idx in range(len(format)):
  *                 expected = self.get_expected(format[idx], self._format, alt)
  *                 if idx < len(values): value = values[idx]             # <<<<<<<<<<<<<<
@@ -18173,34 +18513,32 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  *                     if expected == -1: value = "."
  */
       __pyx_t_21 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_8, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_21); 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_8); __pyx_t_8 = 0;
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_19) {
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_values, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyObject_GetItem(__pyx_v_values, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_XDECREF(__pyx_v_value);
-        __pyx_v_value = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_value = __pyx_t_10;
+        __pyx_t_10 = 0;
         goto __pyx_L114;
       }
       /*else*/ {
 
-        /* "cvcf.pyx":827
+        /* "pysam/cvcf.pyx":827
  *                 if idx < len(values): value = values[idx]
  *                 else:
  *                     if expected == -1: value = "."             # <<<<<<<<<<<<<<
  *                     else: value = ",".join(["."]*expected)
  * 
  */
-        __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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         if (__pyx_t_19) {
           __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
           __Pyx_XDECREF(__pyx_v_value);
@@ -18209,288 +18547,285 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
         }
         /*else*/ {
 
-          /* "cvcf.pyx":828
+          /* "pysam/cvcf.pyx":828
  *                 else:
  *                     if expected == -1: value = "."
  *                     else: value = ",".join(["."]*expected)             # <<<<<<<<<<<<<<
  * 
  *                 dict[format[idx]] = self.parse_formatdata(format[idx],
  */
-          __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 = 828; __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
           __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
-          PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_9));
+          PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
           __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
-          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_expected); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_expected); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_temp);
-            __Pyx_DECREF(__pyx_t_8);
-            __pyx_t_8 = __pyx_temp;
+            __Pyx_DECREF(__pyx_t_2);
+            __pyx_t_2 = __pyx_temp;
           }
           __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
-          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-          __pyx_t_8 = 0;
-          __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+          __pyx_t_2 = 0;
+          __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_v_value);
-          __pyx_v_value = __pyx_t_8;
-          __pyx_t_8 = 0;
+          __pyx_v_value = __pyx_t_2;
+          __pyx_t_2 = 0;
         }
         __pyx_L115:;
       }
       __pyx_L114:;
 
-      /* "cvcf.pyx":830
+      /* "pysam/cvcf.pyx":830
  *                     else: value = ",".join(["."]*expected)
  * 
  *                 dict[format[idx]] = self.parse_formatdata(format[idx],             # <<<<<<<<<<<<<<
  *                                                           value,
  *                                                           self._format,
  */
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_7 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
 
-      /* "cvcf.pyx":832
+      /* "pysam/cvcf.pyx":832
  *                 dict[format[idx]] = self.parse_formatdata(format[idx],
  *                                                           value,
  *                                                           self._format,             # <<<<<<<<<<<<<<
  *                                                           line)
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  */
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); 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_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
 
-      /* "cvcf.pyx":833
+      /* "pysam/cvcf.pyx":833
  *                                                           value,
  *                                                           self._format,
  *                                                           line)             # <<<<<<<<<<<<<<
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  */
-      __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
+      __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __Pyx_INCREF(__pyx_v_value);
-      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_value);
+      PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_v_value);
       __Pyx_GIVEREF(__pyx_v_value);
-      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_10);
+      __Pyx_GIVEREF(__pyx_t_10);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
       __pyx_t_7 = 0;
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __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_22)); __pyx_t_22 = 0;
 
-      /* "cvcf.pyx":830
+      /* "pysam/cvcf.pyx":830
  *                     else: value = ",".join(["."]*expected)
  * 
  *                 dict[format[idx]] = self.parse_formatdata(format[idx],             # <<<<<<<<<<<<<<
  *                                                           value,
  *                                                           self._format,
  */
-      __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_22, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "cvcf.pyx":834
+      /* "pysam/cvcf.pyx":834
  *                                                           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_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_19) {
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_21 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_21 = PyObject_Length(__pyx_t_22); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_10 = PyObject_RichCompare(__pyx_t_22, __pyx_v_expected, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_t_14 = __pyx_t_5;
       } else {
         __pyx_t_14 = __pyx_t_19;
       }
       if (__pyx_t_14) {
 
-        /* "cvcf.pyx":835
+        /* "pysam/cvcf.pyx":835
  *                                                           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_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
 
-        /* "cvcf.pyx":836
+        /* "pysam/cvcf.pyx":836
  *                 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_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_2 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_7 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_23 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_7); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_23);
+        __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_7); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_expected);
         PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_expected);
         __Pyx_GIVEREF(__pyx_v_expected);
-        PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_23);
-        __Pyx_GIVEREF(__pyx_t_23);
+        PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_8);
+        __Pyx_GIVEREF(__pyx_t_8);
+        __pyx_t_2 = 0;
         __pyx_t_8 = 0;
-        __pyx_t_23 = 0;
-        __pyx_t_23 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_23));
+        __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_INCREF(__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_10);
-        __Pyx_GIVEREF(__pyx_t_10);
-        PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_t_23));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_23));
-        __pyx_t_10 = 0;
-        __pyx_t_23 = 0;
-        __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_23);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_22);
+        __Pyx_GIVEREF(__pyx_t_22);
+        PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_t_8));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+        __pyx_t_22 = 0;
+        __pyx_t_8 = 0;
+        __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-        /* "cvcf.pyx":837
+        /* "pysam/cvcf.pyx":837
  *                     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_23 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_23);
-        __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_23); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_8); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __pyx_t_21 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_23 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_23);
+        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_23); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         if (__pyx_t_14) {
-          __pyx_t_23 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_23);
-          __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_23); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
+          __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_8); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
-          __pyx_t_2 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_10);
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, -1, sizeof(long), PyInt_FromLong); if (!__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_10); __pyx_t_10 = 0;
           __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
+          __pyx_t_22 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          __pyx_t_21 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __pyx_t_10 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_22, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
-          __Pyx_GIVEREF(__pyx_t_2);
-          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+          __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
+          __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_22); if (!__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_22); __pyx_t_22 = 0;
+          __pyx_t_21 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_21); 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_t_22 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
+          __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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
+          __Pyx_GIVEREF(__pyx_t_10);
+          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_t_22); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_temp);
-            __Pyx_DECREF(__pyx_t_8);
-            __pyx_t_8 = __pyx_temp;
+            __Pyx_DECREF(__pyx_t_2);
+            __pyx_t_2 = __pyx_temp;
           }
-          __pyx_t_2 = 0;
-          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_10);
+          __pyx_t_10 = 0;
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+          __pyx_t_22 = PyNumber_InPlaceAdd(__pyx_t_7, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-          if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_23, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+          if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_8, __pyx_t_22) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
           goto __pyx_L117;
         }
         __pyx_L117:;
 
-        /* "cvcf.pyx":838
+        /* "pysam/cvcf.pyx":838
  *                                "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_23 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_23);
-        __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_23); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+        __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_22 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_8); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_23 = __Pyx_PySequence_GetSlice(__pyx_t_10, 0, __pyx_t_21); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_23);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_10, __pyx_t_23) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
+        __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_t_22, 0, __pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_22, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L116;
       }
       __pyx_L116:;
     }
     __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
 
-    /* "cvcf.pyx":839
+    /* "pysam/cvcf.pyx":839
  *                     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 )             # <<<<<<<<<<<<<<
@@ -18499,56 +18834,56 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_t_25 = PyList_Append(__pyx_v_samples, ((PyObject *)__pyx_v_dict)); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-  /* "cvcf.pyx":842
+  /* "pysam/cvcf.pyx":842
  * 
  *         # done
  *         d = {'chrom':chrom,             # <<<<<<<<<<<<<<
  *              'pos':pos,      # return 0-based position
  *              'id':id,
  */
-  __pyx_t_22 = PyDict_New(); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_22));
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":843
+  /* "pysam/cvcf.pyx":843
  *         # done
  *         d = {'chrom':chrom,
  *              'pos':pos,      # return 0-based position             # <<<<<<<<<<<<<<
  *              'id':id,
  *              'ref':ref,
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":844
+  /* "pysam/cvcf.pyx":844
  *         d = {'chrom':chrom,
  *              'pos':pos,      # return 0-based position
  *              'id':id,             # <<<<<<<<<<<<<<
  *              'ref':ref,
  *              'alt':alt,
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":845
+  /* "pysam/cvcf.pyx":845
  *              'pos':pos,      # return 0-based position
  *              'id':id,
  *              'ref':ref,             # <<<<<<<<<<<<<<
  *              'alt':alt,
  *              'qual':qual,
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":846
+  /* "pysam/cvcf.pyx":846
  *              'id':id,
  *              'ref':ref,
  *              'alt':alt,             # <<<<<<<<<<<<<<
  *              'qual':qual,
  *              'filter':filter,
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__alt), __pyx_cur_scope->__pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__alt), __pyx_cur_scope->__pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":847
+  /* "pysam/cvcf.pyx":847
  *              'ref':ref,
  *              'alt':alt,
  *              'qual':qual,             # <<<<<<<<<<<<<<
@@ -18557,135 +18892,150 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
  */
   __pyx_t_24 = PyFloat_FromDouble(__pyx_v_qual); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_24);
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__qual), __pyx_t_24) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__qual), __pyx_t_24) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
 
-  /* "cvcf.pyx":848
+  /* "pysam/cvcf.pyx":848
  *              'alt':alt,
  *              'qual':qual,
  *              'filter':filter,             # <<<<<<<<<<<<<<
  *              'info':info,
  *              'format':format}
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":849
+  /* "pysam/cvcf.pyx":849
  *              'qual':qual,
  *              'filter':filter,
  *              'info':info,             # <<<<<<<<<<<<<<
  *              'format':format}
  *         for key,value in zip(self._samples,samples):
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":850
+  /* "pysam/cvcf.pyx":850
  *              'filter':filter,
  *              'info':info,
  *              'format':format}             # <<<<<<<<<<<<<<
  *         for key,value in zip(self._samples,samples):
  *             d[key] = value
  */
-  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_d = __pyx_t_22;
-  __pyx_t_22 = 0;
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_d = __pyx_t_9;
+  __pyx_t_9 = 0;
 
-  /* "cvcf.pyx":851
+  /* "pysam/cvcf.pyx":851
  *              'info':info,
  *              'format':format}
  *         for key,value in zip(self._samples,samples):             # <<<<<<<<<<<<<<
  *             d[key] = value
  * 
  */
-  __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_22);
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_24);
-  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_22);
-  __Pyx_GIVEREF(__pyx_t_22);
+  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_9);
+  __Pyx_GIVEREF(__pyx_t_9);
   __Pyx_INCREF(((PyObject *)__pyx_v_samples));
   PyTuple_SET_ITEM(__pyx_t_24, 1, ((PyObject *)__pyx_v_samples));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samples));
-  __pyx_t_22 = 0;
-  __pyx_t_22 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_22);
+  __pyx_t_9 = 0;
+  __pyx_t_9 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0;
-  if (PyList_CheckExact(__pyx_t_22) || PyTuple_CheckExact(__pyx_t_22)) {
-    __pyx_t_24 = __pyx_t_22; __Pyx_INCREF(__pyx_t_24); __pyx_t_4 = 0;
+  if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
+    __pyx_t_24 = __pyx_t_9; __Pyx_INCREF(__pyx_t_24); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_24 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = -1; __pyx_t_24 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_24);
     __pyx_t_15 = Py_TYPE(__pyx_t_24)->tp_iternext;
   }
-  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   for (;;) {
     if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_24)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_24)) break;
-      __pyx_t_22 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_24, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_24)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_24)) break;
-      __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_24, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
-      __pyx_t_22 = __pyx_t_15(__pyx_t_24);
-      if (unlikely(!__pyx_t_22)) {
+      __pyx_t_9 = __pyx_t_15(__pyx_t_24);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_22);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    if ((likely(PyTuple_CheckExact(__pyx_t_22))) || (PyList_CheckExact(__pyx_t_22))) {
-      PyObject* sequence = __pyx_t_22;
+    if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
+      PyObject* sequence = __pyx_t_9;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      Py_ssize_t size = Py_SIZE(sequence);
+      #else
+      Py_ssize_t size = PySequence_Size(sequence);
+      #endif
+      if (unlikely(size != 2)) {
+        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
-        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
-          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        __pyx_t_23 = PyTuple_GET_ITEM(sequence, 0); 
-        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
+        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
+        __pyx_t_22 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
-          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
-          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        __pyx_t_23 = PyList_GET_ITEM(sequence, 0); 
-        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
+        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
+        __pyx_t_22 = PyList_GET_ITEM(sequence, 1); 
       }
-      __Pyx_INCREF(__pyx_t_23);
-      __Pyx_INCREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-    } else {
+      __Pyx_INCREF(__pyx_t_8);
+      __Pyx_INCREF(__pyx_t_22);
+      #else
+      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    } else
+    {
       Py_ssize_t index = -1;
-      __pyx_t_8 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_27 = Py_TYPE(__pyx_t_2)->tp_iternext;
+      index = 0; __pyx_t_8 = __pyx_t_27(__pyx_t_2); if (unlikely(!__pyx_t_8)) goto __pyx_L120_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_27 = Py_TYPE(__pyx_t_8)->tp_iternext;
-      index = 0; __pyx_t_23 = __pyx_t_27(__pyx_t_8); if (unlikely(!__pyx_t_23)) goto __pyx_L120_unpacking_failed;
-      __Pyx_GOTREF(__pyx_t_23);
-      index = 1; __pyx_t_10 = __pyx_t_27(__pyx_t_8); if (unlikely(!__pyx_t_10)) goto __pyx_L120_unpacking_failed;
-      __Pyx_GOTREF(__pyx_t_10);
-      if (__Pyx_IternextUnpackEndCheck(__pyx_t_27(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      index = 1; __pyx_t_22 = __pyx_t_27(__pyx_t_2); if (unlikely(!__pyx_t_22)) goto __pyx_L120_unpacking_failed;
+      __Pyx_GOTREF(__pyx_t_22);
+      if (__Pyx_IternextUnpackEndCheck(__pyx_t_27(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_27 = NULL;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       goto __pyx_L121_unpacking_done;
       __pyx_L120_unpacking_failed:;
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
-      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_27 = NULL;
+      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L121_unpacking_done:;
     }
     __Pyx_XDECREF(__pyx_v_key);
-    __pyx_v_key = __pyx_t_23;
-    __pyx_t_23 = 0;
+    __pyx_v_key = __pyx_t_8;
+    __pyx_t_8 = 0;
     __Pyx_XDECREF(__pyx_v_value);
-    __pyx_v_value = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_v_value = __pyx_t_22;
+    __pyx_t_22 = 0;
 
-    /* "cvcf.pyx":852
+    /* "pysam/cvcf.pyx":852
  *              'format':format}
  *         for key,value in zip(self._samples,samples):
  *             d[key] = value             # <<<<<<<<<<<<<<
@@ -18696,7 +19046,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
 
-  /* "cvcf.pyx":854
+  /* "pysam/cvcf.pyx":854
  *             d[key] = value
  * 
  *         return d             # <<<<<<<<<<<<<<
@@ -18721,7 +19071,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_XDECREF(__pyx_t_22);
   __Pyx_XDECREF(__pyx_t_23);
   __Pyx_XDECREF(__pyx_t_24);
-  __Pyx_AddTraceback("cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_cols);
@@ -18767,18 +19117,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_35write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_35write_data = {__Pyx_NAMESTR("write_data"), (PyCFunction)__pyx_pw_4cvcf_3VCF_35write_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_35write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_35write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_35write_data = {__Pyx_NAMESTR("write_data"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_35write_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_35write_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;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__data,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_data (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__data,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -18793,18 +19142,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_35write_data(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -18827,16 +19173,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_35write_data(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.write_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_34write_data(__pyx_self, __pyx_v_self, __pyx_v_stream, __pyx_v_data);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_34write_data(__pyx_self, __pyx_v_self, __pyx_v_stream, __pyx_v_data);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":857
+/* "pysam/cvcf.pyx":857
  * 
  * 
  *     def write_data(self, stream, data):             # <<<<<<<<<<<<<<
@@ -18844,7 +19190,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_35write_data(PyObject *__pyx_self, PyObject
  *         for k in required:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_data) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_data) {
   PyObject *__pyx_v_required = NULL;
   PyObject *__pyx_v_k = NULL;
   PyObject *__pyx_v_alt = NULL;
@@ -18872,7 +19218,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("write_data", 0);
 
-  /* "cvcf.pyx":858
+  /* "pysam/cvcf.pyx":858
  * 
  *     def write_data(self, stream, data):
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples             # <<<<<<<<<<<<<<
@@ -18917,7 +19263,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_required = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":859
+  /* "pysam/cvcf.pyx":859
  *     def write_data(self, stream, data):
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
  *         for k in required:             # <<<<<<<<<<<<<<
@@ -18935,10 +19281,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_2 = __pyx_t_5(__pyx_t_3);
       if (unlikely(!__pyx_t_2)) {
@@ -18954,14 +19308,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_v_k = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":860
+    /* "pysam/cvcf.pyx":860
  *         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'])
  */
-    __pyx_t_6 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_data, __pyx_v_k))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = (__Pyx_PySequence_Contains(__pyx_v_k, __pyx_v_data, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_6) {
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
@@ -18991,7 +19345,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":861
+  /* "pysam/cvcf.pyx":861
  *         for k in required:
  *             if k not in data: raise ValueError("Required key %s not found in data" % str(k))
  *         if data['alt'] == []: alt = "."             # <<<<<<<<<<<<<<
@@ -19002,8 +19356,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __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;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19015,7 +19368,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":862
+    /* "pysam/cvcf.pyx":862
  *             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'])             # <<<<<<<<<<<<<<
@@ -19040,7 +19393,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L6:;
 
-  /* "cvcf.pyx":863
+  /* "pysam/cvcf.pyx":863
  *         if data['alt'] == []: alt = "."
  *         else: alt = ",".join(data['alt'])
  *         if data['filter'] == None: filter = "."             # <<<<<<<<<<<<<<
@@ -19049,8 +19402,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
  */
   __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__filter)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -19060,7 +19412,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
     goto __pyx_L7;
   }
 
-  /* "cvcf.pyx":864
+  /* "pysam/cvcf.pyx":864
  *         else: alt = ",".join(data['alt'])
  *         if data['filter'] == None: filter = "."
  *         elif data['filter'] == []:             # <<<<<<<<<<<<<<
@@ -19071,15 +19423,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); 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);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 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;
   if (__pyx_t_6) {
 
-    /* "cvcf.pyx":865
+    /* "pysam/cvcf.pyx":865
  *         if data['filter'] == None: filter = "."
  *         elif data['filter'] == []:
  *             if self._version == 33: filter = "0"             # <<<<<<<<<<<<<<
@@ -19088,8 +19439,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __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 = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -19100,7 +19450,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
     }
     /*else*/ {
 
-      /* "cvcf.pyx":866
+      /* "pysam/cvcf.pyx":866
  *         elif data['filter'] == []:
  *             if self._version == 33: filter = "0"
  *             else: filter = "PASS"             # <<<<<<<<<<<<<<
@@ -19115,7 +19465,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":867
+    /* "pysam/cvcf.pyx":867
  *             if self._version == 33: filter = "0"
  *             else: filter = "PASS"
  *         else: filter = ';'.join(data['filter'])             # <<<<<<<<<<<<<<
@@ -19140,7 +19490,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L7:;
 
-  /* "cvcf.pyx":868
+  /* "pysam/cvcf.pyx":868
  *             else: filter = "PASS"
  *         else: filter = ';'.join(data['filter'])
  *         if data['qual'] == -1: qual = "."             # <<<<<<<<<<<<<<
@@ -19149,8 +19499,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
  */
   __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__qual)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -19161,7 +19510,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   /*else*/ {
 
-    /* "cvcf.pyx":869
+    /* "pysam/cvcf.pyx":869
  *         else: filter = ';'.join(data['filter'])
  *         if data['qual'] == -1: qual = "."
  *         else: qual = str(data['qual'])             # <<<<<<<<<<<<<<
@@ -19183,7 +19532,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L9:;
 
-  /* "cvcf.pyx":871
+  /* "pysam/cvcf.pyx":871
  *         else: qual = str(data['qual'])
  * 
  *         output = [data['chrom'],             # <<<<<<<<<<<<<<
@@ -19193,7 +19542,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__chrom)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
 
-  /* "cvcf.pyx":872
+  /* "pysam/cvcf.pyx":872
  * 
  *         output = [data['chrom'],
  *                   str(data['pos']+1),   # change to 1-based position             # <<<<<<<<<<<<<<
@@ -19214,7 +19563,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":873
+  /* "pysam/cvcf.pyx":873
  *         output = [data['chrom'],
  *                   str(data['pos']+1),   # change to 1-based position
  *                   data['id'],             # <<<<<<<<<<<<<<
@@ -19224,7 +19573,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "cvcf.pyx":874
+  /* "pysam/cvcf.pyx":874
  *                   str(data['pos']+1),   # change to 1-based position
  *                   data['id'],
  *                   data['ref'],             # <<<<<<<<<<<<<<
@@ -19234,7 +19583,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_7 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__ref)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
 
-  /* "cvcf.pyx":878
+  /* "pysam/cvcf.pyx":878
  *                   qual,
  *                   filter,
  *                   self.format_formatdata( data['info'], self._info, separator=";" ),             # <<<<<<<<<<<<<<
@@ -19264,7 +19613,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
 
-  /* "cvcf.pyx":879
+  /* "pysam/cvcf.pyx":879
  *                   filter,
  *                   self.format_formatdata( data['info'], self._info, separator=";" ),
  *                   self.format_formatdata( data['format'], self._format, value=False ) ]             # <<<<<<<<<<<<<<
@@ -19328,7 +19677,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_output = __pyx_t_8;
   __pyx_t_8 = 0;
 
-  /* "cvcf.pyx":881
+  /* "pysam/cvcf.pyx":881
  *                   self.format_formatdata( data['format'], self._format, value=False ) ]
  * 
  *         for s in self._samples:             # <<<<<<<<<<<<<<
@@ -19349,10 +19698,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_11)) break;
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_8 = __pyx_t_5(__pyx_t_11);
       if (unlikely(!__pyx_t_8)) {
@@ -19368,7 +19725,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
     __pyx_v_s = __pyx_t_8;
     __pyx_t_8 = 0;
 
-    /* "cvcf.pyx":882
+    /* "pysam/cvcf.pyx":882
  * 
  *         for s in self._samples:
  *             output.append( self.format_formatdata( data[s], self._format, key=False ) )             # <<<<<<<<<<<<<<
@@ -19405,7 +19762,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   }
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
 
-  /* "cvcf.pyx":884
+  /* "pysam/cvcf.pyx":884
  *             output.append( self.format_formatdata( data[s], self._format, key=False ) )
  * 
  *         stream.write( "\t".join(output) + "\n" )             # <<<<<<<<<<<<<<
@@ -19451,7 +19808,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
   __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_AddTraceback("cvcf.VCF.write_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_required);
@@ -19467,17 +19824,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_37_parse_header = {__Pyx_NAMESTR("_parse_header"), (PyCFunction)__pyx_pw_4cvcf_3VCF_37_parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_37_parse_header = {__Pyx_NAMESTR("_parse_header"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_37_parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_parse_header (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -19491,12 +19847,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_parse_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -19517,16 +19871,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_parse_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF._parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF._parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_36_parse_header(__pyx_self, __pyx_v_self, __pyx_v_stream);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_36_parse_header(__pyx_self, __pyx_v_self, __pyx_v_stream);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":886
+/* "pysam/cvcf.pyx":886
  *         stream.write( "\t".join(output) + "\n" )
  * 
  *     def _parse_header(self, stream):             # <<<<<<<<<<<<<<
@@ -19534,7 +19888,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObj
  *         for line in stream:
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
   PyObject *__pyx_v_line = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -19550,7 +19904,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_parse_header", 0);
 
-  /* "cvcf.pyx":887
+  /* "pysam/cvcf.pyx":887
  * 
  *     def _parse_header(self, stream):
  *         self._lineno = 0             # <<<<<<<<<<<<<<
@@ -19559,7 +19913,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
  */
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":888
+  /* "pysam/cvcf.pyx":888
  *     def _parse_header(self, stream):
  *         self._lineno = 0
  *         for line in stream:             # <<<<<<<<<<<<<<
@@ -19577,10 +19931,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
   for (;;) {
     if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
       if (unlikely(!__pyx_t_4)) {
@@ -19596,7 +19958,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
     __pyx_v_line = __pyx_t_4;
     __pyx_t_4 = 0;
 
-    /* "cvcf.pyx":889
+    /* "pysam/cvcf.pyx":889
  *         self._lineno = 0
  *         for line in stream:
  *             self._lineno += 1             # <<<<<<<<<<<<<<
@@ -19611,7 +19973,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
     if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":890
+    /* "pysam/cvcf.pyx":890
  *         for line in stream:
  *             self._lineno += 1
  *             if line.startswith('##'):             # <<<<<<<<<<<<<<
@@ -19627,7 +19989,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (__pyx_t_6) {
 
-      /* "cvcf.pyx":891
+      /* "pysam/cvcf.pyx":891
  *             self._lineno += 1
  *             if line.startswith('##'):
  *                 self.parse_header( line.strip() )             # <<<<<<<<<<<<<<
@@ -19654,7 +20016,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
       goto __pyx_L5;
     }
 
-    /* "cvcf.pyx":892
+    /* "pysam/cvcf.pyx":892
  *             if line.startswith('##'):
  *                 self.parse_header( line.strip() )
  *             elif line.startswith('#'):             # <<<<<<<<<<<<<<
@@ -19670,7 +20032,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_6) {
 
-      /* "cvcf.pyx":893
+      /* "pysam/cvcf.pyx":893
  *                 self.parse_header( line.strip() )
  *             elif line.startswith('#'):
  *                 self.parse_heading( line.strip() )             # <<<<<<<<<<<<<<
@@ -19695,7 +20057,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-      /* "cvcf.pyx":894
+      /* "pysam/cvcf.pyx":894
  *             elif line.startswith('#'):
  *                 self.parse_heading( line.strip() )
  *                 self.enter_default_format()             # <<<<<<<<<<<<<<
@@ -19712,7 +20074,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
     }
     /*else*/ {
 
-      /* "cvcf.pyx":896
+      /* "pysam/cvcf.pyx":896
  *                 self.enter_default_format()
  *             else:
  *                 break             # <<<<<<<<<<<<<<
@@ -19726,7 +20088,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
   __pyx_L4_break:;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":897
+  /* "pysam/cvcf.pyx":897
  *             else:
  *                 break
  *         return line             # <<<<<<<<<<<<<<
@@ -19746,7 +20108,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_AddTraceback("cvcf.VCF._parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF._parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_line);
@@ -19754,21 +20116,20 @@ static PyObject *__pyx_pf_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObject *__p
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
-static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_39_parse = {__Pyx_NAMESTR("_parse"), (PyCFunction)__pyx_pw_4cvcf_3VCF_39_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_39_parse = {__Pyx_NAMESTR("_parse"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_39_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_39_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;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_parse (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__stream,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -19783,18 +20144,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObject *__
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -19817,16 +20175,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObject *__
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF._parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF._parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_38_parse(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_stream);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_38_parse(__pyx_self, __pyx_v_self, __pyx_v_line, __pyx_v_stream);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":899
+/* "pysam/cvcf.pyx":899
  *         return line
  * 
  *     def _parse(self, line, stream):             # <<<<<<<<<<<<<<
@@ -19834,15 +20192,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObject *__
  *         if line.startswith("##"): return
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_stream) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *__pyx_cur_scope;
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_line, PyObject *__pyx_v_stream) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *__pyx_cur_scope;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_parse", 0);
-  __pyx_cur_scope = (struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *)__pyx_ptype_4cvcf___pyx_scope_struct_2__parse->tp_new(__pyx_ptype_4cvcf___pyx_scope_struct_2__parse, __pyx_empty_tuple, NULL);
+  __pyx_cur_scope = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)__pyx_ptype_5pysam_4cvcf___pyx_scope_struct_2__parse->tp_new(__pyx_ptype_5pysam_4cvcf___pyx_scope_struct_2__parse, __pyx_empty_tuple, NULL);
   if (unlikely(!__pyx_cur_scope)) {
     __Pyx_RefNannyFinishContext();
     return NULL;
@@ -19858,7 +20216,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self
   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_stream);
   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_stream);
   {
-    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cvcf_3VCF_40generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_4cvcf_3VCF_40generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_cur_scope);
     __Pyx_RefNannyFinishContext();
     return (PyObject *) gen;
@@ -19867,7 +20225,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF._parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF._parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
@@ -19876,9 +20234,9 @@ static PyObject *__pyx_pf_4cvcf_3VCF_38_parse(CYTHON_UNUSED PyObject *__pyx_self
   return __pyx_r;
 }
 
-static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
 {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *__pyx_cur_scope = ((struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *)__pyx_generator->closure);
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *__pyx_cur_scope = ((struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)__pyx_generator->closure);
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -19902,7 +20260,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
   __pyx_L3_first_run:;
   if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":901
+  /* "pysam/cvcf.pyx":901
  *     def _parse(self, line, stream):
  *         # deal with files with header only
  *         if line.startswith("##"): return             # <<<<<<<<<<<<<<
@@ -19924,7 +20282,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
   }
   __pyx_L4:;
 
-  /* "cvcf.pyx":902
+  /* "pysam/cvcf.pyx":902
  *         # deal with files with header only
  *         if line.startswith("##"): return
  *         if len(line.strip()) > 0:             # <<<<<<<<<<<<<<
@@ -19941,7 +20299,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
   __pyx_t_3 = (__pyx_t_4 > 0);
   if (__pyx_t_3) {
 
-    /* "cvcf.pyx":903
+    /* "pysam/cvcf.pyx":903
  *         if line.startswith("##"): return
  *         if len(line.strip()) > 0:
  *             d = self.parse_data( line.strip() )             # <<<<<<<<<<<<<<
@@ -19968,7 +20326,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
     __pyx_cur_scope->__pyx_v_d = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "cvcf.pyx":904
+    /* "pysam/cvcf.pyx":904
  *         if len(line.strip()) > 0:
  *             d = self.parse_data( line.strip() )
  *             if d: yield d             # <<<<<<<<<<<<<<
@@ -19993,7 +20351,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
   }
   __pyx_L5:;
 
-  /* "cvcf.pyx":905
+  /* "pysam/cvcf.pyx":905
  *             d = self.parse_data( line.strip() )
  *             if d: yield d
  *         for line in stream:             # <<<<<<<<<<<<<<
@@ -20011,10 +20369,18 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
   for (;;) {
     if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_5)) {
       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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_5)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_2 = __pyx_t_6(__pyx_t_5);
       if (unlikely(!__pyx_t_2)) {
@@ -20032,7 +20398,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
     __pyx_cur_scope->__pyx_v_line = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "cvcf.pyx":906
+    /* "pysam/cvcf.pyx":906
  *             if d: yield d
  *         for line in stream:
  *             self._lineno += 1             # <<<<<<<<<<<<<<
@@ -20047,7 +20413,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
     if (PyObject_SetAttr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s___lineno, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":907
+    /* "pysam/cvcf.pyx":907
  *         for line in stream:
  *             self._lineno += 1
  *             if self._lines and self._lineno > self._lines: raise StopIteration             # <<<<<<<<<<<<<<
@@ -20063,8 +20429,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s___lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __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_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -20080,7 +20445,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
     }
     __pyx_L10:;
 
-    /* "cvcf.pyx":908
+    /* "pysam/cvcf.pyx":908
  *             self._lineno += 1
  *             if self._lines and self._lineno > self._lines: raise StopIteration
  *             d = self.parse_data( line.strip() )             # <<<<<<<<<<<<<<
@@ -20109,7 +20474,7 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
     __pyx_cur_scope->__pyx_v_d = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":909
+    /* "pysam/cvcf.pyx":909
  *             if self._lines and self._lineno > self._lines: raise StopIteration
  *             d = self.parse_data( line.strip() )
  *             if d: yield d             # <<<<<<<<<<<<<<
@@ -20152,25 +20517,25 @@ static PyObject *__pyx_gb_4cvcf_3VCF_40generator(__pyx_GeneratorObject *__pyx_ge
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
   __pyx_generator->resume_label = -1;
+  __Pyx_Generator_clear((PyObject*)__pyx_generator);
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_42getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_41getsamples[] = " List of samples in VCF file ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_42getsamples = {__Pyx_NAMESTR("getsamples"), (PyCFunction)__pyx_pw_4cvcf_3VCF_42getsamples, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_41getsamples)};
-static PyObject *__pyx_pw_4cvcf_3VCF_42getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_42getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_41getsamples[] = " List of samples in VCF file ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_42getsamples = {__Pyx_NAMESTR("getsamples"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_42getsamples, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_41getsamples)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_42getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getsamples (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_41getsamples(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_41getsamples(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":917
+/* "pysam/cvcf.pyx":917
  *     ######################################################################################################
  * 
  *     def getsamples(self):             # <<<<<<<<<<<<<<
@@ -20178,7 +20543,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_42getsamples(PyObject *__pyx_self, PyObject
  *         return self._samples
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -20187,7 +20552,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("getsamples", 0);
 
-  /* "cvcf.pyx":919
+  /* "pysam/cvcf.pyx":919
  *     def getsamples(self):
  *         """ List of samples in VCF file """
  *         return self._samples             # <<<<<<<<<<<<<<
@@ -20205,7 +20570,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.getsamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.getsamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20214,18 +20579,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_41getsamples(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_43setsamples[] = " List of samples in VCF file ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_44setsamples = {__Pyx_NAMESTR("setsamples"), (PyCFunction)__pyx_pw_4cvcf_3VCF_44setsamples, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_43setsamples)};
-static PyObject *__pyx_pw_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_43setsamples[] = " List of samples in VCF file ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_44setsamples = {__Pyx_NAMESTR("setsamples"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_44setsamples, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_43setsamples)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_samples = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__samples,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setsamples (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__samples,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20239,12 +20603,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setsamples", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20265,16 +20627,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setsamples", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setsamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setsamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_43setsamples(__pyx_self, __pyx_v_self, __pyx_v_samples);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_43setsamples(__pyx_self, __pyx_v_self, __pyx_v_samples);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":921
+/* "pysam/cvcf.pyx":921
  *         return self._samples
  * 
  *     def setsamples(self,samples):             # <<<<<<<<<<<<<<
@@ -20282,7 +20644,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject
  *         self._samples = samples
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_samples) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_samples) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -20290,7 +20652,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setsamples", 0);
 
-  /* "cvcf.pyx":923
+  /* "pysam/cvcf.pyx":923
  *     def setsamples(self,samples):
  *         """ List of samples in VCF file """
  *         self._samples = samples             # <<<<<<<<<<<<<<
@@ -20302,7 +20664,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setsamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setsamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20311,20 +20673,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_43setsamples(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_46getheader(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_45getheader[] = " List of header key-value pairs (strings) ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_46getheader = {__Pyx_NAMESTR("getheader"), (PyCFunction)__pyx_pw_4cvcf_3VCF_46getheader, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_45getheader)};
-static PyObject *__pyx_pw_4cvcf_3VCF_46getheader(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_46getheader(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_45getheader[] = " List of header key-value pairs (strings) ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_46getheader = {__Pyx_NAMESTR("getheader"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_46getheader, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_45getheader)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_46getheader(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getheader (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_45getheader(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_45getheader(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":925
+/* "pysam/cvcf.pyx":925
  *         self._samples = samples
  * 
  *     def getheader(self):             # <<<<<<<<<<<<<<
@@ -20332,7 +20693,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_46getheader(PyObject *__pyx_self, PyObject
  *         return self._header
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -20341,7 +20702,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("getheader", 0);
 
-  /* "cvcf.pyx":927
+  /* "pysam/cvcf.pyx":927
  *     def getheader(self):
  *         """ List of header key-value pairs (strings) """
  *         return self._header             # <<<<<<<<<<<<<<
@@ -20359,7 +20720,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_s
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.getheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.getheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20368,18 +20729,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_45getheader(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_47setheader[] = " List of header key-value pairs (strings) ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_48setheader = {__Pyx_NAMESTR("setheader"), (PyCFunction)__pyx_pw_4cvcf_3VCF_48setheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_47setheader)};
-static PyObject *__pyx_pw_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_47setheader[] = " List of header key-value pairs (strings) ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_48setheader = {__Pyx_NAMESTR("setheader"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_48setheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_47setheader)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_header = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__header,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setheader (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__header,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20393,12 +20753,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setheader", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20419,16 +20777,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setheader", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_47setheader(__pyx_self, __pyx_v_self, __pyx_v_header);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_47setheader(__pyx_self, __pyx_v_self, __pyx_v_header);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":929
+/* "pysam/cvcf.pyx":929
  *         return self._header
  * 
  *     def setheader(self,header):             # <<<<<<<<<<<<<<
@@ -20436,7 +20794,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject
  *         self._header = header
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_header) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_header) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -20444,7 +20802,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setheader", 0);
 
-  /* "cvcf.pyx":931
+  /* "pysam/cvcf.pyx":931
  *     def setheader(self,header):
  *         """ List of header key-value pairs (strings) """
  *         self._header = header             # <<<<<<<<<<<<<<
@@ -20456,7 +20814,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20465,20 +20823,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_47setheader(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_50getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_49getinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_50getinfo = {__Pyx_NAMESTR("getinfo"), (PyCFunction)__pyx_pw_4cvcf_3VCF_50getinfo, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_49getinfo)};
-static PyObject *__pyx_pw_4cvcf_3VCF_50getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_50getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_49getinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_50getinfo = {__Pyx_NAMESTR("getinfo"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_50getinfo, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_49getinfo)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_50getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getinfo (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_49getinfo(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_49getinfo(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":933
+/* "pysam/cvcf.pyx":933
  *         self._header = header
  * 
  *     def getinfo(self):             # <<<<<<<<<<<<<<
@@ -20486,7 +20843,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_50getinfo(PyObject *__pyx_self, PyObject *_
  *         return self._info
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -20495,7 +20852,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_sel
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("getinfo", 0);
 
-  /* "cvcf.pyx":935
+  /* "pysam/cvcf.pyx":935
  *     def getinfo(self):
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         return self._info             # <<<<<<<<<<<<<<
@@ -20513,7 +20870,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_sel
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.getinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.getinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20522,18 +20879,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_49getinfo(CYTHON_UNUSED PyObject *__pyx_sel
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_51setinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_52setinfo = {__Pyx_NAMESTR("setinfo"), (PyCFunction)__pyx_pw_4cvcf_3VCF_52setinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_51setinfo)};
-static PyObject *__pyx_pw_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_51setinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_52setinfo = {__Pyx_NAMESTR("setinfo"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_52setinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_51setinfo)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_info = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__info,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setinfo (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__info,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20547,12 +20903,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__info);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__info)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setinfo", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20573,16 +20927,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setinfo", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_51setinfo(__pyx_self, __pyx_v_self, __pyx_v_info);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_51setinfo(__pyx_self, __pyx_v_self, __pyx_v_info);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":937
+/* "pysam/cvcf.pyx":937
  *         return self._info
  * 
  *     def setinfo(self,info):             # <<<<<<<<<<<<<<
@@ -20590,7 +20944,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *_
  *         self._info = info
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_info) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_info) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -20598,7 +20952,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_sel
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setinfo", 0);
 
-  /* "cvcf.pyx":939
+  /* "pysam/cvcf.pyx":939
  *     def setinfo(self,info):
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         self._info = info             # <<<<<<<<<<<<<<
@@ -20610,7 +20964,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20619,20 +20973,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_51setinfo(CYTHON_UNUSED PyObject *__pyx_sel
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_54getformat(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_53getformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_54getformat = {__Pyx_NAMESTR("getformat"), (PyCFunction)__pyx_pw_4cvcf_3VCF_54getformat, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_53getformat)};
-static PyObject *__pyx_pw_4cvcf_3VCF_54getformat(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_54getformat(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_53getformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_54getformat = {__Pyx_NAMESTR("getformat"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_54getformat, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_53getformat)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_54getformat(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getformat (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_53getformat(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_53getformat(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":941
+/* "pysam/cvcf.pyx":941
  *         self._info = info
  * 
  *     def getformat(self):             # <<<<<<<<<<<<<<
@@ -20640,7 +20993,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_54getformat(PyObject *__pyx_self, PyObject
  *         return self._format
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -20649,7 +21002,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("getformat", 0);
 
-  /* "cvcf.pyx":943
+  /* "pysam/cvcf.pyx":943
  *     def getformat(self):
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         return self._format             # <<<<<<<<<<<<<<
@@ -20667,7 +21020,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_s
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.getformat", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.getformat", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20676,18 +21029,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_53getformat(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_55setformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_56setformat = {__Pyx_NAMESTR("setformat"), (PyCFunction)__pyx_pw_4cvcf_3VCF_56setformat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_55setformat)};
-static PyObject *__pyx_pw_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_55setformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_56setformat = {__Pyx_NAMESTR("setformat"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_56setformat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_55setformat)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_format = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setformat (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20701,12 +21053,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setformat", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20727,16 +21077,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setformat", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setformat", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setformat", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_55setformat(__pyx_self, __pyx_v_self, __pyx_v_format);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_55setformat(__pyx_self, __pyx_v_self, __pyx_v_format);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":945
+/* "pysam/cvcf.pyx":945
  *         return self._format
  * 
  *     def setformat(self,format):             # <<<<<<<<<<<<<<
@@ -20744,7 +21094,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject
  *         self._format = format
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_format) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -20752,7 +21102,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setformat", 0);
 
-  /* "cvcf.pyx":947
+  /* "pysam/cvcf.pyx":947
  *     def setformat(self,format):
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         self._format = format             # <<<<<<<<<<<<<<
@@ -20764,7 +21114,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setformat", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setformat", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20773,20 +21123,19 @@ static PyObject *__pyx_pf_4cvcf_3VCF_55setformat(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_58getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_57getfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_58getfilter = {__Pyx_NAMESTR("getfilter"), (PyCFunction)__pyx_pw_4cvcf_3VCF_58getfilter, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_57getfilter)};
-static PyObject *__pyx_pw_4cvcf_3VCF_58getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_58getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_57getfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_58getfilter = {__Pyx_NAMESTR("getfilter"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_58getfilter, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_57getfilter)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_58getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getfilter (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_57getfilter(__pyx_self, ((PyObject *)__pyx_v_self));
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_57getfilter(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":949
+/* "pysam/cvcf.pyx":949
  *         self._format = format
  * 
  *     def getfilter(self):             # <<<<<<<<<<<<<<
@@ -20794,7 +21143,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_58getfilter(PyObject *__pyx_self, PyObject
  *         return self._filter
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -20803,7 +21152,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("getfilter", 0);
 
-  /* "cvcf.pyx":951
+  /* "pysam/cvcf.pyx":951
  *     def getfilter(self):
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         return self._filter             # <<<<<<<<<<<<<<
@@ -20821,7 +21170,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_s
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.getfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.getfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20830,18 +21179,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_57getfilter(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_59setfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_60setfilter = {__Pyx_NAMESTR("setfilter"), (PyCFunction)__pyx_pw_4cvcf_3VCF_60setfilter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_59setfilter)};
-static PyObject *__pyx_pw_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_59setfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_60setfilter = {__Pyx_NAMESTR("setfilter"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_60setfilter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_59setfilter)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filter = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filter,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setfilter (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filter,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20855,12 +21203,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setfilter", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20881,16 +21227,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setfilter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_59setfilter(__pyx_self, __pyx_v_self, __pyx_v_filter);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_59setfilter(__pyx_self, __pyx_v_self, __pyx_v_filter);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":953
+/* "pysam/cvcf.pyx":953
  *         return self._filter
  * 
  *     def setfilter(self,filter):             # <<<<<<<<<<<<<<
@@ -20898,7 +21244,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject
  *         self._filter = filter
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filter) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filter) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -20906,7 +21252,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setfilter", 0);
 
-  /* "cvcf.pyx":955
+  /* "pysam/cvcf.pyx":955
  *     def setfilter(self,filter):
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         self._filter = filter             # <<<<<<<<<<<<<<
@@ -20918,7 +21264,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20927,17 +21273,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_59setfilter(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_62setversion = {__Pyx_NAMESTR("setversion"), (PyCFunction)__pyx_pw_4cvcf_3VCF_62setversion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_62setversion = {__Pyx_NAMESTR("setversion"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_62setversion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_version = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__version,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setversion (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__version,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20951,12 +21296,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__version);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__version)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setversion", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20977,16 +21320,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setversion", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setversion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setversion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_61setversion(__pyx_self, __pyx_v_self, __pyx_v_version);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_61setversion(__pyx_self, __pyx_v_self, __pyx_v_version);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":957
+/* "pysam/cvcf.pyx":957
  *         self._filter = filter
  * 
  *     def setversion(self, version):             # <<<<<<<<<<<<<<
@@ -20994,7 +21337,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject
  *         self._version = version
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_version) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_version) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -21006,20 +21349,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setversion", 0);
 
-  /* "cvcf.pyx":958
+  /* "pysam/cvcf.pyx":958
  * 
  *     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_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_33, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_33, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __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 = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_40, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_40, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __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 = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __pyx_t_3;
@@ -21036,7 +21377,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":959
+  /* "pysam/cvcf.pyx":959
  *     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             # <<<<<<<<<<<<<<
@@ -21049,7 +21390,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.setversion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setversion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21058,17 +21399,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_64setregions = {__Pyx_NAMESTR("setregions"), (PyCFunction)__pyx_pw_4cvcf_3VCF_64setregions, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_64setregions = {__Pyx_NAMESTR("setregions"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_64setregions, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_regions = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__regions,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setregions (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__regions,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21082,12 +21422,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setregions", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21108,16 +21446,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setregions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setregions", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setregions", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_63setregions(__pyx_self, __pyx_v_self, __pyx_v_regions);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_63setregions(__pyx_self, __pyx_v_self, __pyx_v_regions);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":961
+/* "pysam/cvcf.pyx":961
  *         self._version = version
  * 
  *     def setregions(self, regions):             # <<<<<<<<<<<<<<
@@ -21125,7 +21463,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_regions) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_regions) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -21133,7 +21471,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setregions", 0);
 
-  /* "cvcf.pyx":962
+  /* "pysam/cvcf.pyx":962
  * 
  *     def setregions(self, regions):
  *         self._regions = regions             # <<<<<<<<<<<<<<
@@ -21145,7 +21483,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setregions", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setregions", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21154,18 +21492,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_63setregions(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_65setreference[] = " Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_66setreference = {__Pyx_NAMESTR("setreference"), (PyCFunction)__pyx_pw_4cvcf_3VCF_66setreference, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_65setreference)};
-static PyObject *__pyx_pw_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_65setreference[] = " Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_66setreference = {__Pyx_NAMESTR("setreference"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_66setreference, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_65setreference)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_ref = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__ref,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setreference (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__ref,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21179,12 +21516,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setreference", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21205,16 +21540,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObje
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setreference", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setreference", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setreference", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_65setreference(__pyx_self, __pyx_v_self, __pyx_v_ref);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_65setreference(__pyx_self, __pyx_v_self, __pyx_v_ref);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":964
+/* "pysam/cvcf.pyx":964
  *         self._regions = regions
  * 
  *     def setreference(self, ref):             # <<<<<<<<<<<<<<
@@ -21222,7 +21557,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObje
  *         self._reference = ref
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ref) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_ref) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_lineno = 0;
@@ -21230,7 +21565,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__py
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("setreference", 0);
 
-  /* "cvcf.pyx":966
+  /* "pysam/cvcf.pyx":966
  *     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             # <<<<<<<<<<<<<<
@@ -21242,7 +21577,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__py
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("cvcf.VCF.setreference", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.setreference", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21251,17 +21586,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_65setreference(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_68ignoreerror = {__Pyx_NAMESTR("ignoreerror"), (PyCFunction)__pyx_pw_4cvcf_3VCF_68ignoreerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_68ignoreerror = {__Pyx_NAMESTR("ignoreerror"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_68ignoreerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_errorstring = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("ignoreerror (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21275,12 +21609,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObjec
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("ignoreerror", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21301,16 +21633,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObjec
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("ignoreerror", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.ignoreerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.ignoreerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_67ignoreerror(__pyx_self, __pyx_v_self, __pyx_v_errorstring);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_67ignoreerror(__pyx_self, __pyx_v_self, __pyx_v_errorstring);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":968
+/* "pysam/cvcf.pyx":968
  *         self._reference = ref
  * 
  *     def ignoreerror(self, errorstring):             # <<<<<<<<<<<<<<
@@ -21318,7 +21650,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObjec
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -21335,7 +21667,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("ignoreerror", 0);
 
-  /* "cvcf.pyx":969
+  /* "pysam/cvcf.pyx":969
  * 
  *     def ignoreerror(self, errorstring):
  *         try:             self._ignored_errors.add(self.__dict__[errorstring])             # <<<<<<<<<<<<<<
@@ -21378,7 +21710,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx
     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":970
+    /* "pysam/cvcf.pyx":970
  *     def ignoreerror(self, errorstring):
  *         try:             self._ignored_errors.add(self.__dict__[errorstring])
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)             # <<<<<<<<<<<<<<
@@ -21387,7 +21719,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
     if (__pyx_t_7) {
-      __Pyx_AddTraceback("cvcf.VCF.ignoreerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      __Pyx_AddTraceback("pysam.cvcf.VCF.ignoreerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
       if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_GOTREF(__pyx_t_4);
@@ -21432,7 +21764,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("cvcf.VCF.ignoreerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.ignoreerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21441,17 +21773,16 @@ static PyObject *__pyx_pf_4cvcf_3VCF_67ignoreerror(CYTHON_UNUSED PyObject *__pyx
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_70warnerror = {__Pyx_NAMESTR("warnerror"), (PyCFunction)__pyx_pw_4cvcf_3VCF_70warnerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_70warnerror = {__Pyx_NAMESTR("warnerror"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_70warnerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_errorstring = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("warnerror (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21465,12 +21796,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("warnerror", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21491,16 +21820,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("warnerror", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.warnerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.warnerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_69warnerror(__pyx_self, __pyx_v_self, __pyx_v_errorstring);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_69warnerror(__pyx_self, __pyx_v_self, __pyx_v_errorstring);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":972
+/* "pysam/cvcf.pyx":972
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  * 
  *     def warnerror(self, errorstring):             # <<<<<<<<<<<<<<
@@ -21508,7 +21837,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_errorstring) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -21525,7 +21854,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_s
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("warnerror", 0);
 
-  /* "cvcf.pyx":973
+  /* "pysam/cvcf.pyx":973
  * 
  *     def warnerror(self, errorstring):
  *         try:             self._warn_errors.add(self.__dict__[errorstring])             # <<<<<<<<<<<<<<
@@ -21568,7 +21897,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_s
     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":974
+    /* "pysam/cvcf.pyx":974
  *     def warnerror(self, errorstring):
  *         try:             self._warn_errors.add(self.__dict__[errorstring])
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)             # <<<<<<<<<<<<<<
@@ -21577,7 +21906,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
     if (__pyx_t_7) {
-      __Pyx_AddTraceback("cvcf.VCF.warnerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      __Pyx_AddTraceback("pysam.cvcf.VCF.warnerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
       if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_GOTREF(__pyx_t_4);
@@ -21622,7 +21951,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_s
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("cvcf.VCF.warnerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.warnerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21631,18 +21960,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_69warnerror(CYTHON_UNUSED PyObject *__pyx_s
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_71parse[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_72parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pw_4cvcf_3VCF_72parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_71parse)};
-static PyObject *__pyx_pw_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_71parse[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_72parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_72parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_71parse)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21656,12 +21984,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__p
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21682,16 +22008,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__p
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_71parse(__pyx_self, __pyx_v_self, __pyx_v_stream);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_71parse(__pyx_self, __pyx_v_self, __pyx_v_stream);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":976
+/* "pysam/cvcf.pyx":976
  *         except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
  * 
  *     def parse(self, stream):             # <<<<<<<<<<<<<<
@@ -21699,7 +22025,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__p
  *         last_line = self._parse_header(stream)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
   PyObject *__pyx_v_last_line = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -21711,7 +22037,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self,
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("parse", 0);
 
-  /* "cvcf.pyx":978
+  /* "pysam/cvcf.pyx":978
  *     def parse(self, stream):
  *         """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
  *         last_line = self._parse_header(stream)             # <<<<<<<<<<<<<<
@@ -21732,7 +22058,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_v_last_line = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":981
+  /* "pysam/cvcf.pyx":981
  *         # 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)             # <<<<<<<<<<<<<<
@@ -21764,7 +22090,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCF.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_last_line);
@@ -21774,19 +22100,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_71parse(CYTHON_UNUSED PyObject *__pyx_self,
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_73write[] = " Writes a VCF file to a stream, using a data generator (or list) ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_74write = {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_4cvcf_3VCF_74write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_73write)};
-static PyObject *__pyx_pw_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_73write[] = " Writes a VCF file to a stream, using a data generator (or list) ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_74write = {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_74write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_73write)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_datagenerator = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__datagenerator,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__datagenerator,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21801,18 +22126,15 @@ static PyObject *__pyx_pw_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__p
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__datagenerator);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__datagenerator)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21835,16 +22157,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__p
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_73write(__pyx_self, __pyx_v_self, __pyx_v_stream, __pyx_v_datagenerator);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_73write(__pyx_self, __pyx_v_self, __pyx_v_stream, __pyx_v_datagenerator);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":983
+/* "pysam/cvcf.pyx":983
  *         return self._parse(last_line, stream)
  * 
  *     def write(self, stream, datagenerator):             # <<<<<<<<<<<<<<
@@ -21852,7 +22174,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObject *__p
  *         self.write_header(stream)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_datagenerator) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream, PyObject *__pyx_v_datagenerator) {
   PyObject *__pyx_v_data = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -21867,7 +22189,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self,
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("write", 0);
 
-  /* "cvcf.pyx":985
+  /* "pysam/cvcf.pyx":985
  *     def write(self, stream, datagenerator):
  *         """ Writes a VCF file to a stream, using a data generator (or list) """
  *         self.write_header(stream)             # <<<<<<<<<<<<<<
@@ -21887,7 +22209,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":986
+  /* "pysam/cvcf.pyx":986
  *         """ Writes a VCF file to a stream, using a data generator (or list) """
  *         self.write_header(stream)
  *         self.write_heading(stream)             # <<<<<<<<<<<<<<
@@ -21907,7 +22229,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":987
+  /* "pysam/cvcf.pyx":987
  *         self.write_header(stream)
  *         self.write_heading(stream)
  *         for data in datagenerator: self.write_data(stream,data)             # <<<<<<<<<<<<<<
@@ -21925,10 +22247,18 @@ static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self,
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
       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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
       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++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_2 = __pyx_t_5(__pyx_t_1);
       if (unlikely(!__pyx_t_2)) {
@@ -21968,7 +22298,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_AddTraceback("cvcf.VCF.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_data);
@@ -21978,18 +22308,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__pyx_self,
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_75writeheader[] = " Writes a VCF header ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_76writeheader = {__Pyx_NAMESTR("writeheader"), (PyCFunction)__pyx_pw_4cvcf_3VCF_76writeheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_75writeheader)};
-static PyObject *__pyx_pw_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_75writeheader[] = " Writes a VCF header ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_76writeheader = {__Pyx_NAMESTR("writeheader"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_76writeheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_75writeheader)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("writeheader (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22003,12 +22332,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObjec
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("writeheader", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22029,16 +22356,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObjec
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("writeheader", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.writeheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.writeheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_75writeheader(__pyx_self, __pyx_v_self, __pyx_v_stream);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_75writeheader(__pyx_self, __pyx_v_self, __pyx_v_stream);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":989
+/* "pysam/cvcf.pyx":989
  *         for data in datagenerator: self.write_data(stream,data)
  * 
  *     def writeheader(self, stream):             # <<<<<<<<<<<<<<
@@ -22046,7 +22373,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObjec
  *         self.write_header(stream)
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_stream) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -22057,7 +22384,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("writeheader", 0);
 
-  /* "cvcf.pyx":991
+  /* "pysam/cvcf.pyx":991
  *     def writeheader(self, stream):
  *         """ Writes a VCF header """
  *         self.write_header(stream)             # <<<<<<<<<<<<<<
@@ -22077,7 +22404,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":992
+  /* "pysam/cvcf.pyx":992
  *         """ Writes a VCF header """
  *         self.write_header(stream)
  *         self.write_heading(stream)             # <<<<<<<<<<<<<<
@@ -22103,7 +22430,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCF.writeheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.writeheader", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -22112,10 +22439,10 @@ static PyObject *__pyx_pf_4cvcf_3VCF_75writeheader(CYTHON_UNUSED PyObject *__pyx
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_77compare_calls[] = " Utility function: compares two calls for equality ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_78compare_calls = {__Pyx_NAMESTR("compare_calls"), (PyCFunction)__pyx_pw_4cvcf_3VCF_78compare_calls, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_77compare_calls)};
-static PyObject *__pyx_pw_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_77compare_calls[] = " Utility function: compares two calls for equality ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_78compare_calls = {__Pyx_NAMESTR("compare_calls"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_78compare_calls, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_77compare_calls)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_pos1 = 0;
   PyObject *__pyx_v_ref1 = 0;
@@ -22123,12 +22450,11 @@ static PyObject *__pyx_pw_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObj
   PyObject *__pyx_v_pos2 = 0;
   PyObject *__pyx_v_ref2 = 0;
   PyObject *__pyx_v_alt2 = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos1,&__pyx_n_s__ref1,&__pyx_n_s__alt1,&__pyx_n_s__pos2,&__pyx_n_s__ref2,&__pyx_n_s__alt2,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("compare_calls (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos1,&__pyx_n_s__ref1,&__pyx_n_s__alt1,&__pyx_n_s__pos2,&__pyx_n_s__ref2,&__pyx_n_s__alt2,0};
     PyObject* values[7] = {0,0,0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22147,42 +22473,35 @@ static PyObject *__pyx_pw_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref1);
-        if (likely(values[2])) kw_args--;
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref1)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt1);
-        if (likely(values[3])) kw_args--;
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt1)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos2);
-        if (likely(values[4])) kw_args--;
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos2)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  5:
-        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref2);
-        if (likely(values[5])) kw_args--;
+        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref2)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  6:
-        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt2);
-        if (likely(values[6])) kw_args--;
+        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt2)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22213,16 +22532,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObj
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.compare_calls", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.compare_calls", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_77compare_calls(__pyx_self, __pyx_v_self, __pyx_v_pos1, __pyx_v_ref1, __pyx_v_alt1, __pyx_v_pos2, __pyx_v_ref2, __pyx_v_alt2);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(__pyx_self, __pyx_v_self, __pyx_v_pos1, __pyx_v_ref1, __pyx_v_alt1, __pyx_v_pos2, __pyx_v_ref2, __pyx_v_alt2);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":994
+/* "pysam/cvcf.pyx":994
  *         self.write_heading(stream)
  * 
  *     def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2):             # <<<<<<<<<<<<<<
@@ -22230,7 +22549,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self, PyObj
  *         # a variant should always be assigned to a unique position, one base before
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_pos1, PyObject *__pyx_v_ref1, PyObject *__pyx_v_alt1, PyObject *__pyx_v_pos2, PyObject *__pyx_v_ref2, PyObject *__pyx_v_alt2) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_pos1, PyObject *__pyx_v_ref1, PyObject *__pyx_v_alt1, PyObject *__pyx_v_pos2, PyObject *__pyx_v_ref2, PyObject *__pyx_v_alt2) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -22250,15 +22569,14 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
   __Pyx_INCREF(__pyx_v_ref2);
   __Pyx_INCREF(__pyx_v_alt2);
 
-  /* "cvcf.pyx":999
+  /* "pysam/cvcf.pyx":999
  *         # 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
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos1, __pyx_v_pos2, Py_NE); 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_t_1 = PyObject_RichCompare(__pyx_v_pos1, __pyx_v_pos2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __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 = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
@@ -22272,7 +22590,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
   }
   __pyx_L3:;
 
-  /* "cvcf.pyx":1002
+  /* "pysam/cvcf.pyx":1002
  *         # 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]:             # <<<<<<<<<<<<<<
@@ -22290,8 +22608,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
         __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_alt1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __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;
         __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -22306,7 +22623,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
     }
     if (!__pyx_t_4) break;
 
-    /* "cvcf.pyx":1003
+    /* "pysam/cvcf.pyx":1003
  *         # only when the reference bases are not Ns
  *         while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:
  *             ref1 = ref1[:-1]             # <<<<<<<<<<<<<<
@@ -22319,7 +22636,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
     __pyx_v_ref1 = __pyx_t_6;
     __pyx_t_6 = 0;
 
-    /* "cvcf.pyx":1004
+    /* "pysam/cvcf.pyx":1004
  *         while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:
  *             ref1 = ref1[:-1]
  *             alt1 = alt1[:-1]             # <<<<<<<<<<<<<<
@@ -22333,7 +22650,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
     __pyx_t_6 = 0;
   }
 
-  /* "cvcf.pyx":1005
+  /* "pysam/cvcf.pyx":1005
  *             ref1 = ref1[:-1]
  *             alt1 = alt1[:-1]
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:             # <<<<<<<<<<<<<<
@@ -22351,8 +22668,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_alt2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, 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_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -22367,7 +22683,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
     }
     if (!__pyx_t_2) break;
 
-    /* "cvcf.pyx":1006
+    /* "pysam/cvcf.pyx":1006
  *             alt1 = alt1[:-1]
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
  *             ref2 = ref2[:-1]             # <<<<<<<<<<<<<<
@@ -22380,7 +22696,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
     __pyx_v_ref2 = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "cvcf.pyx":1007
+    /* "pysam/cvcf.pyx":1007
  *         while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
  *             ref2 = ref2[:-1]
  *             alt2 = alt2[:-1]             # <<<<<<<<<<<<<<
@@ -22394,7 +22710,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
     __pyx_t_1 = 0;
   }
 
-  /* "cvcf.pyx":1009
+  /* "pysam/cvcf.pyx":1009
  *             alt2 = alt2[:-1]
  *         # now, the alternative alleles must be identical
  *         return alt1 == alt2             # <<<<<<<<<<<<<<
@@ -22402,8 +22718,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
  * ###########################################################################################################
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt1, __pyx_v_alt2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt1, __pyx_v_alt2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -22414,7 +22729,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_AddTraceback("cvcf.VCF.compare_calls", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.compare_calls", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_ref1);
@@ -22427,18 +22742,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObject *__p
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_79connect[] = "connect to tabix file.";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_80connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pw_4cvcf_3VCF_80connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_79connect)};
-static PyObject *__pyx_pw_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_79connect[] = "connect to tabix file.";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_80connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_80connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_79connect)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filename = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("connect (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22452,12 +22766,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("connect", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22478,16 +22790,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("connect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_79connect(__pyx_self, __pyx_v_self, __pyx_v_filename);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_79connect(__pyx_self, __pyx_v_self, __pyx_v_filename);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":1016
+/* "pysam/cvcf.pyx":1016
  * ###########################################################################################################
  * 
  *     def connect( self, filename ):             # <<<<<<<<<<<<<<
@@ -22495,7 +22807,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyObject *_
  *         self.tabixfile = pysam.Tabixfile( filename )
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -22506,7 +22818,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_sel
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("connect", 0);
 
-  /* "cvcf.pyx":1018
+  /* "pysam/cvcf.pyx":1018
  *     def connect( self, filename ):
  *         '''connect to tabix file.'''
  *         self.tabixfile = pysam.Tabixfile( filename )             # <<<<<<<<<<<<<<
@@ -22530,7 +22842,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_sel
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tabixfile, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "cvcf.pyx":1019
+  /* "pysam/cvcf.pyx":1019
  *         '''connect to tabix file.'''
  *         self.tabixfile = pysam.Tabixfile( filename )
  *         self._parse_header(self.tabixfile.header)             # <<<<<<<<<<<<<<
@@ -22561,7 +22873,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("cvcf.VCF.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -22570,24 +22882,23 @@ static PyObject *__pyx_pf_4cvcf_3VCF_79connect(CYTHON_UNUSED PyObject *__pyx_sel
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_81fetch[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_82fetch = {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_4cvcf_3VCF_82fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_81fetch)};
-static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_81fetch[] = " Parse a stream of VCF-formatted lines.  Initializes class instance and return generator ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_82fetch = {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_82fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_81fetch)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
     PyObject* values[5] = {0,0,0,0,0};
 
-    /* "cvcf.pyx":1022
+    /* "pysam/cvcf.pyx":1022
  * 
  *     def fetch(self,
  *               reference = None,             # <<<<<<<<<<<<<<
@@ -22596,7 +22907,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__p
  */
     values[1] = ((PyObject *)((PyObject *)Py_None));
 
-    /* "cvcf.pyx":1023
+    /* "pysam/cvcf.pyx":1023
  *     def fetch(self,
  *               reference = None,
  *               start = None,             # <<<<<<<<<<<<<<
@@ -22605,7 +22916,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__p
  */
     values[2] = ((PyObject *)((PyObject *)Py_None));
 
-    /* "cvcf.pyx":1024
+    /* "pysam/cvcf.pyx":1024
  *               reference = None,
  *               start = None,
  *               end = None,             # <<<<<<<<<<<<<<
@@ -22614,7 +22925,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__p
  */
     values[3] = ((PyObject *)((PyObject *)Py_None));
 
-    /* "cvcf.pyx":1025
+    /* "pysam/cvcf.pyx":1025
  *               start = None,
  *               end = None,
  *               region = None ):             # <<<<<<<<<<<<<<
@@ -22637,8 +22948,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__p
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -22685,16 +22995,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__p
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("fetch", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_81fetch(__pyx_self, __pyx_v_self, __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_81fetch(__pyx_self, __pyx_v_self, __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":1021
+/* "pysam/cvcf.pyx":1021
  *         self._parse_header(self.tabixfile.header)
  * 
  *     def fetch(self,             # <<<<<<<<<<<<<<
@@ -22702,7 +23012,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObject *__p
  *               start = None,
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -22715,7 +23025,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self,
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("fetch", 0);
 
-  /* "cvcf.pyx":1028
+  /* "pysam/cvcf.pyx":1028
  *         """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
  * 
  *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )             # <<<<<<<<<<<<<<
@@ -22749,7 +23059,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self,
   __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)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_4cvcf_asVCFRecord)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __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 = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -22771,7 +23081,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("cvcf.VCF.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -22780,18 +23090,17 @@ static PyObject *__pyx_pf_4cvcf_3VCF_81fetch(CYTHON_UNUSED PyObject *__pyx_self,
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cvcf_3VCF_83validate[] = "validate vcf record.\n\n        returns a validated record.\n        ";
-static PyMethodDef __pyx_mdef_4cvcf_3VCF_84validate = {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pw_4cvcf_3VCF_84validate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_83validate)};
-static PyObject *__pyx_pw_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_5pysam_4cvcf_3VCF_83validate[] = "validate vcf record.\n\n        returns a validated record.\n        ";
+static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_84validate = {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pw_5pysam_4cvcf_3VCF_84validate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_3VCF_83validate)};
+static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
   CYTHON_UNUSED PyObject *__pyx_v_record = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__record,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("validate (wrapper)", 0);
-  __pyx_self = __pyx_self;
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__record,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22805,12 +23114,10 @@ static PyObject *__pyx_pw_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("validate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22831,16 +23138,16 @@ static PyObject *__pyx_pw_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("validate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("cvcf.VCF.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4cvcf_3VCF_83validate(__pyx_self, __pyx_v_self, __pyx_v_record);
+  __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_83validate(__pyx_self, __pyx_v_self, __pyx_v_record);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "cvcf.pyx":1030
+/* "pysam/cvcf.pyx":1030
  *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )
  * 
  *     def validate( self, record ):             # <<<<<<<<<<<<<<
@@ -22848,7 +23155,7 @@ static PyObject *__pyx_pw_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *
  * 
  */
 
-static PyObject *__pyx_pf_4cvcf_3VCF_83validate(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_record) {
+static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_83validate(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_record) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -22857,7 +23164,7 @@ static PyObject *__pyx_pf_4cvcf_3VCF_83validate(CYTHON_UNUSED PyObject *__pyx_se
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("validate", 0);
 
-  /* "cvcf.pyx":1036
+  /* "pysam/cvcf.pyx":1036
  *         '''
  * 
  *         raise NotImplementedError( "needs to be checked" )             # <<<<<<<<<<<<<<
@@ -22874,58 +23181,56 @@ static PyObject *__pyx_pf_4cvcf_3VCF_83validate(CYTHON_UNUSED PyObject *__pyx_se
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("cvcf.VCF.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("pysam.cvcf.VCF.validate", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
-static struct __pyx_vtabstruct_4cvcf_VCFRecord __pyx_vtable_4cvcf_VCFRecord;
+static struct __pyx_vtabstruct_5pysam_4cvcf_VCFRecord __pyx_vtable_5pysam_4cvcf_VCFRecord;
 
-static PyObject *__pyx_tp_new_4cvcf_VCFRecord(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_4cvcf_VCFRecord *p;
-  PyObject *o = __pyx_ptype_10TabProxies_TupleProxy->tp_new(t, a, k);
+static PyObject *__pyx_tp_new_5pysam_4cvcf_VCFRecord(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_5pysam_4cvcf_VCFRecord *p;
+  PyObject *o = __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_new(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_4cvcf_VCFRecord *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_4cvcf_VCFRecord;
+  p = ((struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o);
+  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy*)__pyx_vtabptr_5pysam_4cvcf_VCFRecord;
   p->vcf = Py_None; Py_INCREF(Py_None);
-  if (__pyx_pw_4cvcf_9VCFRecord_3__cinit__(o, a, k) < 0) {
+  if (__pyx_pw_5pysam_4cvcf_9VCFRecord_3__cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_4cvcf_VCFRecord(PyObject *o) {
-  struct __pyx_obj_4cvcf_VCFRecord *p = (struct __pyx_obj_4cvcf_VCFRecord *)o;
-  Py_XDECREF(p->vcf);
-  __pyx_ptype_10TabProxies_TupleProxy->tp_dealloc(o);
+static void __pyx_tp_dealloc_5pysam_4cvcf_VCFRecord(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf_VCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->vcf);
+  PyObject_GC_Track(o);
+  if (likely(__pyx_ptype_5pysam_10TabProxies_TupleProxy)) __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5pysam_4cvcf_VCFRecord);
 }
 
-static int __pyx_tp_traverse_4cvcf_VCFRecord(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_4cvcf_VCFRecord(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_4cvcf_VCFRecord *p = (struct __pyx_obj_4cvcf_VCFRecord *)o;
-  if (__pyx_ptype_10TabProxies_TupleProxy->tp_traverse) {
-    e = __pyx_ptype_10TabProxies_TupleProxy->tp_traverse(o, v, a); if (e) return e;
-  }
+  struct __pyx_obj_5pysam_4cvcf_VCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o;
+  e = ((likely(__pyx_ptype_5pysam_10TabProxies_TupleProxy)) ? ((__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_traverse) ? __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_4cvcf_VCFRecord)); if (e) return e;
   if (p->vcf) {
     e = (*v)(p->vcf, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_4cvcf_VCFRecord(PyObject *o) {
-  struct __pyx_obj_4cvcf_VCFRecord *p = (struct __pyx_obj_4cvcf_VCFRecord *)o;
+static int __pyx_tp_clear_5pysam_4cvcf_VCFRecord(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf_VCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o;
   PyObject* tmp;
-  if (__pyx_ptype_10TabProxies_TupleProxy->tp_clear) {
-    __pyx_ptype_10TabProxies_TupleProxy->tp_clear(o);
-  }
+  if (likely(__pyx_ptype_5pysam_10TabProxies_TupleProxy)) { if (__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_clear) __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_4cvcf_VCFRecord);
   tmp = ((PyObject*)p->vcf);
   p->vcf = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
-static PyObject *__pyx_sq_item_4cvcf_VCFRecord(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_5pysam_4cvcf_VCFRecord(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -22933,62 +23238,62 @@ static PyObject *__pyx_sq_item_4cvcf_VCFRecord(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_contig(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_6contig_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_contig(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_6contig_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_pos(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_3pos_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_pos(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_3pos_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_id(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_2id_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_id(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_2id_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_ref(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_3ref_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_ref(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_3ref_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_alt(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_3alt_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_alt(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_3alt_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_qual(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_4qual_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_qual(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_4qual_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_filter(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_6filter_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_filter(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_6filter_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_info(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_4info_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_info(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_4info_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_format(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_6format_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_format(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_6format_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_4cvcf_9VCFRecord_samples(PyObject *o, void *x) {
-  return __pyx_pw_4cvcf_9VCFRecord_7samples_1__get__(o);
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_samples(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_pw_5pysam_4cvcf_9VCFRecord_7samples_1__get__(o);
 }
 
-static PyMethodDef __pyx_methods_4cvcf_VCFRecord[] = {
-  {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pw_4cvcf_9VCFRecord_5error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_9VCFRecord_4error)},
+static PyMethodDef __pyx_methods_5pysam_4cvcf_VCFRecord[] = {
+  {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pw_5pysam_4cvcf_9VCFRecord_5error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_4cvcf_9VCFRecord_4error)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_4cvcf_VCFRecord[] = {
-  {(char *)"contig", __pyx_getprop_4cvcf_9VCFRecord_contig, 0, 0, 0},
-  {(char *)"pos", __pyx_getprop_4cvcf_9VCFRecord_pos, 0, 0, 0},
-  {(char *)"id", __pyx_getprop_4cvcf_9VCFRecord_id, 0, 0, 0},
-  {(char *)"ref", __pyx_getprop_4cvcf_9VCFRecord_ref, 0, 0, 0},
-  {(char *)"alt", __pyx_getprop_4cvcf_9VCFRecord_alt, 0, 0, 0},
-  {(char *)"qual", __pyx_getprop_4cvcf_9VCFRecord_qual, 0, 0, 0},
-  {(char *)"filter", __pyx_getprop_4cvcf_9VCFRecord_filter, 0, 0, 0},
-  {(char *)"info", __pyx_getprop_4cvcf_9VCFRecord_info, 0, 0, 0},
-  {(char *)"format", __pyx_getprop_4cvcf_9VCFRecord_format, 0, 0, 0},
-  {(char *)"samples", __pyx_getprop_4cvcf_9VCFRecord_samples, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_5pysam_4cvcf_VCFRecord[] = {
+  {(char *)"contig", __pyx_getprop_5pysam_4cvcf_9VCFRecord_contig, 0, 0, 0},
+  {(char *)"pos", __pyx_getprop_5pysam_4cvcf_9VCFRecord_pos, 0, 0, 0},
+  {(char *)"id", __pyx_getprop_5pysam_4cvcf_9VCFRecord_id, 0, 0, 0},
+  {(char *)"ref", __pyx_getprop_5pysam_4cvcf_9VCFRecord_ref, 0, 0, 0},
+  {(char *)"alt", __pyx_getprop_5pysam_4cvcf_9VCFRecord_alt, 0, 0, 0},
+  {(char *)"qual", __pyx_getprop_5pysam_4cvcf_9VCFRecord_qual, 0, 0, 0},
+  {(char *)"filter", __pyx_getprop_5pysam_4cvcf_9VCFRecord_filter, 0, 0, 0},
+  {(char *)"info", __pyx_getprop_5pysam_4cvcf_9VCFRecord_info, 0, 0, 0},
+  {(char *)"format", __pyx_getprop_5pysam_4cvcf_9VCFRecord_format, 0, 0, 0},
+  {(char *)"samples", __pyx_getprop_5pysam_4cvcf_9VCFRecord_samples, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -23051,10 +23356,10 @@ static PyNumberMethods __pyx_tp_as_number_VCFRecord = {
 };
 
 static PySequenceMethods __pyx_tp_as_sequence_VCFRecord = {
-  __pyx_pw_4cvcf_9VCFRecord_7__len__, /*sq_length*/
+  __pyx_pw_5pysam_4cvcf_9VCFRecord_7__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_4cvcf_VCFRecord, /*sq_item*/
+  __pyx_sq_item_5pysam_4cvcf_VCFRecord, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -23064,8 +23369,8 @@ static PySequenceMethods __pyx_tp_as_sequence_VCFRecord = {
 };
 
 static PyMappingMethods __pyx_tp_as_mapping_VCFRecord = {
-  __pyx_pw_4cvcf_9VCFRecord_7__len__, /*mp_length*/
-  __pyx_pw_4cvcf_9VCFRecord_9__getitem__, /*mp_subscript*/
+  __pyx_pw_5pysam_4cvcf_9VCFRecord_7__len__, /*mp_length*/
+  __pyx_pw_5pysam_4cvcf_9VCFRecord_9__getitem__, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
 
@@ -23090,12 +23395,12 @@ static PyBufferProcs __pyx_tp_as_buffer_VCFRecord = {
   #endif
 };
 
-static PyTypeObject __pyx_type_4cvcf_VCFRecord = {
+static PyTypeObject __pyx_type_5pysam_4cvcf_VCFRecord = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("cvcf.VCFRecord"), /*tp_name*/
-  sizeof(struct __pyx_obj_4cvcf_VCFRecord), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.cvcf.VCFRecord"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_4cvcf_VCFRecord), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_4cvcf_VCFRecord, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_4cvcf_VCFRecord, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -23116,23 +23421,23 @@ static PyTypeObject __pyx_type_4cvcf_VCFRecord = {
   &__pyx_tp_as_buffer_VCFRecord, /*tp_as_buffer*/
   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*/
+  __pyx_tp_traverse_5pysam_4cvcf_VCFRecord, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_4cvcf_VCFRecord, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_4cvcf_VCFRecord, /*tp_methods*/
+  __pyx_methods_5pysam_4cvcf_VCFRecord, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_4cvcf_VCFRecord, /*tp_getset*/
+  __pyx_getsets_5pysam_4cvcf_VCFRecord, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_4cvcf_9VCFRecord_1__init__, /*tp_init*/
+  __pyx_pw_5pysam_4cvcf_9VCFRecord_1__init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_4cvcf_VCFRecord, /*tp_new*/
+  __pyx_tp_new_5pysam_4cvcf_VCFRecord, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -23146,46 +23451,44 @@ static PyTypeObject __pyx_type_4cvcf_VCFRecord = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_4cvcf_asVCFRecord(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_4cvcf_asVCFRecord *p;
-  PyObject *o = __pyx_ptype_6ctabix_Parser->tp_new(t, a, k);
+static PyObject *__pyx_tp_new_5pysam_4cvcf_asVCFRecord(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p;
+  PyObject *o = __pyx_ptype_5pysam_6ctabix_Parser->tp_new(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_4cvcf_asVCFRecord *)o);
+  p = ((struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o);
   p->vcffile = Py_None; Py_INCREF(Py_None);
   return o;
 }
 
-static void __pyx_tp_dealloc_4cvcf_asVCFRecord(PyObject *o) {
-  struct __pyx_obj_4cvcf_asVCFRecord *p = (struct __pyx_obj_4cvcf_asVCFRecord *)o;
-  Py_XDECREF(p->vcffile);
-  __pyx_ptype_6ctabix_Parser->tp_dealloc(o);
+static void __pyx_tp_dealloc_5pysam_4cvcf_asVCFRecord(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->vcffile);
+  PyObject_GC_Track(o);
+  if (likely(__pyx_ptype_5pysam_6ctabix_Parser)) __pyx_ptype_5pysam_6ctabix_Parser->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5pysam_4cvcf_asVCFRecord);
 }
 
-static int __pyx_tp_traverse_4cvcf_asVCFRecord(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_4cvcf_asVCFRecord(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_4cvcf_asVCFRecord *p = (struct __pyx_obj_4cvcf_asVCFRecord *)o;
-  if (__pyx_ptype_6ctabix_Parser->tp_traverse) {
-    e = __pyx_ptype_6ctabix_Parser->tp_traverse(o, v, a); if (e) return e;
-  }
+  struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o;
+  e = ((likely(__pyx_ptype_5pysam_6ctabix_Parser)) ? ((__pyx_ptype_5pysam_6ctabix_Parser->tp_traverse) ? __pyx_ptype_5pysam_6ctabix_Parser->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_4cvcf_asVCFRecord)); if (e) return e;
   if (p->vcffile) {
     e = (*v)(p->vcffile, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_4cvcf_asVCFRecord(PyObject *o) {
-  struct __pyx_obj_4cvcf_asVCFRecord *p = (struct __pyx_obj_4cvcf_asVCFRecord *)o;
+static int __pyx_tp_clear_5pysam_4cvcf_asVCFRecord(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o;
   PyObject* tmp;
-  if (__pyx_ptype_6ctabix_Parser->tp_clear) {
-    __pyx_ptype_6ctabix_Parser->tp_clear(o);
-  }
+  if (likely(__pyx_ptype_5pysam_6ctabix_Parser)) { if (__pyx_ptype_5pysam_6ctabix_Parser->tp_clear) __pyx_ptype_5pysam_6ctabix_Parser->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_4cvcf_asVCFRecord);
   tmp = ((PyObject*)p->vcffile);
   p->vcffile = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_4cvcf_asVCFRecord[] = {
+static PyMethodDef __pyx_methods_5pysam_4cvcf_asVCFRecord[] = {
   {0, 0, 0, 0}
 };
 
@@ -23287,12 +23590,12 @@ static PyBufferProcs __pyx_tp_as_buffer_asVCFRecord = {
   #endif
 };
 
-static PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
+static PyTypeObject __pyx_type_5pysam_4cvcf_asVCFRecord = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("cvcf.asVCFRecord"), /*tp_name*/
-  sizeof(struct __pyx_obj_4cvcf_asVCFRecord), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.cvcf.asVCFRecord"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_4cvcf_asVCFRecord), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_4cvcf_asVCFRecord, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_4cvcf_asVCFRecord, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -23306,20 +23609,20 @@ static 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_pw_4cvcf_11asVCFRecord_3__call__, /*tp_call*/
+  __pyx_pw_5pysam_4cvcf_11asVCFRecord_3__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_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*/
+  __pyx_tp_traverse_5pysam_4cvcf_asVCFRecord, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_4cvcf_asVCFRecord, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_4cvcf_asVCFRecord, /*tp_methods*/
+  __pyx_methods_5pysam_4cvcf_asVCFRecord, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -23327,9 +23630,9 @@ static PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_4cvcf_11asVCFRecord_1__init__, /*tp_init*/
+  __pyx_pw_5pysam_4cvcf_11asVCFRecord_1__init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_4cvcf_asVCFRecord, /*tp_new*/
+  __pyx_tp_new_5pysam_4cvcf_asVCFRecord, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -23343,32 +23646,34 @@ static PyTypeObject __pyx_type_4cvcf_asVCFRecord = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_4cvcf___pyx_scope_struct__parse_data(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *p;
+static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct__parse_data(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *)o);
+  p = ((struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)o);
   p->__pyx_v_alt = 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_4cvcf___pyx_scope_struct__parse_data(PyObject *o) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *)o;
-  Py_XDECREF(p->__pyx_v_alt);
+static void __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct__parse_data(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->__pyx_v_alt);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_4cvcf___pyx_scope_struct__parse_data(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_4cvcf___pyx_scope_struct__parse_data(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *)o;
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)o;
   if (p->__pyx_v_alt) {
     e = (*v)(p->__pyx_v_alt, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_4cvcf___pyx_scope_struct__parse_data(PyObject *o) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *)o;
+static int __pyx_tp_clear_5pysam_4cvcf___pyx_scope_struct__parse_data(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->__pyx_v_alt);
   p->__pyx_v_alt = Py_None; Py_INCREF(Py_None);
@@ -23376,7 +23681,7 @@ static int __pyx_tp_clear_4cvcf___pyx_scope_struct__parse_data(PyObject *o) {
   return 0;
 }
 
-static PyMethodDef __pyx_methods_4cvcf___pyx_scope_struct__parse_data[] = {
+static PyMethodDef __pyx_methods_5pysam_4cvcf___pyx_scope_struct__parse_data[] = {
   {0, 0, 0, 0}
 };
 
@@ -23478,12 +23783,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__parse_data = {
   #endif
 };
 
-static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct__parse_data = {
+static PyTypeObject __pyx_type_5pysam_4cvcf___pyx_scope_struct__parse_data = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("cvcf.__pyx_scope_struct__parse_data"), /*tp_name*/
-  sizeof(struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.cvcf.__pyx_scope_struct__parse_data"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_4cvcf___pyx_scope_struct__parse_data, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct__parse_data, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -23504,13 +23809,13 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct__parse_data = {
   &__pyx_tp_as_buffer___pyx_scope_struct__parse_data, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_4cvcf___pyx_scope_struct__parse_data, /*tp_traverse*/
-  __pyx_tp_clear_4cvcf___pyx_scope_struct__parse_data, /*tp_clear*/
+  __pyx_tp_traverse_5pysam_4cvcf___pyx_scope_struct__parse_data, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_4cvcf___pyx_scope_struct__parse_data, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_4cvcf___pyx_scope_struct__parse_data, /*tp_methods*/
+  __pyx_methods_5pysam_4cvcf___pyx_scope_struct__parse_data, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -23520,7 +23825,7 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct__parse_data = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_4cvcf___pyx_scope_struct__parse_data, /*tp_new*/
+  __pyx_tp_new_5pysam_4cvcf___pyx_scope_struct__parse_data, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -23534,28 +23839,30 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct__parse_data = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_4cvcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *p;
+static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *)o);
+  p = ((struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)o);
   p->__pyx_outer_scope = 0;
   p->__pyx_v_allele = 0;
   p->__pyx_t_0 = 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *)o;
-  Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
-  Py_XDECREF(p->__pyx_v_allele);
-  Py_XDECREF(p->__pyx_t_0);
+static void __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->__pyx_outer_scope);
+  Py_CLEAR(p->__pyx_v_allele);
+  Py_CLEAR(p->__pyx_t_0);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *)o;
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)o;
   if (p->__pyx_outer_scope) {
     e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
   }
@@ -23568,11 +23875,11 @@ static int __pyx_tp_traverse_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o, vis
   return 0;
 }
 
-static int __pyx_tp_clear_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr *)o;
+static int __pyx_tp_clear_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->__pyx_outer_scope);
-  p->__pyx_outer_scope = ((struct __pyx_obj_4cvcf___pyx_scope_struct__parse_data *)Py_None); Py_INCREF(Py_None);
+  p->__pyx_outer_scope = ((struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   tmp = ((PyObject*)p->__pyx_v_allele);
   p->__pyx_v_allele = Py_None; Py_INCREF(Py_None);
@@ -23583,7 +23890,7 @@ static int __pyx_tp_clear_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o) {
   return 0;
 }
 
-static PyMethodDef __pyx_methods_4cvcf___pyx_scope_struct_1_genexpr[] = {
+static PyMethodDef __pyx_methods_5pysam_4cvcf___pyx_scope_struct_1_genexpr[] = {
   {0, 0, 0, 0}
 };
 
@@ -23685,12 +23992,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_genexpr = {
   #endif
 };
 
-static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_1_genexpr = {
+static PyTypeObject __pyx_type_5pysam_4cvcf___pyx_scope_struct_1_genexpr = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("cvcf.__pyx_scope_struct_1_genexpr"), /*tp_name*/
-  sizeof(struct __pyx_obj_4cvcf___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.cvcf.__pyx_scope_struct_1_genexpr"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_4cvcf___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -23711,13 +24018,13 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_1_genexpr = {
   &__pyx_tp_as_buffer___pyx_scope_struct_1_genexpr, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_4cvcf___pyx_scope_struct_1_genexpr, /*tp_traverse*/
-  __pyx_tp_clear_4cvcf___pyx_scope_struct_1_genexpr, /*tp_clear*/
+  __pyx_tp_traverse_5pysam_4cvcf___pyx_scope_struct_1_genexpr, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_4cvcf___pyx_scope_struct_1_genexpr, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_4cvcf___pyx_scope_struct_1_genexpr, /*tp_methods*/
+  __pyx_methods_5pysam_4cvcf___pyx_scope_struct_1_genexpr, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -23727,7 +24034,7 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_1_genexpr = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_4cvcf___pyx_scope_struct_1_genexpr, /*tp_new*/
+  __pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_1_genexpr, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -23741,11 +24048,11 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_1_genexpr = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_4cvcf___pyx_scope_struct_2__parse(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *p;
+static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_2__parse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *)o);
+  p = ((struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)o);
   p->__pyx_v_d = 0;
   p->__pyx_v_line = 0;
   p->__pyx_v_self = 0;
@@ -23754,19 +24061,21 @@ static PyObject *__pyx_tp_new_4cvcf___pyx_scope_struct_2__parse(PyTypeObject *t,
   return o;
 }
 
-static void __pyx_tp_dealloc_4cvcf___pyx_scope_struct_2__parse(PyObject *o) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *)o;
-  Py_XDECREF(p->__pyx_v_d);
-  Py_XDECREF(p->__pyx_v_line);
-  Py_XDECREF(p->__pyx_v_self);
-  Py_XDECREF(p->__pyx_v_stream);
-  Py_XDECREF(p->__pyx_t_1);
+static void __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct_2__parse(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->__pyx_v_d);
+  Py_CLEAR(p->__pyx_v_line);
+  Py_CLEAR(p->__pyx_v_self);
+  Py_CLEAR(p->__pyx_v_stream);
+  Py_CLEAR(p->__pyx_t_1);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_4cvcf___pyx_scope_struct_2__parse(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_5pysam_4cvcf___pyx_scope_struct_2__parse(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *)o;
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)o;
   if (p->__pyx_v_d) {
     e = (*v)(p->__pyx_v_d, a); if (e) return e;
   }
@@ -23785,8 +24094,8 @@ static int __pyx_tp_traverse_4cvcf___pyx_scope_struct_2__parse(PyObject *o, visi
   return 0;
 }
 
-static int __pyx_tp_clear_4cvcf___pyx_scope_struct_2__parse(PyObject *o) {
-  struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse *)o;
+static int __pyx_tp_clear_5pysam_4cvcf___pyx_scope_struct_2__parse(PyObject *o) {
+  struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->__pyx_v_d);
   p->__pyx_v_d = Py_None; Py_INCREF(Py_None);
@@ -23806,7 +24115,7 @@ static int __pyx_tp_clear_4cvcf___pyx_scope_struct_2__parse(PyObject *o) {
   return 0;
 }
 
-static PyMethodDef __pyx_methods_4cvcf___pyx_scope_struct_2__parse[] = {
+static PyMethodDef __pyx_methods_5pysam_4cvcf___pyx_scope_struct_2__parse[] = {
   {0, 0, 0, 0}
 };
 
@@ -23908,12 +24217,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2__parse = {
   #endif
 };
 
-static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_2__parse = {
+static PyTypeObject __pyx_type_5pysam_4cvcf___pyx_scope_struct_2__parse = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("cvcf.__pyx_scope_struct_2__parse"), /*tp_name*/
-  sizeof(struct __pyx_obj_4cvcf___pyx_scope_struct_2__parse), /*tp_basicsize*/
+  __Pyx_NAMESTR("pysam.cvcf.__pyx_scope_struct_2__parse"), /*tp_name*/
+  sizeof(struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_4cvcf___pyx_scope_struct_2__parse, /*tp_dealloc*/
+  __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct_2__parse, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -23934,13 +24243,13 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_2__parse = {
   &__pyx_tp_as_buffer___pyx_scope_struct_2__parse, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_4cvcf___pyx_scope_struct_2__parse, /*tp_traverse*/
-  __pyx_tp_clear_4cvcf___pyx_scope_struct_2__parse, /*tp_clear*/
+  __pyx_tp_traverse_5pysam_4cvcf___pyx_scope_struct_2__parse, /*tp_traverse*/
+  __pyx_tp_clear_5pysam_4cvcf___pyx_scope_struct_2__parse, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_4cvcf___pyx_scope_struct_2__parse, /*tp_methods*/
+  __pyx_methods_5pysam_4cvcf___pyx_scope_struct_2__parse, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -23950,7 +24259,7 @@ static PyTypeObject __pyx_type_4cvcf___pyx_scope_struct_2__parse = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_4cvcf___pyx_scope_struct_2__parse, /*tp_new*/
+  __pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_2__parse, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -24002,8 +24311,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__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_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0},
-  {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0},
-  {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0},
+  {&__pyx_n_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 1},
+  {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 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},
@@ -24038,6 +24347,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_170, __pyx_k_170, sizeof(__pyx_k_170), 0, 0, 1, 0},
   {&__pyx_kp_s_171, __pyx_k_171, sizeof(__pyx_k_171), 0, 0, 1, 0},
   {&__pyx_kp_s_172, __pyx_k_172, sizeof(__pyx_k_172), 0, 0, 1, 0},
+  {&__pyx_kp_s_173, __pyx_k_173, sizeof(__pyx_k_173), 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},
@@ -24219,7 +24529,6 @@ 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__d, __pyx_k__d, sizeof(__pyx_k__d), 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},
@@ -24401,7 +24710,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "cvcf.pyx":70
+  /* "pysam/cvcf.pyx":70
  * def parse_regions( string ):
  *     result = []
  *     for r in string.split(','):             # <<<<<<<<<<<<<<
@@ -24415,7 +24724,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
 
-  /* "cvcf.pyx":71
+  /* "pysam/cvcf.pyx":71
  *     result = []
  *     for r in string.split(','):
  *         elts = r.split(':')             # <<<<<<<<<<<<<<
@@ -24429,7 +24738,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 
-  /* "cvcf.pyx":76
+  /* "pysam/cvcf.pyx":76
  *         elif len(elts)==2:
  *             if len(elts[1])>0:
  *                 ielts = elts[1].split('-')             # <<<<<<<<<<<<<<
@@ -24443,7 +24752,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
 
-  /* "cvcf.pyx":157
+  /* "pysam/cvcf.pyx":157
  *             alt = self.fields[4]
  *             if alt == ".": alt = []
  *             else: alt = alt.upper().split(',')             # <<<<<<<<<<<<<<
@@ -24457,7 +24766,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
-  /* "cvcf.pyx":173
+  /* "pysam/cvcf.pyx":173
  *             # 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(';')             # <<<<<<<<<<<<<<
@@ -24471,7 +24780,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
-  /* "cvcf.pyx":181
+  /* "pysam/cvcf.pyx":181
  *             info = {}
  *             if col != b".":
  *                 for blurp in col.split(';'):             # <<<<<<<<<<<<<<
@@ -24485,7 +24794,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
 
-  /* "cvcf.pyx":182
+  /* "pysam/cvcf.pyx":182
  *             if col != b".":
  *                 for blurp in col.split(';'):
  *                     elts = blurp.split('=')             # <<<<<<<<<<<<<<
@@ -24499,7 +24808,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
 
-  /* "cvcf.pyx":191
+  /* "pysam/cvcf.pyx":191
  *     property format:
  *          def __get__(self):
  *              return self.fields[8].split(':')             # <<<<<<<<<<<<<<
@@ -24513,7 +24822,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
-  /* "cvcf.pyx":200
+  /* "pysam/cvcf.pyx":200
  * 
  *         # parse sample columns
  *         values = self.fields[self.vcf._sample2column[key]].split(':')             # <<<<<<<<<<<<<<
@@ -24527,7 +24836,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
-  /* "cvcf.pyx":316
+  /* "pysam/cvcf.pyx":316
  *     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             # <<<<<<<<<<<<<<
@@ -24541,7 +24850,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
 
-  /* "cvcf.pyx":337
+  /* "pysam/cvcf.pyx":337
  *     def error(self,line,error,opt=None):
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')             # <<<<<<<<<<<<<<
@@ -24555,7 +24864,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
-  /* "cvcf.pyx":346
+  /* "pysam/cvcf.pyx":346
  *     def parse_format(self,line,format,filter=False):
  *         if self._version == 40:
  *             if not format.startswith('<'):             # <<<<<<<<<<<<<<
@@ -24569,7 +24878,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
-  /* "cvcf.pyx":349
+  /* "pysam/cvcf.pyx":349
  *                 self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
  *                 format = "<"+format
  *             if not format.endswith('>'):             # <<<<<<<<<<<<<<
@@ -24583,7 +24892,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
-  /* "cvcf.pyx":356
+  /* "pysam/cvcf.pyx":356
  *         idx = 0
  *         while len(format.strip())>0:
  *             elts = format.strip().split(',')             # <<<<<<<<<<<<<<
@@ -24597,7 +24906,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
-  /* "cvcf.pyx":358
+  /* "pysam/cvcf.pyx":358
  *             elts = format.strip().split(',')
  *             first, rest = elts[0], ','.join(elts[1:])
  *             if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):             # <<<<<<<<<<<<<<
@@ -24629,7 +24938,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
 
-  /* "cvcf.pyx":362
+  /* "pysam/cvcf.pyx":362
  *                 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]             # <<<<<<<<<<<<<<
@@ -24649,7 +24958,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
 
-  /* "cvcf.pyx":363
+  /* "pysam/cvcf.pyx":363
  *                 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]             # <<<<<<<<<<<<<<
@@ -24669,7 +24978,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
 
-  /* "cvcf.pyx":364
+  /* "pysam/cvcf.pyx":364
  *             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]             # <<<<<<<<<<<<<<
@@ -24689,7 +24998,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
 
-  /* "cvcf.pyx":365
+  /* "pysam/cvcf.pyx":365
  *             elif first.startswith('Number='):      data['number'] = first.split('=')[1]
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):             # <<<<<<<<<<<<<<
@@ -24703,7 +25012,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
 
-  /* "cvcf.pyx":366
+  /* "pysam/cvcf.pyx":366
  *             elif first.startswith('Type='):        data['type'] = first.split('=')[1]
  *             elif first.startswith('Description='):
  *                 elts = format.split('"')             # <<<<<<<<<<<<<<
@@ -24717,7 +25026,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
 
-  /* "cvcf.pyx":369
+  /* "pysam/cvcf.pyx":369
  *                 if len(elts)<3:
  *                     self.error(line,self.FORMAT_MISSING_QUOTES)
  *                     elts = first.split('=') + [rest]             # <<<<<<<<<<<<<<
@@ -24731,7 +25040,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
 
-  /* "cvcf.pyx":372
+  /* "pysam/cvcf.pyx":372
  *                 data['descr'] = elts[1]
  *                 rest = '"'.join(elts[2:])
  *                 if rest.startswith(','): rest = rest[1:]             # <<<<<<<<<<<<<<
@@ -24745,7 +25054,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
-  /* "cvcf.pyx":492
+  /* "pysam/cvcf.pyx":492
  *         # snip off trailing missing data
  *         while len(output) > 1:
  *             last = output[-1].replace(',','').replace('.','')             # <<<<<<<<<<<<<<
@@ -24771,7 +25080,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
 
-  /* "cvcf.pyx":518
+  /* "pysam/cvcf.pyx":518
  * 
  *     def parse_header( self, line ):
  *         assert line.startswith('##')             # <<<<<<<<<<<<<<
@@ -24785,7 +25094,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
 
-  /* "cvcf.pyx":519
+  /* "pysam/cvcf.pyx":519
  *     def parse_header( self, line ):
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')             # <<<<<<<<<<<<<<
@@ -24799,7 +25108,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
 
-  /* "cvcf.pyx":554
+  /* "pysam/cvcf.pyx":554
  * 
  *     def parse_heading( self, line ):
  *         assert line.startswith('#')             # <<<<<<<<<<<<<<
@@ -24813,7 +25122,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
 
-  /* "cvcf.pyx":555
+  /* "pysam/cvcf.pyx":555
  *     def parse_heading( self, line ):
  *         assert line.startswith('#')
  *         assert not line.startswith('##')             # <<<<<<<<<<<<<<
@@ -24827,7 +25136,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
 
-  /* "cvcf.pyx":556
+  /* "pysam/cvcf.pyx":556
  *         assert line.startswith('#')
  *         assert not line.startswith('##')
  *         headings = line[1:].split('\t')             # <<<<<<<<<<<<<<
@@ -24841,7 +25150,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_88));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));
 
-  /* "cvcf.pyx":608
+  /* "pysam/cvcf.pyx":608
  *             if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
  *             return []
  *         values = value.split(',')             # <<<<<<<<<<<<<<
@@ -24855,7 +25164,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));
 
-  /* "cvcf.pyx":610
+  /* "pysam/cvcf.pyx":610
  *         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:             # <<<<<<<<<<<<<<
@@ -24869,7 +25178,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98));
 
-  /* "cvcf.pyx":612
+  /* "pysam/cvcf.pyx":612
  *         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]             # <<<<<<<<<<<<<<
@@ -24883,7 +25192,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));
 
-  /* "cvcf.pyx":648
+  /* "pysam/cvcf.pyx":648
  * 
  *     def parse_data( self, line, lineparse=False ):
  *         cols = line.split('\t')             # <<<<<<<<<<<<<<
@@ -24897,7 +25206,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_88));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));
 
-  /* "cvcf.pyx":694
+  /* "pysam/cvcf.pyx":694
  *         # convert v3.3 to v4.0 alleles below
  *         if cols[4] == ".": alt = []
  *         else: alt = cols[4].upper().split(',')             # <<<<<<<<<<<<<<
@@ -24911,7 +25220,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));
 
-  /* "cvcf.pyx":703
+  /* "pysam/cvcf.pyx":703
  *         # 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(';')             # <<<<<<<<<<<<<<
@@ -24925,7 +25234,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));
 
-  /* "cvcf.pyx":708
+  /* "pysam/cvcf.pyx":708
  *         info = {}
  *         if cols[7] != ".":
  *             for blurp in cols[7].split(';'):             # <<<<<<<<<<<<<<
@@ -24939,7 +25248,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));
 
-  /* "cvcf.pyx":709
+  /* "pysam/cvcf.pyx":709
  *         if cols[7] != ".":
  *             for blurp in cols[7].split(';'):
  *                 elts = blurp.split('=')             # <<<<<<<<<<<<<<
@@ -24953,7 +25262,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));
 
-  /* "cvcf.pyx":720
+  /* "pysam/cvcf.pyx":720
  *         # Gracefully deal with absent FORMAT column
  *         if cols[8] == "": format = []
  *         else: format = cols[8].split(':')             # <<<<<<<<<<<<<<
@@ -24967,7 +25276,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));
 
-  /* "cvcf.pyx":738
+  /* "pysam/cvcf.pyx":738
  *             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             # <<<<<<<<<<<<<<
@@ -24981,7 +25290,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112));
 
-  /* "cvcf.pyx":739
+  /* "pysam/cvcf.pyx":739
  *                 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>             # <<<<<<<<<<<<<<
@@ -24995,7 +25304,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113));
 
-  /* "cvcf.pyx":820
+  /* "pysam/cvcf.pyx":820
  *         for sample in cols[9:]:
  *             dict = {}
  *             values = sample.split(':')             # <<<<<<<<<<<<<<
@@ -25009,7 +25318,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
 
-  /* "cvcf.pyx":890
+  /* "pysam/cvcf.pyx":890
  *         for line in stream:
  *             self._lineno += 1
  *             if line.startswith('##'):             # <<<<<<<<<<<<<<
@@ -25023,7 +25332,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_119));
 
-  /* "cvcf.pyx":892
+  /* "pysam/cvcf.pyx":892
  *             if line.startswith('##'):
  *                 self.parse_header( line.strip() )
  *             elif line.startswith('#'):             # <<<<<<<<<<<<<<
@@ -25037,7 +25346,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
 
-  /* "cvcf.pyx":901
+  /* "pysam/cvcf.pyx":901
  *     def _parse(self, line, stream):
  *         # deal with files with header only
  *         if line.startswith("##"): return             # <<<<<<<<<<<<<<
@@ -25051,7 +25360,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
 
-  /* "cvcf.pyx":958
+  /* "pysam/cvcf.pyx":958
  * 
  *     def setversion(self, version):
  *         if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files")             # <<<<<<<<<<<<<<
@@ -25065,7 +25374,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_123));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));
 
-  /* "cvcf.pyx":1036
+  /* "pysam/cvcf.pyx":1036
  *         '''
  * 
  *         raise NotImplementedError( "needs to be checked" )             # <<<<<<<<<<<<<<
@@ -25079,7 +25388,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127));
 
-  /* "cvcf.pyx":54
+  /* "pysam/cvcf.pyx":54
  * import pysam
  * 
  * gtsRegEx = re.compile("[|/\\\\]")             # <<<<<<<<<<<<<<
@@ -25093,7 +25402,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));
 
-  /* "cvcf.pyx":55
+  /* "pysam/cvcf.pyx":55
  * 
  * gtsRegEx = re.compile("[|/\\\\]")
  * alleleRegEx = re.compile('^[ACGTN]+$')             # <<<<<<<<<<<<<<
@@ -25107,7 +25416,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131));
 
-  /* "cvcf.pyx":58
+  /* "pysam/cvcf.pyx":58
  * 
  * # Utility function.  Uses 0-based coordinates
  * def get_sequence(chrom, start, end, fa):             # <<<<<<<<<<<<<<
@@ -25134,1216 +25443,1216 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_132));
   __pyx_k_codeobj_133 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__get_sequence, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":68
+  /* "pysam/cvcf.pyx":68
  * 
  * # Utility function.  Parses a region string
  * def parse_regions( string ):             # <<<<<<<<<<<<<<
  *     result = []
  *     for r in string.split(','):
  */
-  __pyx_k_tuple_135 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_135);
+  __pyx_k_tuple_136 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_136);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__string));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 0, ((PyObject *)__pyx_n_s__string));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 0, ((PyObject *)__pyx_n_s__string));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__string));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 1, ((PyObject *)__pyx_n_s__result));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 1, ((PyObject *)__pyx_n_s__result));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 2, ((PyObject *)__pyx_n_s__r));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 2, ((PyObject *)__pyx_n_s__r));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__elts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 3, ((PyObject *)__pyx_n_s__elts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 3, ((PyObject *)__pyx_n_s__elts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__elts));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__chrom));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 4, ((PyObject *)__pyx_n_s__chrom));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 4, ((PyObject *)__pyx_n_s__chrom));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chrom));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 5, ((PyObject *)__pyx_n_s__start));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 5, ((PyObject *)__pyx_n_s__start));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__end));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 6, ((PyObject *)__pyx_n_s__end));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 6, ((PyObject *)__pyx_n_s__end));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ielts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_135, 7, ((PyObject *)__pyx_n_s__ielts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_136, 7, ((PyObject *)__pyx_n_s__ielts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ielts));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135));
-  __pyx_k_codeobj_136 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_regions, 68, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136));
+  __pyx_k_codeobj_137 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_regions, 68, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":86
+  /* "pysam/cvcf.pyx":86
  * 
  * 
  * FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue')             # <<<<<<<<<<<<<<
  * 
  * ###########################################################################################################
  */
-  __pyx_k_tuple_138 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_138);
+  __pyx_k_tuple_139 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_139);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 0, ((PyObject *)__pyx_n_s__FORMAT));
+  PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_n_s__FORMAT));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT));
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_137));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 1, ((PyObject *)__pyx_kp_s_137));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_137));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_138));
+  PyTuple_SET_ITEM(__pyx_k_tuple_139, 1, ((PyObject *)__pyx_kp_s_138));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139));
 
-  /* "cvcf.pyx":314
+  /* "pysam/cvcf.pyx":314
  *     _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_k_tuple_173 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_173)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_173);
+  __pyx_k_tuple_174 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_174);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s___copy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 1, ((PyObject *)__pyx_n_s___copy));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 1, ((PyObject *)__pyx_n_s___copy));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s___copy));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__reference));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 2, ((PyObject *)__pyx_n_s__reference));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 2, ((PyObject *)__pyx_n_s__reference));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__reference));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__regions));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 3, ((PyObject *)__pyx_n_s__regions));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 3, ((PyObject *)__pyx_n_s__regions));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__regions));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__lines));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 4, ((PyObject *)__pyx_n_s__lines));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 4, ((PyObject *)__pyx_n_s__lines));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lines));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__leftalign));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 5, ((PyObject *)__pyx_n_s__leftalign));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 5, ((PyObject *)__pyx_n_s__leftalign));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__leftalign));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__id));
-  PyTuple_SET_ITEM(__pyx_k_tuple_173, 6, ((PyObject *)__pyx_n_s__id));
+  PyTuple_SET_ITEM(__pyx_k_tuple_174, 6, ((PyObject *)__pyx_n_s__id));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_173));
-  __pyx_k_codeobj_174 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s____init__, 314, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174));
+  __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s____init__, 314, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":335
+  /* "pysam/cvcf.pyx":335
  *         self._lines = lines
  * 
  *     def error(self,line,error,opt=None):             # <<<<<<<<<<<<<<
  *         if error in self._ignored_errors: return
  *         errorlabel, errorstring = self._errors[error].split(':')
  */
-  __pyx_k_tuple_175 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_175);
+  __pyx_k_tuple_176 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_176)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_176);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 1, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 1, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__error));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 2, ((PyObject *)__pyx_n_s__error));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 2, ((PyObject *)__pyx_n_s__error));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__error));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__opt));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 3, ((PyObject *)__pyx_n_s__opt));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 3, ((PyObject *)__pyx_n_s__opt));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__opt));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__errorlabel));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 4, ((PyObject *)__pyx_n_s__errorlabel));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 4, ((PyObject *)__pyx_n_s__errorlabel));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__errorlabel));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__errorstring));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 5, ((PyObject *)__pyx_n_s__errorstring));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 5, ((PyObject *)__pyx_n_s__errorstring));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__errorstring));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__errwarn));
-  PyTuple_SET_ITEM(__pyx_k_tuple_175, 6, ((PyObject *)__pyx_n_s__errwarn));
+  PyTuple_SET_ITEM(__pyx_k_tuple_176, 6, ((PyObject *)__pyx_n_s__errwarn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__errwarn));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_175));
-  __pyx_k_codeobj_176 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_175, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__error, 335, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_176)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_177 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_177);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_176));
+  __pyx_k_codeobj_177 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__error, 335, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_177)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_178 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_178)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_178);
   __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_k_tuple_177, 0, ((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_k_tuple_178, 0, ((PyObject *)Py_None));
   __Pyx_GIVEREF(((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_178));
 
-  /* "cvcf.pyx":344
+  /* "pysam/cvcf.pyx":344
  *         raise ValueError(errorstring)
  * 
  *     def parse_format(self,line,format,filter=False):             # <<<<<<<<<<<<<<
  *         if self._version == 40:
  *             if not format.startswith('<'):
  */
-  __pyx_k_tuple_178 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_178)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_178);
+  __pyx_k_tuple_179 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_179);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 1, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 1, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 2, ((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 2, ((PyObject *)__pyx_n_s__format));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filter));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 3, ((PyObject *)__pyx_n_s__filter));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 3, ((PyObject *)__pyx_n_s__filter));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filter));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 4, ((PyObject *)__pyx_n_s__data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 4, ((PyObject *)__pyx_n_s__data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 5, ((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 5, ((PyObject *)__pyx_n_s__idx));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__elts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 6, ((PyObject *)__pyx_n_s__elts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 6, ((PyObject *)__pyx_n_s__elts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__elts));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__first));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 7, ((PyObject *)__pyx_n_s__first));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 7, ((PyObject *)__pyx_n_s__first));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__first));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__rest));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 8, ((PyObject *)__pyx_n_s__rest));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 8, ((PyObject *)__pyx_n_s__rest));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rest));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 9, ((PyObject *)__pyx_n_s__n));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 9, ((PyObject *)__pyx_n_s__n));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__t));
-  PyTuple_SET_ITEM(__pyx_k_tuple_178, 10, ((PyObject *)__pyx_n_s__t));
+  PyTuple_SET_ITEM(__pyx_k_tuple_179, 10, ((PyObject *)__pyx_n_s__t));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_178));
-  __pyx_k_codeobj_179 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_format, 344, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_179)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179));
+  __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_format, 344, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":416
+  /* "pysam/cvcf.pyx":416
  *         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:
  */
-  __pyx_k_tuple_180 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_180)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_180);
+  __pyx_k_tuple_181 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_181);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fmt));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 1, ((PyObject *)__pyx_n_s__fmt));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 1, ((PyObject *)__pyx_n_s__fmt));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fmt));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filter));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 2, ((PyObject *)__pyx_n_s__filter));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 2, ((PyObject *)__pyx_n_s__filter));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filter));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 3, ((PyObject *)__pyx_n_s__values));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 3, ((PyObject *)__pyx_n_s__values));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__nmb));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 4, ((PyObject *)__pyx_n_s__nmb));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 4, ((PyObject *)__pyx_n_s__nmb));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nmb));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 5, ((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 5, ((PyObject *)__pyx_n_s__format));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 6, ((PyObject *)__pyx_n_s__k));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 6, ((PyObject *)__pyx_n_s__k));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
-  PyTuple_SET_ITEM(__pyx_k_tuple_180, 7, ((PyObject *)__pyx_n_s__v));
+  PyTuple_SET_ITEM(__pyx_k_tuple_181, 7, ((PyObject *)__pyx_n_s__v));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_180));
-  __pyx_k_codeobj_181 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__format_format, 416, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_181)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181));
+  __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__format_format, 416, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":436
+  /* "pysam/cvcf.pyx":436
  *         return format
  * 
  *     def get_expected(self, format, formatdict, alt):             # <<<<<<<<<<<<<<
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  */
-  __pyx_k_tuple_182 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_182)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_182);
+  __pyx_k_tuple_183 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_183)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_183);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_182, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_183, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
-  PyTuple_SET_ITEM(__pyx_k_tuple_182, 1, ((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_183, 1, ((PyObject *)__pyx_n_s__format));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__formatdict));
-  PyTuple_SET_ITEM(__pyx_k_tuple_182, 2, ((PyObject *)__pyx_n_s__formatdict));
+  PyTuple_SET_ITEM(__pyx_k_tuple_183, 2, ((PyObject *)__pyx_n_s__formatdict));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__formatdict));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__alt));
-  PyTuple_SET_ITEM(__pyx_k_tuple_182, 3, ((PyObject *)__pyx_n_s__alt));
+  PyTuple_SET_ITEM(__pyx_k_tuple_183, 3, ((PyObject *)__pyx_n_s__alt));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alt));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fmt));
-  PyTuple_SET_ITEM(__pyx_k_tuple_182, 4, ((PyObject *)__pyx_n_s__fmt));
+  PyTuple_SET_ITEM(__pyx_k_tuple_183, 4, ((PyObject *)__pyx_n_s__fmt));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fmt));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_182));
-  __pyx_k_codeobj_183 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__get_expected, 436, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_183)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_183));
+  __pyx_k_codeobj_184 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_183, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__get_expected, 436, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":447
+  /* "pysam/cvcf.pyx":447
  * 
  * 
  *     def _add_definition(self, formatdict, key, data, line ):             # <<<<<<<<<<<<<<
  *         if key in formatdict: return
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  */
-  __pyx_k_tuple_184 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_184);
+  __pyx_k_tuple_185 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_185)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_185);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_184, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_185, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__formatdict));
-  PyTuple_SET_ITEM(__pyx_k_tuple_184, 1, ((PyObject *)__pyx_n_s__formatdict));
+  PyTuple_SET_ITEM(__pyx_k_tuple_185, 1, ((PyObject *)__pyx_n_s__formatdict));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__formatdict));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
-  PyTuple_SET_ITEM(__pyx_k_tuple_184, 2, ((PyObject *)__pyx_n_s__key));
+  PyTuple_SET_ITEM(__pyx_k_tuple_185, 2, ((PyObject *)__pyx_n_s__key));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_184, 3, ((PyObject *)__pyx_n_s__data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_185, 3, ((PyObject *)__pyx_n_s__data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_184, 4, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_185, 4, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_184));
-  __pyx_k_codeobj_185 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s___add_definition, 447, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_185)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_185));
+  __pyx_k_codeobj_186 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_185, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s___add_definition, 447, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_186)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":464
+  /* "pysam/cvcf.pyx":464
  * 
  *     # 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_k_tuple_186 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_186)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_186);
+  __pyx_k_tuple_187 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_187)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_187);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 1, ((PyObject *)__pyx_n_s__data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 1, ((PyObject *)__pyx_n_s__data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 2, ((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 2, ((PyObject *)__pyx_n_s__format));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 3, ((PyObject *)__pyx_n_s__key));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 3, ((PyObject *)__pyx_n_s__key));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__value));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 4, ((PyObject *)__pyx_n_s__value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 4, ((PyObject *)__pyx_n_s__value));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__separator));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 5, ((PyObject *)__pyx_n_s__separator));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 5, ((PyObject *)__pyx_n_s__separator));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__separator));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 6, ((PyObject *)__pyx_n_s__output));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 6, ((PyObject *)__pyx_n_s__output));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__sdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 7, ((PyObject *)__pyx_n_s__sdata));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 7, ((PyObject *)__pyx_n_s__sdata));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sdata));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 8, ((PyObject *)__pyx_n_s__d));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 8, ((PyObject *)__pyx_n_s__d));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 9, ((PyObject *)__pyx_n_s__k));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 9, ((PyObject *)__pyx_n_s__k));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 10, ((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 10, ((PyObject *)__pyx_n_s__idx));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 11, ((PyObject *)__pyx_n_s__v));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 11, ((PyObject *)__pyx_n_s__v));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__last));
-  PyTuple_SET_ITEM(__pyx_k_tuple_186, 12, ((PyObject *)__pyx_n_s__last));
+  PyTuple_SET_ITEM(__pyx_k_tuple_187, 12, ((PyObject *)__pyx_n_s__last));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_186));
-  __pyx_k_codeobj_187 = (PyObject*)__Pyx_PyCode_New(6, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__format_formatdata, 464, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_187)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_187));
+  __pyx_k_codeobj_188 = (PyObject*)__Pyx_PyCode_New(6, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_187, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__format_formatdata, 464, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_188)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":498
+  /* "pysam/cvcf.pyx":498
  * 
  * 
  *     def enter_default_format(self):             # <<<<<<<<<<<<<<
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  */
-  __pyx_k_tuple_188 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_188)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_188);
+  __pyx_k_tuple_189 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_189)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_189);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_188, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_189, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_188, 1, ((PyObject *)__pyx_n_s__f));
+  PyTuple_SET_ITEM(__pyx_k_tuple_189, 1, ((PyObject *)__pyx_n_s__f));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_188));
-  __pyx_k_codeobj_189 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s_121, 498, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_189)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_189));
+  __pyx_k_codeobj_190 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_189, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s_121, 498, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_190)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":517
+  /* "pysam/cvcf.pyx":517
  *                 self._format[f.id] = f
  * 
  *     def parse_header( self, line ):             # <<<<<<<<<<<<<<
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')
  */
-  __pyx_k_tuple_190 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_190)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_190);
+  __pyx_k_tuple_191 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_191)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_191);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_190, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_191, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_190, 1, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_191, 1, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__elts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_190, 2, ((PyObject *)__pyx_n_s__elts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_191, 2, ((PyObject *)__pyx_n_s__elts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__elts));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
-  PyTuple_SET_ITEM(__pyx_k_tuple_190, 3, ((PyObject *)__pyx_n_s__key));
+  PyTuple_SET_ITEM(__pyx_k_tuple_191, 3, ((PyObject *)__pyx_n_s__key));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__value));
-  PyTuple_SET_ITEM(__pyx_k_tuple_190, 4, ((PyObject *)__pyx_n_s__value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_191, 4, ((PyObject *)__pyx_n_s__value));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_190, 5, ((PyObject *)__pyx_n_s__f));
+  PyTuple_SET_ITEM(__pyx_k_tuple_191, 5, ((PyObject *)__pyx_n_s__f));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_190));
-  __pyx_k_codeobj_191 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_header, 517, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_191)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_191));
+  __pyx_k_codeobj_192 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_191, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_header, 517, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_192)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":546
+  /* "pysam/cvcf.pyx":546
  * 
  * 
  *     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_k_tuple_192 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_192)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_192);
+  __pyx_k_tuple_193 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_193)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_193);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 2, ((PyObject *)__pyx_n_s__key));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 2, ((PyObject *)__pyx_n_s__key));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__value));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 3, ((PyObject *)__pyx_n_s__value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 3, ((PyObject *)__pyx_n_s__value));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__var));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 4, ((PyObject *)__pyx_n_s__var));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 4, ((PyObject *)__pyx_n_s__var));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__var));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__label));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 5, ((PyObject *)__pyx_n_s__label));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 5, ((PyObject *)__pyx_n_s__label));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_192, 6, ((PyObject *)__pyx_n_s__f));
+  PyTuple_SET_ITEM(__pyx_k_tuple_193, 6, ((PyObject *)__pyx_n_s__f));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_192));
-  __pyx_k_codeobj_193 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write_header, 546, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_193)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_193));
+  __pyx_k_codeobj_194 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_193, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write_header, 546, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_194)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":553
+  /* "pysam/cvcf.pyx":553
  * 
  * 
  *     def parse_heading( self, line ):             # <<<<<<<<<<<<<<
  *         assert line.startswith('#')
  *         assert not line.startswith('##')
  */
-  __pyx_k_tuple_194 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_194)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_194);
+  __pyx_k_tuple_195 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_195)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_195);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 1, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 1, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__headings));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 2, ((PyObject *)__pyx_n_s__headings));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 2, ((PyObject *)__pyx_n_s__headings));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__headings));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 3, ((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 3, ((PyObject *)__pyx_n_s__i));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 4, ((PyObject *)__pyx_n_s__s));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 4, ((PyObject *)__pyx_n_s__s));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__err));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 5, ((PyObject *)__pyx_n_s__err));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 5, ((PyObject *)__pyx_n_s__err));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__err));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 6, ((PyObject *)__pyx_n_s__x));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 6, ((PyObject *)__pyx_n_s__x));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
-  PyTuple_SET_ITEM(__pyx_k_tuple_194, 7, ((PyObject *)__pyx_n_s__y));
+  PyTuple_SET_ITEM(__pyx_k_tuple_195, 7, ((PyObject *)__pyx_n_s__y));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_194));
-  __pyx_k_codeobj_195 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_heading, 553, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_195)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_195));
+  __pyx_k_codeobj_196 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_195, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_heading, 553, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_196)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":581
+  /* "pysam/cvcf.pyx":581
  *         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_k_tuple_196 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_196)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_196);
+  __pyx_k_tuple_197 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_197)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_197);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_196, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_197, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_196, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_197, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_196));
-  __pyx_k_codeobj_197 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write_heading, 581, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_197)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_197));
+  __pyx_k_codeobj_198 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_197, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write_heading, 581, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_198)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":584
+  /* "pysam/cvcf.pyx":584
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")
  * 
  *     def convertGT(self, GTstring):             # <<<<<<<<<<<<<<
  *         if GTstring == ".": return ["."]
  *         try:
  */
-  __pyx_k_tuple_198 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_198)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_198);
+  __pyx_k_tuple_199 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_199)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_199);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_198, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_199, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__GTstring));
-  PyTuple_SET_ITEM(__pyx_k_tuple_198, 1, ((PyObject *)__pyx_n_s__GTstring));
+  PyTuple_SET_ITEM(__pyx_k_tuple_199, 1, ((PyObject *)__pyx_n_s__GTstring));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GTstring));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__gts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_198, 2, ((PyObject *)__pyx_n_s__gts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_199, 2, ((PyObject *)__pyx_n_s__gts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gts));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_198));
-  __pyx_k_codeobj_199 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__convertGT, 584, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_199)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_199));
+  __pyx_k_codeobj_200 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_199, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__convertGT, 584, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":596
+  /* "pysam/cvcf.pyx":596
  *             return [".","|","."]
  * 
  *     def convertGTback(self, GTdata):             # <<<<<<<<<<<<<<
  *         return ''.join(map(str,GTdata))
  * 
  */
-  __pyx_k_tuple_200 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_200);
+  __pyx_k_tuple_201 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_201)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_201);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_200, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_201, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__GTdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_200, 1, ((PyObject *)__pyx_n_s__GTdata));
+  PyTuple_SET_ITEM(__pyx_k_tuple_201, 1, ((PyObject *)__pyx_n_s__GTdata));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GTdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_200));
-  __pyx_k_codeobj_201 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__convertGTback, 596, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_201)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_201));
+  __pyx_k_codeobj_202 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_201, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__convertGTback, 596, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_202)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":599
+  /* "pysam/cvcf.pyx":599
  *         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_k_tuple_202 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_202)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_202);
+  __pyx_k_tuple_203 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_203)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_203);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 1, ((PyObject *)__pyx_n_s__key));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 1, ((PyObject *)__pyx_n_s__key));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__value));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 2, ((PyObject *)__pyx_n_s__value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 2, ((PyObject *)__pyx_n_s__value));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__formatdict));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 3, ((PyObject *)__pyx_n_s__formatdict));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 3, ((PyObject *)__pyx_n_s__formatdict));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__formatdict));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 4, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 4, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 5, ((PyObject *)__pyx_n_s__f));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 5, ((PyObject *)__pyx_n_s__f));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 6, ((PyObject *)__pyx_n_s__values));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 6, ((PyObject *)__pyx_n_s__values));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 7, ((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 7, ((PyObject *)__pyx_n_s__idx));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
-  PyTuple_SET_ITEM(__pyx_k_tuple_202, 8, ((PyObject *)__pyx_n_s__v));
+  PyTuple_SET_ITEM(__pyx_k_tuple_203, 8, ((PyObject *)__pyx_n_s__v));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_202));
-  __pyx_k_codeobj_203 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_formatdata, 599, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_203)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_203));
+  __pyx_k_codeobj_204 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_203, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_formatdata, 599, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_204)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":641
+  /* "pysam/cvcf.pyx":641
  *             self.error(line,self.ERROR_INFO_STRING)
  * 
  *     def inregion(self, chrom, pos):             # <<<<<<<<<<<<<<
  *         if not self._regions: return True
  *         for r in self._regions:
  */
-  __pyx_k_tuple_204 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_204)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_204);
+  __pyx_k_tuple_205 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_205)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_205);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_204, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_205, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__chrom));
-  PyTuple_SET_ITEM(__pyx_k_tuple_204, 1, ((PyObject *)__pyx_n_s__chrom));
+  PyTuple_SET_ITEM(__pyx_k_tuple_205, 1, ((PyObject *)__pyx_n_s__chrom));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chrom));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_204, 2, ((PyObject *)__pyx_n_s__pos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_205, 2, ((PyObject *)__pyx_n_s__pos));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-  PyTuple_SET_ITEM(__pyx_k_tuple_204, 3, ((PyObject *)__pyx_n_s__r));
+  PyTuple_SET_ITEM(__pyx_k_tuple_205, 3, ((PyObject *)__pyx_n_s__r));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_204));
-  __pyx_k_codeobj_205 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__inregion, 641, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_205)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_205));
+  __pyx_k_codeobj_206 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_205, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__inregion, 641, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_206)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":647
+  /* "pysam/cvcf.pyx":647
  *         return False
  * 
  *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
  *         cols = line.split('\t')
  *         if len(cols) != len(self._samples)+9:
  */
-  __pyx_k_tuple_206 = PyTuple_New(45); if (unlikely(!__pyx_k_tuple_206)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_206);
+  __pyx_k_tuple_207 = PyTuple_New(45); if (unlikely(!__pyx_k_tuple_207)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_207);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 1, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 1, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__lineparse));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 2, ((PyObject *)__pyx_n_s__lineparse));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 2, ((PyObject *)__pyx_n_s__lineparse));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lineparse));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__cols));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 3, ((PyObject *)__pyx_n_s__cols));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 3, ((PyObject *)__pyx_n_s__cols));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cols));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__chrom));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 4, ((PyObject *)__pyx_n_s__chrom));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 4, ((PyObject *)__pyx_n_s__chrom));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chrom));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 5, ((PyObject *)__pyx_n_s__pos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 5, ((PyObject *)__pyx_n_s__pos));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__id));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 6, ((PyObject *)__pyx_n_s__id));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 6, ((PyObject *)__pyx_n_s__id));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ref));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 7, ((PyObject *)__pyx_n_s__ref));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 7, ((PyObject *)__pyx_n_s__ref));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ref));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__c));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 8, ((PyObject *)__pyx_n_s__c));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 8, ((PyObject *)__pyx_n_s__c));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 9, ((PyObject *)__pyx_n_s__left));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 9, ((PyObject *)__pyx_n_s__left));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__faref_leftflank));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 10, ((PyObject *)__pyx_n_s__faref_leftflank));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 10, ((PyObject *)__pyx_n_s__faref_leftflank));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__faref_leftflank));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__faref));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 11, ((PyObject *)__pyx_n_s__faref));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 11, ((PyObject *)__pyx_n_s__faref));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__faref));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__alt));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 12, ((PyObject *)__pyx_n_s__alt));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 12, ((PyObject *)__pyx_n_s__alt));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alt));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__qual));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 13, ((PyObject *)__pyx_n_s__qual));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 13, ((PyObject *)__pyx_n_s__qual));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qual));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filter));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 14, ((PyObject *)__pyx_n_s__filter));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 14, ((PyObject *)__pyx_n_s__filter));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filter));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__info));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 15, ((PyObject *)__pyx_n_s__info));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 15, ((PyObject *)__pyx_n_s__info));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__info));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__blurp));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 16, ((PyObject *)__pyx_n_s__blurp));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 16, ((PyObject *)__pyx_n_s__blurp));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blurp));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__elts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 17, ((PyObject *)__pyx_n_s__elts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 17, ((PyObject *)__pyx_n_s__elts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__elts));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__v));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 18, ((PyObject *)__pyx_n_s__v));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 18, ((PyObject *)__pyx_n_s__v));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 19, ((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 19, ((PyObject *)__pyx_n_s__format));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 20, ((PyObject *)__pyx_n_s__f));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 20, ((PyObject *)__pyx_n_s__f));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__newalts));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 21, ((PyObject *)__pyx_n_s__newalts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 21, ((PyObject *)__pyx_n_s__newalts));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__newalts));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__have_deletions));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 22, ((PyObject *)__pyx_n_s__have_deletions));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 22, ((PyObject *)__pyx_n_s__have_deletions));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__have_deletions));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 23, ((PyObject *)__pyx_n_s__a));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 23, ((PyObject *)__pyx_n_s__a));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 24, ((PyObject *)__pyx_n_s__l));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 24, ((PyObject *)__pyx_n_s__l));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__addns));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 25, ((PyObject *)__pyx_n_s__addns));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 25, ((PyObject *)__pyx_n_s__addns));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__addns));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 26, ((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 26, ((PyObject *)__pyx_n_s__i));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__na));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 27, ((PyObject *)__pyx_n_s__na));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 27, ((PyObject *)__pyx_n_s__na));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 28, ((PyObject *)__pyx_n_s__s));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 28, ((PyObject *)__pyx_n_s__s));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__addn));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 29, ((PyObject *)__pyx_n_s__addn));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 29, ((PyObject *)__pyx_n_s__addn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__addn));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__allele));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 30, ((PyObject *)__pyx_n_s__allele));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 30, ((PyObject *)__pyx_n_s__allele));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__allele));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__movable));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 31, ((PyObject *)__pyx_n_s__movable));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 31, ((PyObject *)__pyx_n_s__movable));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__movable));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__longest));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 32, ((PyObject *)__pyx_n_s__longest));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 32, ((PyObject *)__pyx_n_s__longest));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__longest));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__shortest));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 33, ((PyObject *)__pyx_n_s__shortest));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 33, ((PyObject *)__pyx_n_s__shortest));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shortest));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__samples));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 34, ((PyObject *)__pyx_n_s__samples));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 34, ((PyObject *)__pyx_n_s__samples));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__samples));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__sample));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 35, ((PyObject *)__pyx_n_s__sample));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 35, ((PyObject *)__pyx_n_s__sample));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sample));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__dict));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 36, ((PyObject *)__pyx_n_s__dict));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 36, ((PyObject *)__pyx_n_s__dict));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dict));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 37, ((PyObject *)__pyx_n_s__values));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 37, ((PyObject *)__pyx_n_s__values));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 38, ((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 38, ((PyObject *)__pyx_n_s__idx));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__expected));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 39, ((PyObject *)__pyx_n_s__expected));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 39, ((PyObject *)__pyx_n_s__expected));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__expected));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__value));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 40, ((PyObject *)__pyx_n_s__value));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 40, ((PyObject *)__pyx_n_s__value));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 41, ((PyObject *)__pyx_n_s__d));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 41, ((PyObject *)__pyx_n_s__d));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 42, ((PyObject *)__pyx_n_s__key));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 42, ((PyObject *)__pyx_n_s__key));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 43, ((PyObject *)__pyx_n_s__genexpr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 43, ((PyObject *)__pyx_n_s__genexpr));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__genexpr));
-  PyTuple_SET_ITEM(__pyx_k_tuple_206, 44, ((PyObject *)__pyx_n_s__genexpr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_207, 44, ((PyObject *)__pyx_n_s__genexpr));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__genexpr));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_206));
-  __pyx_k_codeobj_207 = (PyObject*)__Pyx_PyCode_New(3, 0, 45, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_206, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_data, 647, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_207)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_207));
+  __pyx_k_codeobj_208 = (PyObject*)__Pyx_PyCode_New(3, 0, 45, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_207, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse_data, 647, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_208)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":857
+  /* "pysam/cvcf.pyx":857
  * 
  * 
  *     def write_data(self, stream, data):             # <<<<<<<<<<<<<<
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
  *         for k in required:
  */
-  __pyx_k_tuple_208 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_208)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_208);
+  __pyx_k_tuple_209 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_209)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_209);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 2, ((PyObject *)__pyx_n_s__data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 2, ((PyObject *)__pyx_n_s__data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__required));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 3, ((PyObject *)__pyx_n_s__required));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 3, ((PyObject *)__pyx_n_s__required));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__required));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 4, ((PyObject *)__pyx_n_s__k));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 4, ((PyObject *)__pyx_n_s__k));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__alt));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 5, ((PyObject *)__pyx_n_s__alt));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 5, ((PyObject *)__pyx_n_s__alt));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alt));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filter));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 6, ((PyObject *)__pyx_n_s__filter));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 6, ((PyObject *)__pyx_n_s__filter));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filter));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__qual));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 7, ((PyObject *)__pyx_n_s__qual));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 7, ((PyObject *)__pyx_n_s__qual));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qual));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 8, ((PyObject *)__pyx_n_s__output));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 8, ((PyObject *)__pyx_n_s__output));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
-  PyTuple_SET_ITEM(__pyx_k_tuple_208, 9, ((PyObject *)__pyx_n_s__s));
+  PyTuple_SET_ITEM(__pyx_k_tuple_209, 9, ((PyObject *)__pyx_n_s__s));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_208));
-  __pyx_k_codeobj_209 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write_data, 857, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_209)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_209));
+  __pyx_k_codeobj_210 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_209, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write_data, 857, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_210)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":886
+  /* "pysam/cvcf.pyx":886
  *         stream.write( "\t".join(output) + "\n" )
  * 
  *     def _parse_header(self, stream):             # <<<<<<<<<<<<<<
  *         self._lineno = 0
  *         for line in stream:
  */
-  __pyx_k_tuple_210 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_210)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_210);
+  __pyx_k_tuple_211 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_211)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_211);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_210, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_211, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_210, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_211, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_210, 2, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_211, 2, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_210));
-  __pyx_k_codeobj_211 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s___parse_header, 886, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_211)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_211));
+  __pyx_k_codeobj_212 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_211, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s___parse_header, 886, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_212)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":899
+  /* "pysam/cvcf.pyx":899
  *         return line
  * 
  *     def _parse(self, line, stream):             # <<<<<<<<<<<<<<
  *         # deal with files with header only
  *         if line.startswith("##"): return
  */
-  __pyx_k_tuple_212 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_212)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_212);
+  __pyx_k_tuple_213 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_213)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_213);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_212, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_213, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_212, 1, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_213, 1, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_212, 2, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_213, 2, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
-  PyTuple_SET_ITEM(__pyx_k_tuple_212, 3, ((PyObject *)__pyx_n_s__d));
+  PyTuple_SET_ITEM(__pyx_k_tuple_213, 3, ((PyObject *)__pyx_n_s__d));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_212));
-  __pyx_k_codeobj_213 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s___parse, 899, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_213)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_213));
+  __pyx_k_codeobj_214 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_213, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s___parse, 899, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_214)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":917
+  /* "pysam/cvcf.pyx":917
  *     ######################################################################################################
  * 
  *     def getsamples(self):             # <<<<<<<<<<<<<<
  *         """ List of samples in VCF file """
  *         return self._samples
  */
-  __pyx_k_tuple_214 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_214)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_214);
+  __pyx_k_tuple_215 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_215)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_215);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_214, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_215, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_214));
-  __pyx_k_codeobj_215 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getsamples, 917, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_215)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_215));
+  __pyx_k_codeobj_216 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_215, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getsamples, 917, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_216)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":921
+  /* "pysam/cvcf.pyx":921
  *         return self._samples
  * 
  *     def setsamples(self,samples):             # <<<<<<<<<<<<<<
  *         """ List of samples in VCF file """
  *         self._samples = samples
  */
-  __pyx_k_tuple_216 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_216)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_216);
+  __pyx_k_tuple_217 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_217)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_217);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_216, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_217, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__samples));
-  PyTuple_SET_ITEM(__pyx_k_tuple_216, 1, ((PyObject *)__pyx_n_s__samples));
+  PyTuple_SET_ITEM(__pyx_k_tuple_217, 1, ((PyObject *)__pyx_n_s__samples));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__samples));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_216));
-  __pyx_k_codeobj_217 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_216, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setsamples, 921, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_217)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_217));
+  __pyx_k_codeobj_218 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_217, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setsamples, 921, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_218)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":925
+  /* "pysam/cvcf.pyx":925
  *         self._samples = samples
  * 
  *     def getheader(self):             # <<<<<<<<<<<<<<
  *         """ List of header key-value pairs (strings) """
  *         return self._header
  */
-  __pyx_k_tuple_218 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_218)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_218);
+  __pyx_k_tuple_219 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_219)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_219);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_218, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_219, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_218));
-  __pyx_k_codeobj_219 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getheader, 925, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_219)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_219));
+  __pyx_k_codeobj_220 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_219, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getheader, 925, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_220)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":929
+  /* "pysam/cvcf.pyx":929
  *         return self._header
  * 
  *     def setheader(self,header):             # <<<<<<<<<<<<<<
  *         """ List of header key-value pairs (strings) """
  *         self._header = header
  */
-  __pyx_k_tuple_220 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_220)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_220);
+  __pyx_k_tuple_221 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_221)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_221);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_220, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_221, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__header));
-  PyTuple_SET_ITEM(__pyx_k_tuple_220, 1, ((PyObject *)__pyx_n_s__header));
+  PyTuple_SET_ITEM(__pyx_k_tuple_221, 1, ((PyObject *)__pyx_n_s__header));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__header));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_220));
-  __pyx_k_codeobj_221 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_220, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setheader, 929, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_221)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_221));
+  __pyx_k_codeobj_222 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_221, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setheader, 929, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_222)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":933
+  /* "pysam/cvcf.pyx":933
  *         self._header = header
  * 
  *     def getinfo(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         return self._info
  */
-  __pyx_k_tuple_222 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_222)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_222);
+  __pyx_k_tuple_223 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_223)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_223);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_222, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_223, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_222));
-  __pyx_k_codeobj_223 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_222, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getinfo, 933, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_223)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_223));
+  __pyx_k_codeobj_224 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_223, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getinfo, 933, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_224)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":937
+  /* "pysam/cvcf.pyx":937
  *         return self._info
  * 
  *     def setinfo(self,info):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         self._info = info
  */
-  __pyx_k_tuple_224 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_224)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_224);
+  __pyx_k_tuple_225 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_225)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_225);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_224, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_225, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__info));
-  PyTuple_SET_ITEM(__pyx_k_tuple_224, 1, ((PyObject *)__pyx_n_s__info));
+  PyTuple_SET_ITEM(__pyx_k_tuple_225, 1, ((PyObject *)__pyx_n_s__info));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__info));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_224));
-  __pyx_k_codeobj_225 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setinfo, 937, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_225)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_225));
+  __pyx_k_codeobj_226 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_225, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setinfo, 937, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_226)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":941
+  /* "pysam/cvcf.pyx":941
  *         self._info = info
  * 
  *     def getformat(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         return self._format
  */
-  __pyx_k_tuple_226 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_226)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_226);
+  __pyx_k_tuple_227 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_227)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_227);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_226, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_227, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_226));
-  __pyx_k_codeobj_227 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_226, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getformat, 941, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_227)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_227));
+  __pyx_k_codeobj_228 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_227, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getformat, 941, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_228)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":945
+  /* "pysam/cvcf.pyx":945
  *         return self._format
  * 
  *     def setformat(self,format):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         self._format = format
  */
-  __pyx_k_tuple_228 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_228)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_228);
+  __pyx_k_tuple_229 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_229)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_229);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_228, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_229, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
-  PyTuple_SET_ITEM(__pyx_k_tuple_228, 1, ((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_229, 1, ((PyObject *)__pyx_n_s__format));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_228));
-  __pyx_k_codeobj_229 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_228, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setformat, 945, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_229)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_229));
+  __pyx_k_codeobj_230 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_229, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setformat, 945, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_230)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":949
+  /* "pysam/cvcf.pyx":949
  *         self._format = format
  * 
  *     def getfilter(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         return self._filter
  */
-  __pyx_k_tuple_230 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_230)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_230);
+  __pyx_k_tuple_231 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_231)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_231);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_230, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_231, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_230));
-  __pyx_k_codeobj_231 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_230, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getfilter, 949, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_231)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_231));
+  __pyx_k_codeobj_232 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_231, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__getfilter, 949, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_232)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":953
+  /* "pysam/cvcf.pyx":953
  *         return self._filter
  * 
  *     def setfilter(self,filter):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         self._filter = filter
  */
-  __pyx_k_tuple_232 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_232)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_232);
+  __pyx_k_tuple_233 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_233);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_232, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filter));
-  PyTuple_SET_ITEM(__pyx_k_tuple_232, 1, ((PyObject *)__pyx_n_s__filter));
+  PyTuple_SET_ITEM(__pyx_k_tuple_233, 1, ((PyObject *)__pyx_n_s__filter));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filter));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_232));
-  __pyx_k_codeobj_233 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_232, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setfilter, 953, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_233));
+  __pyx_k_codeobj_234 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_233, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setfilter, 953, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":957
+  /* "pysam/cvcf.pyx":957
  *         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_k_tuple_234 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_234);
+  __pyx_k_tuple_235 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_235);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_234, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__version));
-  PyTuple_SET_ITEM(__pyx_k_tuple_234, 1, ((PyObject *)__pyx_n_s__version));
+  PyTuple_SET_ITEM(__pyx_k_tuple_235, 1, ((PyObject *)__pyx_n_s__version));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__version));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_234));
-  __pyx_k_codeobj_235 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_234, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setversion, 957, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_235));
+  __pyx_k_codeobj_236 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_235, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setversion, 957, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":961
+  /* "pysam/cvcf.pyx":961
  *         self._version = version
  * 
  *     def setregions(self, regions):             # <<<<<<<<<<<<<<
  *         self._regions = regions
  * 
  */
-  __pyx_k_tuple_236 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_236);
+  __pyx_k_tuple_237 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_237);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_236, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_237, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__regions));
-  PyTuple_SET_ITEM(__pyx_k_tuple_236, 1, ((PyObject *)__pyx_n_s__regions));
+  PyTuple_SET_ITEM(__pyx_k_tuple_237, 1, ((PyObject *)__pyx_n_s__regions));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__regions));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_236));
-  __pyx_k_codeobj_237 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_236, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setregions, 961, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_237));
+  __pyx_k_codeobj_238 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_237, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setregions, 961, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_238)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":964
+  /* "pysam/cvcf.pyx":964
  *         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_k_tuple_238 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_238)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_238);
+  __pyx_k_tuple_239 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_239)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_239);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_238, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_239, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ref));
-  PyTuple_SET_ITEM(__pyx_k_tuple_238, 1, ((PyObject *)__pyx_n_s__ref));
+  PyTuple_SET_ITEM(__pyx_k_tuple_239, 1, ((PyObject *)__pyx_n_s__ref));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ref));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_238));
-  __pyx_k_codeobj_239 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_238, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setreference, 964, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_239)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_239));
+  __pyx_k_codeobj_240 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_239, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__setreference, 964, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_240)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":968
+  /* "pysam/cvcf.pyx":968
  *         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_k_tuple_240 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_240)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_240);
+  __pyx_k_tuple_241 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_241)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_241);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_240, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_241, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__errorstring));
-  PyTuple_SET_ITEM(__pyx_k_tuple_240, 1, ((PyObject *)__pyx_n_s__errorstring));
+  PyTuple_SET_ITEM(__pyx_k_tuple_241, 1, ((PyObject *)__pyx_n_s__errorstring));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__errorstring));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_240));
-  __pyx_k_codeobj_241 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_240, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__ignoreerror, 968, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_241)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_241));
+  __pyx_k_codeobj_242 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_241, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__ignoreerror, 968, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_242)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":972
+  /* "pysam/cvcf.pyx":972
  *         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_k_tuple_242 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_242)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_242);
+  __pyx_k_tuple_243 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_243)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_243);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_242, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_243, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__errorstring));
-  PyTuple_SET_ITEM(__pyx_k_tuple_242, 1, ((PyObject *)__pyx_n_s__errorstring));
+  PyTuple_SET_ITEM(__pyx_k_tuple_243, 1, ((PyObject *)__pyx_n_s__errorstring));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__errorstring));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_242));
-  __pyx_k_codeobj_243 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_242, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__warnerror, 972, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_243)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_243));
+  __pyx_k_codeobj_244 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__warnerror, 972, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_244)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":976
+  /* "pysam/cvcf.pyx":976
  *         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_k_tuple_244 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_244)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_244);
+  __pyx_k_tuple_245 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_245)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_245);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_244, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_245, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_244, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_245, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__last_line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_244, 2, ((PyObject *)__pyx_n_s__last_line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_245, 2, ((PyObject *)__pyx_n_s__last_line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_line));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_244));
-  __pyx_k_codeobj_245 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_244, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse, 976, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_245)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_245));
+  __pyx_k_codeobj_246 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_245, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__parse, 976, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_246)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":983
+  /* "pysam/cvcf.pyx":983
  *         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_k_tuple_246 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_246)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_246);
+  __pyx_k_tuple_247 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_247)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_247);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_246, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_247, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_246, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_247, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__datagenerator));
-  PyTuple_SET_ITEM(__pyx_k_tuple_246, 2, ((PyObject *)__pyx_n_s__datagenerator));
+  PyTuple_SET_ITEM(__pyx_k_tuple_247, 2, ((PyObject *)__pyx_n_s__datagenerator));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datagenerator));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_246, 3, ((PyObject *)__pyx_n_s__data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_247, 3, ((PyObject *)__pyx_n_s__data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_246));
-  __pyx_k_codeobj_247 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_246, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write, 983, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_247)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_247));
+  __pyx_k_codeobj_248 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_247, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__write, 983, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_248)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":989
+  /* "pysam/cvcf.pyx":989
  *         for data in datagenerator: self.write_data(stream,data)
  * 
  *     def writeheader(self, stream):             # <<<<<<<<<<<<<<
  *         """ Writes a VCF header """
  *         self.write_header(stream)
  */
-  __pyx_k_tuple_248 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_248)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_248);
+  __pyx_k_tuple_249 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_249)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_249);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_248, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_249, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__stream));
-  PyTuple_SET_ITEM(__pyx_k_tuple_248, 1, ((PyObject *)__pyx_n_s__stream));
+  PyTuple_SET_ITEM(__pyx_k_tuple_249, 1, ((PyObject *)__pyx_n_s__stream));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stream));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_248));
-  __pyx_k_codeobj_249 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_248, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__writeheader, 989, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_249)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_249));
+  __pyx_k_codeobj_250 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_249, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__writeheader, 989, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_250)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":994
+  /* "pysam/cvcf.pyx":994
  *         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_k_tuple_250 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_250)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_250);
+  __pyx_k_tuple_251 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_251)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_251);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 1, ((PyObject *)__pyx_n_s__pos1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 1, ((PyObject *)__pyx_n_s__pos1));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ref1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 2, ((PyObject *)__pyx_n_s__ref1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 2, ((PyObject *)__pyx_n_s__ref1));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ref1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__alt1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 3, ((PyObject *)__pyx_n_s__alt1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 3, ((PyObject *)__pyx_n_s__alt1));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alt1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__pos2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 4, ((PyObject *)__pyx_n_s__pos2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 4, ((PyObject *)__pyx_n_s__pos2));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos2));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ref2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 5, ((PyObject *)__pyx_n_s__ref2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 5, ((PyObject *)__pyx_n_s__ref2));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ref2));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__alt2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_250, 6, ((PyObject *)__pyx_n_s__alt2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_251, 6, ((PyObject *)__pyx_n_s__alt2));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alt2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_250));
-  __pyx_k_codeobj_251 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_250, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__compare_calls, 994, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_251)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_251));
+  __pyx_k_codeobj_252 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_251, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__compare_calls, 994, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":1016
+  /* "pysam/cvcf.pyx":1016
  * ###########################################################################################################
  * 
  *     def connect( self, filename ):             # <<<<<<<<<<<<<<
  *         '''connect to tabix file.'''
  *         self.tabixfile = pysam.Tabixfile( filename )
  */
-  __pyx_k_tuple_252 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_252);
+  __pyx_k_tuple_253 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_253)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_253);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_252, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_253, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
-  PyTuple_SET_ITEM(__pyx_k_tuple_252, 1, ((PyObject *)__pyx_n_s__filename));
+  PyTuple_SET_ITEM(__pyx_k_tuple_253, 1, ((PyObject *)__pyx_n_s__filename));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_252));
-  __pyx_k_codeobj_253 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_252, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__connect, 1016, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_253)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_253));
+  __pyx_k_codeobj_254 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_253, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__connect, 1016, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":1021
+  /* "pysam/cvcf.pyx":1021
  *         self._parse_header(self.tabixfile.header)
  * 
  *     def fetch(self,             # <<<<<<<<<<<<<<
  *               reference = None,
  *               start = None,
  */
-  __pyx_k_tuple_254 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_254);
+  __pyx_k_tuple_255 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_255);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_254, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_255, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__reference));
-  PyTuple_SET_ITEM(__pyx_k_tuple_254, 1, ((PyObject *)__pyx_n_s__reference));
+  PyTuple_SET_ITEM(__pyx_k_tuple_255, 1, ((PyObject *)__pyx_n_s__reference));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__reference));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
-  PyTuple_SET_ITEM(__pyx_k_tuple_254, 2, ((PyObject *)__pyx_n_s__start));
+  PyTuple_SET_ITEM(__pyx_k_tuple_255, 2, ((PyObject *)__pyx_n_s__start));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__end));
-  PyTuple_SET_ITEM(__pyx_k_tuple_254, 3, ((PyObject *)__pyx_n_s__end));
+  PyTuple_SET_ITEM(__pyx_k_tuple_255, 3, ((PyObject *)__pyx_n_s__end));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__region));
-  PyTuple_SET_ITEM(__pyx_k_tuple_254, 4, ((PyObject *)__pyx_n_s__region));
+  PyTuple_SET_ITEM(__pyx_k_tuple_255, 4, ((PyObject *)__pyx_n_s__region));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__region));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_254));
-  __pyx_k_codeobj_255 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_254, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__fetch, 1021, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_256 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_256);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_255));
+  __pyx_k_codeobj_256 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_255, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__fetch, 1021, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_257 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_257);
   __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_k_tuple_256, 0, ((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 0, ((PyObject *)Py_None));
   __Pyx_GIVEREF(((PyObject *)Py_None));
   __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_k_tuple_256, 1, ((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 1, ((PyObject *)Py_None));
   __Pyx_GIVEREF(((PyObject *)Py_None));
   __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_k_tuple_256, 2, ((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 2, ((PyObject *)Py_None));
   __Pyx_GIVEREF(((PyObject *)Py_None));
   __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_k_tuple_256, 3, ((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 3, ((PyObject *)Py_None));
   __Pyx_GIVEREF(((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_256));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_257));
 
-  /* "cvcf.pyx":1030
+  /* "pysam/cvcf.pyx":1030
  *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )
  * 
  *     def validate( self, record ):             # <<<<<<<<<<<<<<
  *         '''validate vcf record.
  * 
  */
-  __pyx_k_tuple_257 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_257);
+  __pyx_k_tuple_258 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_258);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_257, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_258, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__record));
-  PyTuple_SET_ITEM(__pyx_k_tuple_257, 1, ((PyObject *)__pyx_n_s__record));
+  PyTuple_SET_ITEM(__pyx_k_tuple_258, 1, ((PyObject *)__pyx_n_s__record));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__record));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_257));
-  __pyx_k_codeobj_258 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_257, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__validate, 1030, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_258));
+  __pyx_k_codeobj_259 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_134, __pyx_n_s__validate, 1030, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -26439,20 +26748,27 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
   #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);
+  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "pysam.cvcf")) {
+      if (unlikely(PyDict_SetItemString(modules, "pysam.cvcf", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if CYTHON_COMPILING_IN_PYPY
+  Py_INCREF(__pyx_b);
   #endif
-  __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_module_is_main_pysam__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 ---*/
@@ -26463,53 +26779,53 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   /*--- Variable export 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 = 226; __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 = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_4cvcf_asVCFRecord = &__pyx_type_4cvcf_asVCFRecord;
-  if (PyType_Ready(&__pyx_type_4cvcf___pyx_scope_struct__parse_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_4cvcf___pyx_scope_struct__parse_data = &__pyx_type_4cvcf___pyx_scope_struct__parse_data;
-  if (PyType_Ready(&__pyx_type_4cvcf___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_4cvcf___pyx_scope_struct_1_genexpr = &__pyx_type_4cvcf___pyx_scope_struct_1_genexpr;
-  if (PyType_Ready(&__pyx_type_4cvcf___pyx_scope_struct_2__parse) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_4cvcf___pyx_scope_struct_2__parse = &__pyx_type_4cvcf___pyx_scope_struct_2__parse;
+  __pyx_ptype_5pysam_10TabProxies_TupleProxy = __Pyx_ImportType("pysam.TabProxies", "TupleProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_4cvcf_VCFRecord = &__pyx_vtable_5pysam_4cvcf_VCFRecord;
+  __pyx_vtable_5pysam_4cvcf_VCFRecord.__pyx_base = *__pyx_vtabptr_5pysam_10TabProxies_TupleProxy;
+  __pyx_vtable_5pysam_4cvcf_VCFRecord.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_5pysam_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_5pysam_4cvcf_9VCFRecord_update;
+  __pyx_type_5pysam_4cvcf_VCFRecord.tp_base = __pyx_ptype_5pysam_10TabProxies_TupleProxy;
+  if (PyType_Ready(&__pyx_type_5pysam_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_5pysam_4cvcf_VCFRecord.tp_dict, __pyx_vtabptr_5pysam_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_5pysam_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_4cvcf_VCFRecord = &__pyx_type_5pysam_4cvcf_VCFRecord;
+  __pyx_ptype_5pysam_6ctabix_Parser = __Pyx_ImportType("pysam.ctabix", "Parser", sizeof(struct __pyx_obj_5pysam_6ctabix_Parser), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_Parser)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_type_5pysam_4cvcf_asVCFRecord.tp_base = __pyx_ptype_5pysam_6ctabix_Parser;
+  if (PyType_Ready(&__pyx_type_5pysam_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "asVCFRecord", (PyObject *)&__pyx_type_5pysam_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_4cvcf_asVCFRecord = &__pyx_type_5pysam_4cvcf_asVCFRecord;
+  if (PyType_Ready(&__pyx_type_5pysam_4cvcf___pyx_scope_struct__parse_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_4cvcf___pyx_scope_struct__parse_data = &__pyx_type_5pysam_4cvcf___pyx_scope_struct__parse_data;
+  if (PyType_Ready(&__pyx_type_5pysam_4cvcf___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_4cvcf___pyx_scope_struct_1_genexpr = &__pyx_type_5pysam_4cvcf___pyx_scope_struct_1_genexpr;
+  if (PyType_Ready(&__pyx_type_5pysam_4cvcf___pyx_scope_struct_2__parse) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_4cvcf___pyx_scope_struct_2__parse = &__pyx_type_5pysam_4cvcf___pyx_scope_struct_2__parse;
   /*--- 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_6ctabix_TabixIterator = __Pyx_ImportType("ctabix", "TabixIterator", sizeof(struct __pyx_obj_6ctabix_TabixIterator), 1); if (unlikely(!__pyx_ptype_6ctabix_TabixIterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_TabixHeaderIterator = __Pyx_ImportType("ctabix", "TabixHeaderIterator", sizeof(struct __pyx_obj_6ctabix_TabixHeaderIterator), 1); if (unlikely(!__pyx_ptype_6ctabix_TabixHeaderIterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asTuple = __Pyx_ImportType("ctabix", "asTuple", sizeof(struct __pyx_obj_6ctabix_asTuple), 1); if (unlikely(!__pyx_ptype_6ctabix_asTuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asGTF = __Pyx_ImportType("ctabix", "asGTF", sizeof(struct __pyx_obj_6ctabix_asGTF), 1); if (unlikely(!__pyx_ptype_6ctabix_asGTF)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asBed = __Pyx_ImportType("ctabix", "asBed", sizeof(struct __pyx_obj_6ctabix_asBed), 1); if (unlikely(!__pyx_ptype_6ctabix_asBed)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_asVCF = __Pyx_ImportType("ctabix", "asVCF", sizeof(struct __pyx_obj_6ctabix_asVCF), 1); if (unlikely(!__pyx_ptype_6ctabix_asVCF)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_TabixIteratorParsed = __Pyx_ImportType("ctabix", "TabixIteratorParsed", sizeof(struct __pyx_obj_6ctabix_TabixIteratorParsed), 1); if (unlikely(!__pyx_ptype_6ctabix_TabixIteratorParsed)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_tabix_inplace_iterator = __Pyx_ImportType("ctabix", "tabix_inplace_iterator", sizeof(struct __pyx_obj_6ctabix_tabix_inplace_iterator), 1); if (unlikely(!__pyx_ptype_6ctabix_tabix_inplace_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_vtabptr_6ctabix_tabix_inplace_iterator = (struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator*)__Pyx_GetVtable(__pyx_ptype_6ctabix_tabix_inplace_iterator->tp_dict); if (unlikely(!__pyx_vtabptr_6ctabix_tabix_inplace_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_6ctabix_tabix_copy_iterator = __Pyx_ImportType("ctabix", "tabix_copy_iterator", sizeof(struct __pyx_obj_6ctabix_tabix_copy_iterator), 1); if (unlikely(!__pyx_ptype_6ctabix_tabix_copy_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_vtabptr_6ctabix_tabix_copy_iterator = (struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator*)__Pyx_GetVtable(__pyx_ptype_6ctabix_tabix_copy_iterator->tp_dict); if (unlikely(!__pyx_vtabptr_6ctabix_tabix_copy_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __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 = 69; __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 = 69; __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 = 72; __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 = 72; __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 = 83; __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_Tabixfile = __Pyx_ImportType("pysam.ctabix", "Tabixfile", sizeof(struct __pyx_obj_5pysam_6ctabix_Tabixfile), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_Tabixfile)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_TabixIterator = __Pyx_ImportType("pysam.ctabix", "TabixIterator", sizeof(struct __pyx_obj_5pysam_6ctabix_TabixIterator), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_TabixIterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_TabixHeaderIterator = __Pyx_ImportType("pysam.ctabix", "TabixHeaderIterator", sizeof(struct __pyx_obj_5pysam_6ctabix_TabixHeaderIterator), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_TabixHeaderIterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asTuple = __Pyx_ImportType("pysam.ctabix", "asTuple", sizeof(struct __pyx_obj_5pysam_6ctabix_asTuple), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_asTuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asGTF = __Pyx_ImportType("pysam.ctabix", "asGTF", sizeof(struct __pyx_obj_5pysam_6ctabix_asGTF), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_asGTF)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asBed = __Pyx_ImportType("pysam.ctabix", "asBed", sizeof(struct __pyx_obj_5pysam_6ctabix_asBed), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_asBed)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_asVCF = __Pyx_ImportType("pysam.ctabix", "asVCF", sizeof(struct __pyx_obj_5pysam_6ctabix_asVCF), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_asVCF)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_TabixIteratorParsed = __Pyx_ImportType("pysam.ctabix", "TabixIteratorParsed", sizeof(struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_TabixIteratorParsed)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_tabix_inplace_iterator = __Pyx_ImportType("pysam.ctabix", "tabix_inplace_iterator", sizeof(struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_tabix_inplace_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator = (struct __pyx_vtabstruct_5pysam_6ctabix_tabix_inplace_iterator*)__Pyx_GetVtable(__pyx_ptype_5pysam_6ctabix_tabix_inplace_iterator->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_6ctabix_tabix_copy_iterator = __Pyx_ImportType("pysam.ctabix", "tabix_copy_iterator", sizeof(struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator), 1); if (unlikely(!__pyx_ptype_5pysam_6ctabix_tabix_copy_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator = (struct __pyx_vtabstruct_5pysam_6ctabix_tabix_copy_iterator*)__Pyx_GetVtable(__pyx_ptype_5pysam_6ctabix_tabix_copy_iterator->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_6ctabix_tabix_copy_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_GTFProxy = __Pyx_ImportType("pysam.TabProxies", "GTFProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_NamedTupleProxy = __Pyx_ImportType("pysam.TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_BedProxy = __Pyx_ImportType("pysam.TabProxies", "BedProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_BedProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5pysam_10TabProxies_VCFProxy = __Pyx_ImportType("pysam.TabProxies", "VCFProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_5pysam_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "cvcf.pyx":46
+  /* "pysam/cvcf.pyx":46
  * #
  * 
  * from collections import namedtuple, defaultdict             # <<<<<<<<<<<<<<
@@ -26545,7 +26861,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":47
+  /* "pysam/cvcf.pyx":47
  * 
  * from collections import namedtuple, defaultdict
  * from operator import itemgetter             # <<<<<<<<<<<<<<
@@ -26570,12 +26886,12 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":48
+  /* "pysam/cvcf.pyx":48
  * from collections import namedtuple, defaultdict
  * from operator import itemgetter
  * import sys, re, copy, bisect             # <<<<<<<<<<<<<<
  * 
- * cimport ctabix
+ * from pysam cimport ctabix
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); 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);
@@ -26594,9 +26910,9 @@ 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;
 
-  /* "cvcf.pyx":52
- * cimport ctabix
- * cimport TabProxies
+  /* "pysam/cvcf.pyx":52
+ * from pysam cimport ctabix
+ * from pysam cimport TabProxies
  * import pysam             # <<<<<<<<<<<<<<
  * 
  * gtsRegEx = re.compile("[|/\\\\]")
@@ -26606,7 +26922,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;
 
-  /* "cvcf.pyx":54
+  /* "pysam/cvcf.pyx":54
  * import pysam
  * 
  * gtsRegEx = re.compile("[|/\\\\]")             # <<<<<<<<<<<<<<
@@ -26624,7 +26940,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   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;
 
-  /* "cvcf.pyx":55
+  /* "pysam/cvcf.pyx":55
  * 
  * gtsRegEx = re.compile("[|/\\\\]")
  * alleleRegEx = re.compile('^[ACGTN]+$')             # <<<<<<<<<<<<<<
@@ -26642,31 +26958,31 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   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
+  /* "pysam/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_1get_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_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_1get_sequence, NULL, __pyx_n_s_135); 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
+  /* "pysam/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_3parse_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_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3parse_regions, NULL, __pyx_n_s_135); 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;
 
-  /* "cvcf.pyx":86
+  /* "pysam/cvcf.pyx":86
  * 
  * 
  * FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue')             # <<<<<<<<<<<<<<
@@ -26675,13 +26991,13 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   __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_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_138), NULL); if (unlikely(!__pyx_t_2)) {__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_139), 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;
 
-  /* "cvcf.pyx":237
+  /* "pysam/cvcf.pyx":237
  *         return r
  * 
  * class VCF(object):             # <<<<<<<<<<<<<<
@@ -26691,7 +27007,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
 
-  /* "cvcf.pyx":240
+  /* "pysam/cvcf.pyx":240
  * 
  *     # types
  *     NT_UNKNOWN = 0             # <<<<<<<<<<<<<<
@@ -26700,7 +27016,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_UNKNOWN, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":241
+  /* "pysam/cvcf.pyx":241
  *     # types
  *     NT_UNKNOWN = 0
  *     NT_NUMBER = 1             # <<<<<<<<<<<<<<
@@ -26709,7 +27025,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_NUMBER, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":242
+  /* "pysam/cvcf.pyx":242
  *     NT_UNKNOWN = 0
  *     NT_NUMBER = 1
  *     NT_ALLELES = 2             # <<<<<<<<<<<<<<
@@ -26718,7 +27034,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_ALLELES, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":243
+  /* "pysam/cvcf.pyx":243
  *     NT_NUMBER = 1
  *     NT_ALLELES = 2
  *     NT_NR_ALLELES = 3             # <<<<<<<<<<<<<<
@@ -26727,7 +27043,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_NR_ALLELES, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":244
+  /* "pysam/cvcf.pyx":244
  *     NT_ALLELES = 2
  *     NT_NR_ALLELES = 3
  *     NT_GENOTYPES = 4             # <<<<<<<<<<<<<<
@@ -26736,7 +27052,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_GENOTYPES, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":245
+  /* "pysam/cvcf.pyx":245
  *     NT_NR_ALLELES = 3
  *     NT_GENOTYPES = 4
  *     NT_PHASED_GENOTYPES = 5             # <<<<<<<<<<<<<<
@@ -26745,7 +27061,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_PHASED_GENOTYPES, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":247
+  /* "pysam/cvcf.pyx":247
  *     NT_PHASED_GENOTYPES = 5
  * 
  *     _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier",             # <<<<<<<<<<<<<<
@@ -26754,44 +27070,44 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __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_139)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, ((PyObject *)__pyx_kp_s_154)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, ((PyObject *)__pyx_kp_s_155)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, ((PyObject *)__pyx_kp_s_156)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, ((PyObject *)__pyx_kp_s_157)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, ((PyObject *)__pyx_kp_s_158)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, ((PyObject *)__pyx_kp_s_159)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, ((PyObject *)__pyx_kp_s_160)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, ((PyObject *)__pyx_kp_s_161)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, ((PyObject *)__pyx_kp_s_162)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, ((PyObject *)__pyx_kp_s_163)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, ((PyObject *)__pyx_kp_s_164)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, ((PyObject *)__pyx_kp_s_165)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, ((PyObject *)__pyx_kp_s_166)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, ((PyObject *)__pyx_kp_s_167)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, ((PyObject *)__pyx_kp_s_168)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, ((PyObject *)__pyx_kp_s_169)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_31, ((PyObject *)__pyx_kp_s_170)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, ((PyObject *)__pyx_kp_s_171)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, __pyx_int_33, ((PyObject *)__pyx_kp_s_172)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, ((PyObject *)__pyx_kp_s_154)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, ((PyObject *)__pyx_kp_s_155)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, ((PyObject *)__pyx_kp_s_156)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, ((PyObject *)__pyx_kp_s_157)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, ((PyObject *)__pyx_kp_s_158)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, ((PyObject *)__pyx_kp_s_159)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, ((PyObject *)__pyx_kp_s_160)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, ((PyObject *)__pyx_kp_s_161)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, ((PyObject *)__pyx_kp_s_162)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, ((PyObject *)__pyx_kp_s_163)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, ((PyObject *)__pyx_kp_s_164)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, ((PyObject *)__pyx_kp_s_165)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, ((PyObject *)__pyx_kp_s_166)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, ((PyObject *)__pyx_kp_s_167)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, ((PyObject *)__pyx_kp_s_168)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, ((PyObject *)__pyx_kp_s_169)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, ((PyObject *)__pyx_kp_s_170)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_31, ((PyObject *)__pyx_kp_s_171)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, ((PyObject *)__pyx_kp_s_172)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, __pyx_int_33, ((PyObject *)__pyx_kp_s_173)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __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 = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":284
+  /* "pysam/cvcf.pyx":284
  * 
  *     # tag-value pairs; tags are not unique; does not include fileformat, INFO, FILTER or FORMAT fields
  *     _header = []             # <<<<<<<<<<<<<<
@@ -26803,7 +27119,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___header, ((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;
 
-  /* "cvcf.pyx":287
+  /* "pysam/cvcf.pyx":287
  * 
  *     # version number; 33=v3.3; 40=v4.0
  *     _version = 40             # <<<<<<<<<<<<<<
@@ -26812,7 +27128,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___version, __pyx_int_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":290
+  /* "pysam/cvcf.pyx":290
  * 
  *     # info, filter and format data
  *     _info = {}             # <<<<<<<<<<<<<<
@@ -26824,7 +27140,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___info, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":291
+  /* "pysam/cvcf.pyx":291
  *     # info, filter and format data
  *     _info = {}
  *     _filter = {}             # <<<<<<<<<<<<<<
@@ -26836,7 +27152,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___filter, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":292
+  /* "pysam/cvcf.pyx":292
  *     _info = {}
  *     _filter = {}
  *     _format = {}             # <<<<<<<<<<<<<<
@@ -26848,7 +27164,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___format, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":295
+  /* "pysam/cvcf.pyx":295
  * 
  *     # header; and required columns
  *     _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"]             # <<<<<<<<<<<<<<
@@ -26887,7 +27203,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___required, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":296
+  /* "pysam/cvcf.pyx":296
  *     # header; and required columns
  *     _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"]
  *     _samples = []             # <<<<<<<<<<<<<<
@@ -26899,7 +27215,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___samples, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":299
+  /* "pysam/cvcf.pyx":299
  * 
  *     # control behaviour
  *     _ignored_errors = set([11,31])   # ERROR_UNKNOWN_KEY, ERROR_ZERO_FOR_NON_FLAG_FIELD             # <<<<<<<<<<<<<<
@@ -26913,7 +27229,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___ignored_errors, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":300
+  /* "pysam/cvcf.pyx":300
  *     # control behaviour
  *     _ignored_errors = set([11,31])   # ERROR_UNKNOWN_KEY, ERROR_ZERO_FOR_NON_FLAG_FIELD
  *     _warn_errors = set([])             # <<<<<<<<<<<<<<
@@ -26925,7 +27241,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___warn_errors, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":301
+  /* "pysam/cvcf.pyx":301
  *     _ignored_errors = set([11,31])   # ERROR_UNKNOWN_KEY, ERROR_ZERO_FOR_NON_FLAG_FIELD
  *     _warn_errors = set([])
  *     _leftalign = False             # <<<<<<<<<<<<<<
@@ -26937,7 +27253,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___leftalign, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":304
+  /* "pysam/cvcf.pyx":304
  * 
  *     # reference sequence
  *     _reference = None             # <<<<<<<<<<<<<<
@@ -26946,7 +27262,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___reference, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":307
+  /* "pysam/cvcf.pyx":307
  * 
  *     # regions to include; None includes everything
  *     _regions = None             # <<<<<<<<<<<<<<
@@ -26955,7 +27271,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___regions, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":310
+  /* "pysam/cvcf.pyx":310
  * 
  *     # statefull stuff
  *     _lineno = -1             # <<<<<<<<<<<<<<
@@ -26964,7 +27280,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___lineno, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":311
+  /* "pysam/cvcf.pyx":311
  *     # statefull stuff
  *     _lineno = -1
  *     _line = None             # <<<<<<<<<<<<<<
@@ -26973,7 +27289,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___line, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":312
+  /* "pysam/cvcf.pyx":312
  *     _lineno = -1
  *     _line = None
  *     _lines = None             # <<<<<<<<<<<<<<
@@ -26982,14 +27298,14 @@ PyMODINIT_FUNC PyInit_cvcf(void)
  */
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___lines, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "cvcf.pyx":314
+  /* "pysam/cvcf.pyx":314
  *     _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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_1__init__, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_174)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_1__init__, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_175)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -26997,31 +27313,31 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_1)->__pyx_arg_leftalign = __pyx_t_3;
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_4cvcf_3VCF_85__defaults__);
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_5pysam_4cvcf_3VCF_85__defaults__);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":335
+  /* "pysam/cvcf.pyx":335
  *         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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_3error, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_176)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_3error, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_177)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_177));
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_178));
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__error, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":344
+  /* "pysam/cvcf.pyx":344
  *         raise ValueError(errorstring)
  * 
  *     def parse_format(self,line,format,filter=False):             # <<<<<<<<<<<<<<
  *         if self._version == 40:
  *             if not format.startswith('<'):
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_5parse_format, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_179)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_5parse_format, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_180)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults1), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27029,18 +27345,18 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_1)->__pyx_arg_filter = __pyx_t_3;
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_4cvcf_3VCF_87__defaults__);
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_5pysam_4cvcf_3VCF_87__defaults__);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_format, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":416
+  /* "pysam/cvcf.pyx":416
  *         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:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_7format_format, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_181)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_7format_format, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_182)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults2), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27048,42 +27364,42 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_1)->__pyx_arg_filter = __pyx_t_3;
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_4cvcf_3VCF_89__defaults__);
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_5pysam_4cvcf_3VCF_89__defaults__);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__format_format, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":436
+  /* "pysam/cvcf.pyx":436
  *         return format
  * 
  *     def get_expected(self, format, formatdict, alt):             # <<<<<<<<<<<<<<
  *         fmt = formatdict[format]
  *         if fmt.numbertype == self.NT_UNKNOWN: return -1
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_9get_expected, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_183)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_9get_expected, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_184)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __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 = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":447
+  /* "pysam/cvcf.pyx":447
  * 
  * 
  *     def _add_definition(self, formatdict, key, data, line ):             # <<<<<<<<<<<<<<
  *         if key in formatdict: return
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_11_add_definition, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_185)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_11_add_definition, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_186)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __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 = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":464
+  /* "pysam/cvcf.pyx":464
  * 
  *     # 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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_13format_formatdata, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_187)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_13format_formatdata, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_188)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults3), 2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27096,126 +27412,126 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_t_1)->__pyx_arg_value = __pyx_t_3;
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_4cvcf_3VCF_91__defaults__);
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_5pysam_4cvcf_3VCF_91__defaults__);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__format_formatdata, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":498
+  /* "pysam/cvcf.pyx":498
  * 
  * 
  *     def enter_default_format(self):             # <<<<<<<<<<<<<<
  *         for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
  *                   FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_15enter_default_format, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_189)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_15enter_default_format, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_190)); 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);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_121, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":517
+  /* "pysam/cvcf.pyx":517
  *                 self._format[f.id] = f
  * 
  *     def parse_header( self, line ):             # <<<<<<<<<<<<<<
  *         assert line.startswith('##')
  *         elts = line[2:].split('=')
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_17parse_header, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_191)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_17parse_header, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_192)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __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 = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":546
+  /* "pysam/cvcf.pyx":546
  * 
  * 
  *     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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_19write_header, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_193)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_19write_header, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_194)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __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 = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":553
+  /* "pysam/cvcf.pyx":553
  * 
  * 
  *     def parse_heading( self, line ):             # <<<<<<<<<<<<<<
  *         assert line.startswith('#')
  *         assert not line.startswith('##')
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_21parse_heading, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_195)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_21parse_heading, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_196)); 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__parse_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;
 
-  /* "cvcf.pyx":581
+  /* "pysam/cvcf.pyx":581
  *         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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_23write_heading, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_197)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_23write_heading, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_198)); 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);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_heading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":584
+  /* "pysam/cvcf.pyx":584
  *         stream.write("#" + "\t".join(self._required + self._samples) + "\n")
  * 
  *     def convertGT(self, GTstring):             # <<<<<<<<<<<<<<
  *         if GTstring == ".": return ["."]
  *         try:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_25convertGT, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_199)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_25convertGT, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_200)); 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);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__convertGT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":596
+  /* "pysam/cvcf.pyx":596
  *             return [".","|","."]
  * 
  *     def convertGTback(self, GTdata):             # <<<<<<<<<<<<<<
  *         return ''.join(map(str,GTdata))
  * 
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_27convertGTback, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_201)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_27convertGTback, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_202)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __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 = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":599
+  /* "pysam/cvcf.pyx":599
  *         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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_29parse_formatdata, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_203)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_29parse_formatdata, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_204)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __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 = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":641
+  /* "pysam/cvcf.pyx":641
  *             self.error(line,self.ERROR_INFO_STRING)
  * 
  *     def inregion(self, chrom, pos):             # <<<<<<<<<<<<<<
  *         if not self._regions: return True
  *         for r in self._regions:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_31inregion, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_205)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_31inregion, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_206)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __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 = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":647
+  /* "pysam/cvcf.pyx":647
  *         return False
  * 
  *     def parse_data( self, line, lineparse=False ):             # <<<<<<<<<<<<<<
  *         cols = line.split('\t')
  *         if len(cols) != len(self._samples)+9:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_33parse_data, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_207)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_33parse_data, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_208)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults4), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27223,312 +27539,312 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_t_1)->__pyx_arg_lineparse = __pyx_t_3;
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_4cvcf_3VCF_93__defaults__);
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_5pysam_4cvcf_3VCF_93__defaults__);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":857
+  /* "pysam/cvcf.pyx":857
  * 
  * 
  *     def write_data(self, stream, data):             # <<<<<<<<<<<<<<
  *         required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
  *         for k in required:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_35write_data, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_209)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_35write_data, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_210)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":886
+  /* "pysam/cvcf.pyx":886
  *         stream.write( "\t".join(output) + "\n" )
  * 
  *     def _parse_header(self, stream):             # <<<<<<<<<<<<<<
  *         self._lineno = 0
  *         for line in stream:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_37_parse_header, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_211)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_37_parse_header, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_212)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __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 = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":899
+  /* "pysam/cvcf.pyx":899
  *         return line
  * 
  *     def _parse(self, line, stream):             # <<<<<<<<<<<<<<
  *         # deal with files with header only
  *         if line.startswith("##"): return
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_39_parse, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_213)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_39_parse, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_214)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __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 = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":917
+  /* "pysam/cvcf.pyx":917
  *     ######################################################################################################
  * 
  *     def getsamples(self):             # <<<<<<<<<<<<<<
  *         """ List of samples in VCF file """
  *         return self._samples
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_42getsamples, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_215)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_42getsamples, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_216)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":921
+  /* "pysam/cvcf.pyx":921
  *         return self._samples
  * 
  *     def setsamples(self,samples):             # <<<<<<<<<<<<<<
  *         """ List of samples in VCF file """
  *         self._samples = samples
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_44setsamples, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_217)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_44setsamples, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_218)); 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);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setsamples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":925
+  /* "pysam/cvcf.pyx":925
  *         self._samples = samples
  * 
  *     def getheader(self):             # <<<<<<<<<<<<<<
  *         """ List of header key-value pairs (strings) """
  *         return self._header
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_46getheader, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_219)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_46getheader, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_220)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __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 = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":929
+  /* "pysam/cvcf.pyx":929
  *         return self._header
  * 
  *     def setheader(self,header):             # <<<<<<<<<<<<<<
  *         """ List of header key-value pairs (strings) """
  *         self._header = header
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_48setheader, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_221)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_48setheader, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_222)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":933
+  /* "pysam/cvcf.pyx":933
  *         self._header = header
  * 
  *     def getinfo(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         return self._info
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_50getinfo, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_223)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_50getinfo, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_224)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __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 = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":937
+  /* "pysam/cvcf.pyx":937
  *         return self._info
  * 
  *     def setinfo(self,info):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##INFO tags, as VCF.FORMAT values """
  *         self._info = info
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_52setinfo, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_225)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_52setinfo, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_226)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __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 = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":941
+  /* "pysam/cvcf.pyx":941
  *         self._info = info
  * 
  *     def getformat(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         return self._format
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_54getformat, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_227)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_54getformat, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_228)); 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);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getformat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":945
+  /* "pysam/cvcf.pyx":945
  *         return self._format
  * 
  *     def setformat(self,format):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
  *         self._format = format
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_56setformat, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_229)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_56setformat, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_230)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __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 = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":949
+  /* "pysam/cvcf.pyx":949
  *         self._format = format
  * 
  *     def getfilter(self):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         return self._filter
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_58getfilter, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_231)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_58getfilter, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_232)); 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);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getfilter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":953
+  /* "pysam/cvcf.pyx":953
  *         return self._filter
  * 
  *     def setfilter(self,filter):             # <<<<<<<<<<<<<<
  *         """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
  *         self._filter = filter
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_60setfilter, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_233)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_60setfilter, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_234)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __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 = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":957
+  /* "pysam/cvcf.pyx":957
  *         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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_62setversion, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_235)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_62setversion, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_236)); 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__setversion, __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":961
+  /* "pysam/cvcf.pyx":961
  *         self._version = version
  * 
  *     def setregions(self, regions):             # <<<<<<<<<<<<<<
  *         self._regions = regions
  * 
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_64setregions, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_237)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_64setregions, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_238)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __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 = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":964
+  /* "pysam/cvcf.pyx":964
  *         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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_66setreference, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_239)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_66setreference, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_240)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":968
+  /* "pysam/cvcf.pyx":968
  *         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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_68ignoreerror, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_241)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_68ignoreerror, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_242)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __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 = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":972
+  /* "pysam/cvcf.pyx":972
  *         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_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_70warnerror, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_243)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_70warnerror, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_244)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":976
+  /* "pysam/cvcf.pyx":976
  *         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_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_72parse, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_245)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_72parse, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_246)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __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 = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":983
+  /* "pysam/cvcf.pyx":983
  *         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_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_74write, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_247)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_74write, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_248)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __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 = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":989
+  /* "pysam/cvcf.pyx":989
  *         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_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_76writeheader, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_249)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_76writeheader, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_250)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__writeheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":994
+  /* "pysam/cvcf.pyx":994
  *         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_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_78compare_calls, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_251)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_78compare_calls, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_252)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__compare_calls, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":1016
+  /* "pysam/cvcf.pyx":1016
  * ###########################################################################################################
  * 
  *     def connect( self, filename ):             # <<<<<<<<<<<<<<
  *         '''connect to tabix file.'''
  *         self.tabixfile = pysam.Tabixfile( filename )
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_80connect, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_253)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_80connect, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_254)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __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 = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":1021
+  /* "pysam/cvcf.pyx":1021
  *         self._parse_header(self.tabixfile.header)
  * 
  *     def fetch(self,             # <<<<<<<<<<<<<<
  *               reference = None,
  *               start = None,
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_82fetch, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_255)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_82fetch, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_256)); 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_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_256));
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_257));
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__fetch, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":1030
+  /* "pysam/cvcf.pyx":1030
  *         return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) )
  * 
  *     def validate( self, record ):             # <<<<<<<<<<<<<<
  *         '''validate vcf record.
  * 
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cvcf_3VCF_84validate, 0, NULL, __pyx_n_s__cvcf, ((PyObject *)__pyx_k_codeobj_258)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_4cvcf_3VCF_84validate, 0, NULL, __pyx_n_s_135, ((PyObject *)__pyx_k_codeobj_259)); 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 (PyObject_SetItem(__pyx_t_2, __pyx_n_s__validate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "cvcf.pyx":237
+  /* "pysam/cvcf.pyx":237
  *         return r
  * 
  * class VCF(object):             # <<<<<<<<<<<<<<
@@ -27540,14 +27856,14 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __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 = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__VCF, __pyx_n_s_135); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __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 = 237; __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":1155
+  /* "pysam/cvcf.pyx":1155
  *                     pos -= 1
  * 
  * __all__ = [             # <<<<<<<<<<<<<<
@@ -27565,7 +27881,7 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "cvcf.pyx":1
+  /* "pysam/cvcf.pyx":1
  * #             # <<<<<<<<<<<<<<
  * # Code to read, write and edit VCF files
  * #
@@ -27580,10 +27896,10 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   if (__pyx_m) {
-    __Pyx_AddTraceback("init cvcf", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    __Pyx_AddTraceback("init pysam.cvcf", __pyx_clineno, __pyx_lineno, __pyx_filename);
     Py_DECREF(__pyx_m); __pyx_m = 0;
   } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init cvcf");
+    PyErr_SetString(PyExc_ImportError, "init pysam.cvcf");
   }
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -27646,7 +27962,7 @@ static void __Pyx_RaiseArgtupleInvalid(
         more_or_less = "exactly";
     }
     PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
+                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                  func_name, more_or_less, num_expected,
                  (num_expected == 1) ? "" : "s", num_found);
 }
@@ -27660,7 +27976,7 @@ static void __Pyx_RaiseDoubleKeywordsError(
         "%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));
+        PyString_AsString(kw_name));
         #endif
 }
 
@@ -27681,48 +27997,72 @@ static int __Pyx_ParseOptionalKeywords(
         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_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) {
+            continue;
+        }
+        name = first_kw_arg;
+        #if PY_MAJOR_VERSION < 3
+        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+            while (*name) {
+                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+                        && _PyString_Eq(**name, key)) {
                     values[name-argnames] = value;
-                } else {
-                    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;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    if ((**argname == key) || (
+                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+                             && _PyString_Eq(**argname, key))) {
+                        goto arg_passed_twice;
                     }
+                    argname++;
+                }
+            }
+        } else
+        #endif
+        if (likely(PyUnicode_Check(key))) {
+            while (*name) {
+                int cmp = (**name == key) ? 0 :
+                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+                #endif
+                    PyUnicode_Compare(**name, key);
+                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                if (cmp == 0) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    int cmp = (**argname == key) ? 0 :
+                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+                    #endif
+                        PyUnicode_Compare(**argname, key);
+                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                    if (cmp == 0) goto arg_passed_twice;
+                    argname++;
                 }
             }
+        } else
+            goto invalid_keyword_type;
+        if (kwds2) {
+            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+        } else {
+            goto invalid_keyword;
         }
     }
     return 0;
 arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
+    __Pyx_RaiseDoubleKeywordsError(function_name, key);
     goto bad;
 invalid_keyword_type:
     PyErr_Format(PyExc_TypeError,
@@ -27741,10 +28081,9 @@ bad:
     return -1;
 }
 
-
-
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     local_type = tstate->curexc_type;
@@ -27753,19 +28092,27 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->curexc_type = 0;
     tstate->curexc_value = 0;
     tstate->curexc_traceback = 0;
+#else
+    PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
     if (unlikely(tstate->curexc_type))
+#else
+    if (unlikely(PyErr_Occurred()))
+#endif
         goto bad;
     #if PY_MAJOR_VERSION >= 3
     if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
         goto bad;
     #endif
-    *type = local_type;
-    *value = local_value;
-    *tb = local_tb;
     Py_INCREF(local_type);
     Py_INCREF(local_value);
     Py_INCREF(local_tb);
+    *type = local_type;
+    *value = local_value;
+    *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
     tmp_tb = tstate->exc_traceback;
@@ -27773,10 +28120,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     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). */
+       these objects (DECREF may run arbitrary code). */
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
+#else
+    PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
     return 0;
 bad:
     *type = 0;
@@ -27823,33 +28173,38 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                         CYTHON_UNUSED PyObject *cause) {
     Py_XINCREF(type);
-    Py_XINCREF(value);
-    Py_XINCREF(tb);
-    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;
-    }
-    if (value == NULL) {
-        value = Py_None;
+    if (!value || value == Py_None)
+        value = NULL;
+    else
         Py_INCREF(value);
+    if (!tb || tb == Py_None)
+        tb = NULL;
+    else {
+        Py_INCREF(tb);
+        if (!PyTraceBack_Check(tb)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: arg 3 must be a traceback or None");
+            goto raise_error;
+        }
     }
     #if PY_VERSION_HEX < 0x02050000
-    if (!PyClass_Check(type))
+    if (PyClass_Check(type)) {
     #else
-    if (!PyType_Check(type))
+    if (PyType_Check(type)) {
     #endif
-    {
-        if (value != Py_None) {
+#if CYTHON_COMPILING_IN_PYPY
+        if (!value) {
+            Py_INCREF(Py_None);
+            value = Py_None;
+        }
+#endif
+        PyErr_NormalizeException(&type, &value, &tb);
+    } else {
+        if (value) {
             PyErr_SetString(PyExc_TypeError,
                 "instance exception may not have a separate value");
             goto raise_error;
         }
-        Py_DECREF(value);
         value = type;
         #if PY_VERSION_HEX < 0x02050000
             if (PyInstance_Check(type)) {
@@ -27882,6 +28237,7 @@ raise_error:
 }
 #else /* Python 3+ */
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+    PyObject* owned_instance = NULL;
     if (tb == Py_None) {
         tb = 0;
     } else if (tb && !PyTraceBack_Check(tb)) {
@@ -27899,12 +28255,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
         value = type;
         type = (PyObject*) Py_TYPE(value);
-    } else if (!PyExceptionClass_Check(type)) {
+    } else if (PyExceptionClass_Check(type)) {
+        PyObject *args;
+        if (!value)
+            args = PyTuple_New(0);
+        else if (PyTuple_Check(value)) {
+            Py_INCREF(value);
+            args = value;
+        }
+        else
+            args = PyTuple_Pack(1, value);
+        if (!args)
+            goto bad;
+        owned_instance = PyEval_CallObject(type, args);
+        Py_DECREF(args);
+        if (!owned_instance)
+            goto bad;
+        value = owned_instance;
+        if (!PyExceptionInstance_Check(value)) {
+            PyErr_Format(PyExc_TypeError,
+                         "calling %R should have returned an instance of "
+                         "BaseException, not %R",
+                         type, Py_TYPE(value));
+            goto bad;
+        }
+    } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
-    if (cause) {
+    if (cause && cause != Py_None) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
@@ -27921,9 +28301,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
                             "BaseException");
             goto bad;
         }
-        if (!value) {
-            value = PyObject_CallObject(type, NULL);
-        }
         PyException_SetCause(value, fixed_cause);
     }
     PyErr_SetObject(type, value);
@@ -27937,12 +28314,16 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
     }
 bad:
+    Py_XDECREF(owned_instance);
     return;
 }
 #endif
 
 static double __Pyx__PyObject_AsDouble(PyObject* obj) {
     PyObject* float_value;
+#if CYTHON_COMPILING_IN_PYPY
+    float_value = PyNumber_Float(obj);
+#else
     if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
         return PyFloat_AsDouble(obj);
     } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
@@ -27959,6 +28340,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
         PyTuple_SET_ITEM(args, 0, 0);
         Py_DECREF(args);
     }
+#endif
     if (likely(float_value)) {
         double value = PyFloat_AS_DOUBLE(float_value);
         Py_DECREF(float_value);
@@ -27972,19 +28354,49 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
 }
 
-static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
 }
 
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
     PyErr_Format(PyExc_ValueError,
-                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
+                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                  index, (index == 1) ? "" : "s");
 }
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
-    PyErr_Format(PyExc_ValueError,
-                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
+static CYTHON_INLINE int __Pyx_IterFinish(void) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyThreadState *tstate = PyThreadState_GET();
+    PyObject* exc_type = tstate->curexc_type;
+    if (unlikely(exc_type)) {
+        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
+            PyObject *exc_value, *exc_tb;
+            exc_value = tstate->curexc_value;
+            exc_tb = tstate->curexc_traceback;
+            tstate->curexc_type = 0;
+            tstate->curexc_value = 0;
+            tstate->curexc_traceback = 0;
+            Py_DECREF(exc_type);
+            Py_XDECREF(exc_value);
+            Py_XDECREF(exc_tb);
+            return 0;
+        } else {
+            return -1;
+        }
+    }
+    return 0;
+#else
+    if (unlikely(PyErr_Occurred())) {
+        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+            PyErr_Clear();
+            return 0;
+        } else {
+            return -1;
+        }
+    }
+    return 0;
+#endif
 }
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
@@ -27992,13 +28404,8 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
         Py_DECREF(retval);
         __Pyx_RaiseTooManyValuesError(expected);
         return -1;
-    } else if (PyErr_Occurred()) {
-        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
-            PyErr_Clear();
-            return 0;
-        } else {
-            return -1;
-        }
+    } else {
+        return __Pyx_IterFinish();
     }
     return 0;
 }
@@ -28010,13 +28417,197 @@ static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b)
     return q;
 }
 
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+}
+
+static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
+    if (t == Py_None) {
+      __Pyx_RaiseNoneNotIterableError();
+    } else if (PyTuple_GET_SIZE(t) < index) {
+      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
+    } else {
+      __Pyx_RaiseTooManyValuesError(index);
+    }
+}
+
+static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
+                                             int is_tuple, int has_known_size, int decref_tuple) {
+    Py_ssize_t index;
+    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
+    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
+        iternextfunc iternext;
+        iter = PyObject_GetIter(tuple);
+        if (unlikely(!iter)) goto bad;
+        if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
+        iternext = Py_TYPE(iter)->tp_iternext;
+        value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
+        value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
+        if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
+        Py_DECREF(iter);
+    } else {
+        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
+            __Pyx_UnpackTupleError(tuple, 2);
+            goto bad;
+        }
+#if CYTHON_COMPILING_IN_PYPY
+        value1 = PySequence_ITEM(tuple, 0);
+        if (unlikely(!value1)) goto bad;
+        value2 = PySequence_ITEM(tuple, 1);
+        if (unlikely(!value2)) goto bad;
+#else
+        value1 = PyTuple_GET_ITEM(tuple, 0);
+        value2 = PyTuple_GET_ITEM(tuple, 1);
+        Py_INCREF(value1);
+        Py_INCREF(value2);
+#endif
+        if (decref_tuple) { Py_DECREF(tuple); }
+    }
+    *pvalue1 = value1;
+    *pvalue2 = value2;
+    return 0;
+unpacking_failed:
+    if (!has_known_size && __Pyx_IterFinish() == 0)
+        __Pyx_RaiseNeedMoreValuesError(index);
+bad:
+    Py_XDECREF(iter);
+    Py_XDECREF(value1);
+    Py_XDECREF(value2);
+    if (decref_tuple) { Py_XDECREF(tuple); }
+    return -1;
+}
 
+static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
+                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
+    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
+    *p_source_is_dict = is_dict;
+#if !CYTHON_COMPILING_IN_PYPY
+    if (is_dict) {
+        *p_orig_length = PyDict_Size(iterable);
+        Py_INCREF(iterable);
+        return iterable;
+    }
+#endif
+    *p_orig_length = 0;
+    if (method_name) {
+        PyObject* iter;
+        iterable = PyObject_CallMethodObjArgs(iterable, method_name, NULL);
+        if (!iterable)
+            return NULL;
+#if !CYTHON_COMPILING_IN_PYPY
+        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
+            return iterable;
+#endif
+        iter = PyObject_GetIter(iterable);
+        Py_DECREF(iterable);
+        return iter;
+    }
+    return PyObject_GetIter(iterable);
+}
+static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
+                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
+    PyObject* next_item;
+#if !CYTHON_COMPILING_IN_PYPY
+    if (source_is_dict) {
+        PyObject *key, *value;
+        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
+            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
+            return -1;
+        }
+        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
+            return 0;
+        }
+        if (pitem) {
+            PyObject* tuple = PyTuple_New(2);
+            if (unlikely(!tuple)) {
+                return -1;
+            }
+            Py_INCREF(key);
+            Py_INCREF(value);
+            PyTuple_SET_ITEM(tuple, 0, key);
+            PyTuple_SET_ITEM(tuple, 1, value);
+            *pitem = tuple;
+        } else {
+            if (pkey) {
+                Py_INCREF(key);
+                *pkey = key;
+            }
+            if (pvalue) {
+                Py_INCREF(value);
+                *pvalue = value;
+            }
+        }
+        return 1;
+    } else if (PyTuple_CheckExact(iter_obj)) {
+        Py_ssize_t pos = *ppos;
+        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
+        *ppos = pos + 1;
+        next_item = PyTuple_GET_ITEM(iter_obj, pos);
+        Py_INCREF(next_item);
+    } else if (PyList_CheckExact(iter_obj)) {
+        Py_ssize_t pos = *ppos;
+        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
+        *ppos = pos + 1;
+        next_item = PyList_GET_ITEM(iter_obj, pos);
+        Py_INCREF(next_item);
+    } else
+#endif
+    {
+        next_item = PyIter_Next(iter_obj);
+        if (unlikely(!next_item)) {
+            return __Pyx_IterFinish();
+        }
+    }
+    if (pitem) {
+        *pitem = next_item;
+    } else if (pkey && pvalue) {
+        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
+            return -1;
+    } else if (pkey) {
+        *pkey = next_item;
+    } else {
+        *pvalue = next_item;
+    }
+    return 1;
+}
 
 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
     PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
 }
 
+static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
+    PyTypeObject* type = Py_TYPE(obj);
+    while (type && type->tp_dealloc != current_tp_dealloc)
+        type = type->tp_base;
+    while (type && type->tp_dealloc == current_tp_dealloc)
+        type = type->tp_base;
+    if (type)
+        type->tp_dealloc(obj);
+}
+
+static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
+    PyTypeObject* type = Py_TYPE(obj);
+    while (type && type->tp_traverse != current_tp_traverse)
+        type = type->tp_base;
+    while (type && type->tp_traverse == current_tp_traverse)
+        type = type->tp_base;
+    if (type && type->tp_traverse)
+        return type->tp_traverse(obj, v, a);
+    return 0;
+}
+
+static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
+    PyTypeObject* type = Py_TYPE(obj);
+    while (type && type->tp_clear != current_tp_clear)
+        type = type->tp_base;
+    while (type && type->tp_clear == current_tp_clear)
+        type = type->tp_base;
+    if (type && type->tp_clear)
+        type->tp_clear(obj);
+}
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
     *value = tstate->exc_value;
@@ -28024,8 +28615,12 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
     Py_XINCREF(*type);
     Py_XINCREF(*value);
     Py_XINCREF(*tb);
+#else
+    PyErr_GetExcInfo(type, value, tb);
+#endif
 }
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     tmp_type = tstate->exc_type;
@@ -28037,6 +28632,9 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
+#else
+    PyErr_SetExcInfo(type, value, tb);
+#endif
 }
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
@@ -28119,7 +28717,6 @@ static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
 
 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);
@@ -28149,7 +28746,6 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
     PyObject *metaclass;
     if (PyDict_SetItemString(dict, "__module__", modname) < 0)
         return NULL;
-    /* Python2 __metaclass__ */
     metaclass = PyDict_GetItemString(dict, "__metaclass__");
     if (metaclass) {
         Py_INCREF(metaclass);
@@ -28441,6 +29037,56 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
                                PyString_AsString(func_name), (void *)op);
 #endif
 }
+#if CYTHON_COMPILING_IN_PYPY
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+    PyCFunctionObject* f = (PyCFunctionObject*)func;
+    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
+    PyObject *self = PyCFunction_GET_SELF(func);
+    Py_ssize_t size;
+    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
+    case METH_VARARGS:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
+            return (*meth)(self, arg);
+        break;
+    case METH_VARARGS | METH_KEYWORDS:
+        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
+    case METH_NOARGS:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+            size = PyTuple_GET_SIZE(arg);
+            if (size == 0)
+                return (*meth)(self, NULL);
+            PyErr_Format(PyExc_TypeError,
+                "%.200s() takes no arguments (%zd given)",
+                f->m_ml->ml_name, size);
+            return NULL;
+        }
+        break;
+    case METH_O:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+            size = PyTuple_GET_SIZE(arg);
+            if (size == 1)
+                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
+            PyErr_Format(PyExc_TypeError,
+                "%.200s() takes exactly one argument (%zd given)",
+                f->m_ml->ml_name, size);
+            return NULL;
+        }
+        break;
+    default:
+        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
+                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
+                        "longer supported!");
+        return NULL;
+    }
+    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
+                 f->m_ml->ml_name);
+    return NULL;
+}
+#else
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+	return PyCFunction_Call(func, arg, kw);
+}
+#endif
 static PyTypeObject __pyx_CyFunctionType_type = {
     PyVarObject_HEAD_INIT(0, 0)
     __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
@@ -28460,7 +29106,7 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_as_sequence*/
     0,                                  /*tp_as_mapping*/
     0,                                  /*tp_hash*/
-    __Pyx_PyCFunction_Call,             /*tp_call*/
+    __Pyx_CyFunction_Call,              /*tp_call*/
     0,                                  /*tp_str*/
     0,                                  /*tp_getattro*/
     0,                                  /*tp_setattro*/
@@ -28496,15 +29142,16 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_version_tag*/
 #endif
 };
-static int __Pyx_CyFunction_init(void)
-{
+static int __Pyx_CyFunction_init(void) {
+#if !CYTHON_COMPILING_IN_PYPY
+    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+#endif
     if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
         return -1;
     __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
     return 0;
 }
-void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
-{
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
     m->defaults = PyMem_Malloc(size);
     if (!m->defaults)
@@ -28513,8 +29160,7 @@ void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
     m->defaults_pyobjects = pyobjects;
     return m->defaults;
 }
-static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
-{
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
     m->defaults_tuple = tuple;
     Py_INCREF(tuple);
@@ -28545,78 +29191,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     }
 }
 
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
-    if (s1 == s2) {
-        return (equals == Py_EQ);
-    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
-        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
-            return (equals == Py_NE);
-        } else if (PyBytes_GET_SIZE(s1) == 1) {
-            if (equals == Py_EQ)
-                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
-            else
-                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
-        } else {
-            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
-        return (equals == Py_NE);
-    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
-        return (equals == Py_NE);
-    } else {
-        int result;
-        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
-        if (!py_result)
-            return -1;
-        result = __Pyx_PyObject_IsTrue(py_result);
-        Py_DECREF(py_result);
-        return result;
-    }
-}
-
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
-    if (s1 == s2) {
-        return (equals == Py_EQ);
-    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
-        #if CYTHON_PEP393_ENABLED
-        if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
-            return -1;
-        if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
-            return (equals == Py_NE);
-        } else if (PyUnicode_GET_LENGTH(s1) == 1) {
-            Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
-            Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
-            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
-        #else
-        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
-            return (equals == Py_NE);
-        } else if (PyUnicode_GET_SIZE(s1) == 1) {
-            Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
-            Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
-            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
-        #endif
-        } else {
-            int result = PyUnicode_Compare(s1, s2);
-            if ((result == -1) && unlikely(PyErr_Occurred()))
-                return -1;
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
-        return (equals == Py_NE);
-    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
-        return (equals == Py_NE);
-    } else {
-        int result;
-        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
-        if (!py_result)
-            return -1;
-        result = __Pyx_PyObject_IsTrue(py_result);
-        Py_DECREF(py_result);
-        return result;
-    }
-}
-
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
     const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
@@ -29019,6 +29593,7 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 
 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *tmp_type, *tmp_value, *tmp_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
@@ -29026,6 +29601,10 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
     tstate->exc_type = *type;
     tstate->exc_value = *value;
     tstate->exc_traceback = *tb;
+#else
+    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
+    PyErr_SetExcInfo(*type, *value, *tb);
+#endif
     *type = tmp_type;
     *value = tmp_value;
     *tb = tmp_tb;
@@ -29035,9 +29614,70 @@ static PyObject *__Pyx_Generator_Next(PyObject *self);
 static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
 static PyObject *__Pyx_Generator_Close(PyObject *self);
 static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
+static PyTypeObject *__pyx_GeneratorType = 0;
+#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
+#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
+#if 1 || PY_VERSION_HEX < 0x030300B0
+static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
+    PyObject *et, *ev, *tb;
+    PyObject *value = NULL;
+    __Pyx_ErrFetch(&et, &ev, &tb);
+    if (!et) {
+        Py_XDECREF(tb);
+        Py_XDECREF(ev);
+        Py_INCREF(Py_None);
+        *pvalue = Py_None;
+        return 0;
+    }
+    if (unlikely(et != PyExc_StopIteration) &&
+            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
+        __Pyx_ErrRestore(et, ev, tb);
+        return -1;
+    }
+    if (likely(et == PyExc_StopIteration)) {
+        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
+            if (!ev) {
+                Py_INCREF(Py_None);
+                ev = Py_None;
+            }
+            Py_XDECREF(tb);
+            Py_DECREF(et);
+            *pvalue = ev;
+            return 0;
+        }
+    }
+    PyErr_NormalizeException(&et, &ev, &tb);
+    if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
+        __Pyx_ErrRestore(et, ev, tb);
+        return -1;
+    }
+    Py_XDECREF(tb);
+    Py_DECREF(et);
+#if PY_VERSION_HEX >= 0x030300A0
+    value = ((PyStopIterationObject *)ev)->value;
+    Py_INCREF(value);
+    Py_DECREF(ev);
+#else
+    {
+        PyObject* args = PyObject_GetAttrString(ev, "args");
+        Py_DECREF(ev);
+        if (likely(args)) {
+            value = PyObject_GetItem(args, 0);
+            Py_DECREF(args);
+        }
+        if (unlikely(!value)) {
+            __Pyx_ErrRestore(NULL, NULL, NULL);
+            Py_INCREF(Py_None);
+            value = Py_None;
+        }
+    }
+#endif
+    *pvalue = value;
+    return 0;
+}
+#endif
 static CYTHON_INLINE
-void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
-{
+void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
     PyObject *exc_type = self->exc_type;
     PyObject *exc_value = self->exc_value;
     PyObject *exc_traceback = self->exc_traceback;
@@ -29049,14 +29689,18 @@ void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
     Py_XDECREF(exc_traceback);
 }
 static CYTHON_INLINE
-PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
-{
-    PyObject *retval;
-    if (unlikely(self->is_running)) {
+int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
+    if (unlikely(gen->is_running)) {
         PyErr_SetString(PyExc_ValueError,
                         "generator already executing");
-        return NULL;
+        return 1;
     }
+    return 0;
+}
+static CYTHON_INLINE
+PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
+    PyObject *retval;
+    assert(!self->is_running);
     if (unlikely(self->resume_label == 0)) {
         if (unlikely(value && value != Py_None)) {
             PyErr_SetString(PyExc_TypeError,
@@ -29069,81 +29713,240 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
     }
-    if (value)
-        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
-    else
+    if (value) {
+#if CYTHON_COMPILING_IN_PYPY
+#else
+        /* Generators always return to their most recent caller, not
+         * necessarily their creator. */
+        if (self->exc_traceback) {
+            PyThreadState *tstate = PyThreadState_GET();
+            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
+            PyFrameObject *f = tb->tb_frame;
+            Py_XINCREF(tstate->frame);
+            assert(f->f_back == NULL);
+            f->f_back = tstate->frame;
+        }
+#endif
+        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
+                            &self->exc_traceback);
+    } else {
         __Pyx_Generator_ExceptionClear(self);
+    }
     self->is_running = 1;
     retval = self->body((PyObject *) self, value);
     self->is_running = 0;
-    if (retval)
-        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
-    else
+    if (retval) {
+        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
+                            &self->exc_traceback);
+#if CYTHON_COMPILING_IN_PYPY
+#else
+        /* Don't keep the reference to f_back any longer than necessary.  It
+         * may keep a chain of frames alive or it could create a reference
+         * cycle. */
+        if (self->exc_traceback) {
+            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
+            PyFrameObject *f = tb->tb_frame;
+            Py_CLEAR(f->f_back);
+        }
+#endif
+    } else {
         __Pyx_Generator_ExceptionClear(self);
+    }
     return retval;
 }
-static PyObject *__Pyx_Generator_Next(PyObject *self)
-{
-    return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None);
+static CYTHON_INLINE
+PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
+    PyObject *ret;
+    PyObject *val = NULL;
+    __Pyx_Generator_Undelegate(gen);
+    __Pyx_PyGen_FetchStopIterationValue(&val);
+    ret = __Pyx_Generator_SendEx(gen, val);
+    Py_XDECREF(val);
+    return ret;
+}
+static PyObject *__Pyx_Generator_Next(PyObject *self) {
+    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
+    PyObject *yf = gen->yieldfrom;
+    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+        return NULL;
+    if (yf) {
+        PyObject *ret;
+        gen->is_running = 1;
+        ret = Py_TYPE(yf)->tp_iternext(yf);
+        gen->is_running = 0;
+        if (likely(ret)) {
+            return ret;
+        }
+        return __Pyx_Generator_FinishDelegation(gen);
+    }
+    return __Pyx_Generator_SendEx(gen, Py_None);
 }
-static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
-{
-    return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, value);
+static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
+    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
+    PyObject *yf = gen->yieldfrom;
+    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+        return NULL;
+    if (yf) {
+        PyObject *ret;
+        gen->is_running = 1;
+        if (__Pyx_Generator_CheckExact(yf)) {
+            ret = __Pyx_Generator_Send(yf, value);
+        } else {
+            if (value == Py_None)
+                ret = PyIter_Next(yf);
+            else
+                ret = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value);
+        }
+        gen->is_running = 0;
+        if (likely(ret)) {
+            return ret;
+        }
+        return __Pyx_Generator_FinishDelegation(gen);
+    }
+    return __Pyx_Generator_SendEx(gen, value);
 }
-static PyObject *__Pyx_Generator_Close(PyObject *self)
-{
-    __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
-    PyObject *retval;
+static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
+    PyObject *retval = NULL;
+    int err = 0;
+    if (__Pyx_Generator_CheckExact(yf)) {
+        retval = __Pyx_Generator_Close(yf);
+        if (!retval)
+            return -1;
+    } else {
+        PyObject *meth;
+        gen->is_running = 1;
+        meth = PyObject_GetAttrString(yf, "close");
+        if (unlikely(!meth)) {
+            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
+                PyErr_WriteUnraisable(yf);
+            }
+            PyErr_Clear();
+        } else {
+            retval = PyObject_CallFunction(meth, NULL);
+            Py_DECREF(meth);
+            if (!retval)
+                err = -1;
+        }
+        gen->is_running = 0;
+    }
+    Py_XDECREF(retval);
+    return err;
+}
+static PyObject *__Pyx_Generator_Close(PyObject *self) {
+    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
+    PyObject *retval, *raised_exception;
+    PyObject *yf = gen->yieldfrom;
+    int err = 0;
+    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+        return NULL;
+    if (yf) {
+        Py_INCREF(yf);
+        err = __Pyx_Generator_CloseIter(gen, yf);
+        __Pyx_Generator_Undelegate(gen);
+        Py_DECREF(yf);
+    }
+    if (err == 0)
 #if PY_VERSION_HEX < 0x02050000
-    PyErr_SetNone(PyExc_StopIteration);
+        PyErr_SetNone(PyExc_StopIteration);
 #else
-    PyErr_SetNone(PyExc_GeneratorExit);
+        PyErr_SetNone(PyExc_GeneratorExit);
 #endif
-    retval = __Pyx_Generator_SendEx(generator, NULL);
+    retval = __Pyx_Generator_SendEx(gen, NULL);
     if (retval) {
         Py_DECREF(retval);
         PyErr_SetString(PyExc_RuntimeError,
                         "generator ignored GeneratorExit");
         return NULL;
     }
-#if PY_VERSION_HEX < 0x02050000
-    if (PyErr_ExceptionMatches(PyExc_StopIteration))
-#else
-    if (PyErr_ExceptionMatches(PyExc_StopIteration)
-        || PyErr_ExceptionMatches(PyExc_GeneratorExit))
+    raised_exception = PyErr_Occurred();
+    if (!raised_exception
+        || raised_exception == PyExc_StopIteration
+#if PY_VERSION_HEX >= 0x02050000
+        || raised_exception == PyExc_GeneratorExit
+        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
 #endif
+        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
     {
-        PyErr_Clear();          /* ignore these errors */
+        if (raised_exception) PyErr_Clear();      /* ignore these errors */
         Py_INCREF(Py_None);
         return Py_None;
     }
     return NULL;
 }
-static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args)
-{
-    __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
+static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
+    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
     PyObject *typ;
     PyObject *tb = NULL;
     PyObject *val = NULL;
+    PyObject *yf = gen->yieldfrom;
     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
         return NULL;
+    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
+        return NULL;
+    if (yf) {
+        PyObject *ret;
+        Py_INCREF(yf);
+#if PY_VERSION_HEX >= 0x02050000
+        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
+            int err = __Pyx_Generator_CloseIter(gen, yf);
+            Py_DECREF(yf);
+            __Pyx_Generator_Undelegate(gen);
+            if (err < 0)
+                return __Pyx_Generator_SendEx(gen, NULL);
+            goto throw_here;
+        }
+#endif
+        gen->is_running = 1;
+        if (__Pyx_Generator_CheckExact(yf)) {
+            ret = __Pyx_Generator_Throw(yf, args);
+        } else {
+            PyObject *meth = PyObject_GetAttrString(yf, "throw");
+            if (unlikely(!meth)) {
+                Py_DECREF(yf);
+                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
+                    gen->is_running = 0;
+                    return NULL;
+                }
+                PyErr_Clear();
+                __Pyx_Generator_Undelegate(gen);
+                gen->is_running = 0;
+                goto throw_here;
+            }
+            ret = PyObject_CallObject(meth, args);
+            Py_DECREF(meth);
+        }
+        gen->is_running = 0;
+        Py_DECREF(yf);
+        if (!ret) {
+            ret = __Pyx_Generator_FinishDelegation(gen);
+        }
+        return ret;
+    }
+throw_here:
     __Pyx_Raise(typ, val, tb, NULL);
-    return __Pyx_Generator_SendEx(generator, NULL);
+    return __Pyx_Generator_SendEx(gen, NULL);
 }
-static int
-__Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg)
-{
+static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
     __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
     Py_VISIT(gen->closure);
     Py_VISIT(gen->classobj);
+    Py_VISIT(gen->yieldfrom);
     Py_VISIT(gen->exc_type);
     Py_VISIT(gen->exc_value);
     Py_VISIT(gen->exc_traceback);
     return 0;
 }
-static void
-__Pyx_Generator_dealloc(PyObject *self)
-{
+static int __Pyx_Generator_clear(PyObject *self) {
+    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
+    Py_CLEAR(gen->closure);
+    Py_CLEAR(gen->classobj);
+    Py_CLEAR(gen->yieldfrom);
+    Py_CLEAR(gen->exc_type);
+    Py_CLEAR(gen->exc_value);
+    Py_CLEAR(gen->exc_traceback);
+    return 0;
+}
+static void __Pyx_Generator_dealloc(PyObject *self) {
     __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
     PyObject_GC_UnTrack(gen);
     if (gen->gi_weakreflist != NULL)
@@ -29155,16 +29958,10 @@ __Pyx_Generator_dealloc(PyObject *self)
             return;                     /* resurrected.  :( */
     }
     PyObject_GC_UnTrack(self);
-    Py_CLEAR(gen->closure);
-    Py_CLEAR(gen->classobj);
-    Py_CLEAR(gen->exc_type);
-    Py_CLEAR(gen->exc_value);
-    Py_CLEAR(gen->exc_traceback);
+    __Pyx_Generator_clear(self);
     PyObject_GC_Del(gen);
 }
-static void
-__Pyx_Generator_del(PyObject *self)
-{
+static void __Pyx_Generator_del(PyObject *self) {
     PyObject *res;
     PyObject *error_type, *error_value, *error_traceback;
     __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
@@ -29193,11 +29990,13 @@ __Pyx_Generator_del(PyObject *self)
         _Py_NewReference(self);
         self->ob_refcnt = refcnt;
     }
+#if CYTHON_COMPILING_FOR_CPYTHON
     assert(PyType_IS_GC(self->ob_type) &&
            _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
     /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
      * we need to undo that. */
     _Py_DEC_REFTOTAL;
+#endif
     /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
      * chain, so no more to do there.
      * If COUNT_ALLOCS, the original decref bumped tp_frees, and
@@ -29205,13 +30004,17 @@ __Pyx_Generator_del(PyObject *self)
      * undone.
      */
 #ifdef COUNT_ALLOCS
-    --self->ob_type->tp_frees;
-    --self->ob_type->tp_allocs;
+    --Py_TYPE(self)->tp_frees;
+    --Py_TYPE(self)->tp_allocs;
 #endif
 }
 static PyMemberDef __pyx_Generator_memberlist[] = {
     {(char *) "gi_running",
-     T_INT,
+#if PY_VERSION_HEX >= 0x02060000
+     T_BOOL,
+#else
+     T_BYTE,
+#endif
      offsetof(__pyx_GeneratorObject, is_running),
      READONLY,
      NULL},
@@ -29223,7 +30026,7 @@ static PyMethodDef __pyx_Generator_methods[] = {
     {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
     {0, 0, 0, 0}
 };
-static PyTypeObject __pyx_GeneratorType = {
+static PyTypeObject __pyx_GeneratorType_type = {
     PyVarObject_HEAD_INIT(0, 0)
     __Pyx_NAMESTR("generator"),         /*tp_name*/
     sizeof(__pyx_GeneratorObject),      /*tp_basicsize*/
@@ -29244,7 +30047,7 @@ static PyTypeObject __pyx_GeneratorType = {
     0,                                  /*tp_hash*/
     0,                                  /*tp_call*/
     0,                                  /*tp_str*/
-    PyObject_GenericGetAttr,            /*tp_getattro*/
+    0,                                  /*tp_getattro*/
     0,                                  /*tp_setattro*/
     0,                                  /*tp_as_buffer*/
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
@@ -29253,7 +30056,7 @@ static PyTypeObject __pyx_GeneratorType = {
     0,                                  /*tp_clear*/
     0,                                  /*tp_richcompare*/
     offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
-    PyObject_SelfIter,                  /*tp_iter*/
+    0,                                  /*tp_iter*/
     (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
     __pyx_Generator_methods,            /*tp_methods*/
     __pyx_Generator_memberlist,         /*tp_members*/
@@ -29278,12 +30081,10 @@ static PyTypeObject __pyx_GeneratorType = {
     0,                                  /*tp_version_tag*/
 #endif
 };
-static
-__pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
-                                           PyObject *closure)
-{
+static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
+                                                  PyObject *closure) {
     __pyx_GeneratorObject *gen =
-        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType);
+        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
     if (gen == NULL)
         return NULL;
     gen->body = body;
@@ -29292,6 +30093,7 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
     gen->is_running = 0;
     gen->resume_label = 0;
     gen->classobj = NULL;
+    gen->yieldfrom = NULL;
     gen->exc_type = NULL;
     gen->exc_value = NULL;
     gen->exc_traceback = NULL;
@@ -29299,9 +30101,14 @@ __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
     PyObject_GC_Track(gen);
     return gen;
 }
-static int __pyx_Generator_init(void)
-{
-    return PyType_Ready(&__pyx_GeneratorType);
+static int __pyx_Generator_init(void) {
+    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
+    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
+    if (PyType_Ready(&__pyx_GeneratorType_type)) {
+        return -1;
+    }
+    __pyx_GeneratorType = &__pyx_GeneratorType_type;
+    return 0;
 }
 
 static int __Pyx_check_binary_version(void) {
@@ -29323,6 +30130,23 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+    PyObject *py_name = 0;
+    PyObject *py_module = 0;
+    py_name = __Pyx_PyIdentifier_FromString(name);
+    if (!py_name)
+        goto bad;
+    py_module = PyImport_Import(py_name);
+    Py_DECREF(py_name);
+    return py_module;
+bad:
+    Py_XDECREF(py_name);
+    return 0;
+}
+#endif
+
 #ifndef __PYX_HAVE_RT_ImportType
 #define __PYX_HAVE_RT_ImportType
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
@@ -29375,23 +30199,6 @@ bad:
 }
 #endif
 
-#ifndef __PYX_HAVE_RT_ImportModule
-#define __PYX_HAVE_RT_ImportModule
-static PyObject *__Pyx_ImportModule(const char *name) {
-    PyObject *py_name = 0;
-    PyObject *py_module = 0;
-    py_name = __Pyx_PyIdentifier_FromString(name);
-    if (!py_name)
-        goto bad;
-    py_module = PyImport_Import(py_name);
-    Py_DECREF(py_name);
-    return py_module;
-bad:
-    Py_XDECREF(py_name);
-    return 0;
-}
-#endif
-
 static void* __Pyx_GetVtable(PyObject *dict) {
     void* ptr;
     PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
diff --git a/pysam/cvcf.pyx b/pysam/cvcf.pyx
index 86ff882..edde706 100644
--- a/pysam/cvcf.pyx
+++ b/pysam/cvcf.pyx
@@ -47,8 +47,8 @@ from collections import namedtuple, defaultdict
 from operator import itemgetter
 import sys, re, copy, bisect
 
-cimport ctabix
-cimport TabProxies
+from pysam cimport ctabix
+from pysam cimport TabProxies
 import pysam
 
 gtsRegEx = re.compile("[|/\\\\]")
diff --git a/pysam/version.py b/pysam/version.py
index 48345d8..eb98027 100644
--- a/pysam/version.py
+++ b/pysam/version.py
@@ -1,6 +1,6 @@
 # pysam versioning information
 
-__version__ = "0.7.2"
+__version__ = "0.7.3"
 
 __samtools_version__ = "0.1.18"
 
diff --git a/setup.py b/setup.py
index 7dfc9e0..182c30f 100644
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,6 @@
 pysam
 *****
 
-For more information, see http://code.google.com/p/pysam.
-
 '''
 
 import os, sys, glob, shutil, hashlib, re, fnmatch
@@ -116,10 +114,19 @@ if len(sys.argv) >= 2 and sys.argv[1] == "refresh":
 
     sys.exit(0)
 
+
+###################
+# populate headers
+# mkdir pysam/include pysam/include/win32
+# touch pysam/include/__init__.py pysam/include/win32/__init__.py
+# cp samtools/*.h pysam/*.h pysam/include
+# cp samtools/win32/*.h pysam/include/win32
+
+
 from distribute_setup import use_setuptools
 use_setuptools()
 
-from setuptools import Extension, setup
+from setuptools import Extension, setup, find_packages
 
 #######################################################
 #######################################################
@@ -129,8 +136,8 @@ except ImportError:
     # no Cython available - use existing C code
     cmdclass = { }
     csamtools_sources = [ "pysam/csamtools.c" ]
-    tabix_sources = [ "pysam/tabix.c" ]
-    tabproxies_sources = ["pysam/TabProxies.c" ]
+    tabix_sources = [ "pysam/ctabix.c" ]
+    tabproxies_sourcess = ["pysam/TabProxies.c" ]
     cvcf_sources = ["pysam/cvcf.c" ]
 else:
     cmdclass = { 'build_ext' : build_ext }
@@ -221,27 +228,16 @@ metadata = {
     'license': "MIT",
     'platforms': "ALL",
     'url': "http://code.google.com/p/pysam/",
-    'py_modules': [
-      "pysam/__init__", 
-      "pysam/Pileup", 
-      "pysam/version" ],
-    # cython larger that 0.16 for yield support
-    'requires' : ['cython (>=0.16)'],
+    'packages' : find_packages(),
+    'requires' : ['cython (>=0.17)'],
     'ext_modules': [samtools, tabix, tabproxies, cvcf ],
     'cmdclass' : cmdclass,
-    'install_requires' : ['cython>=0.16',], 
-    'data_files' : [('pysam',                  glob.glob('pysam/*.pxd')),
-                    ('include/pysam',          glob.glob('pysam/*.h')),
-                    ('include/samtools',       glob.glob('samtools/*.h')),
-                    ('include/samtools/win32', glob.glob('samtools/win32/*.h'))],
+    'install_requires' : ['cython>=0.17',], 
+    'package_data' : { '' : ['*.pxd', '*.h'],  },
     # do not pack in order to permit linking to csamtools.so
     'zip_safe' :False,
     'use_2to3': True,
     }
 
-if sys.version_info[0] < 3:
-    metadata['py_modules'].append("pysam/namedtuple")
-
 if __name__=='__main__':
    dist = setup(**metadata)
-
diff --git a/tabix/bedidx.c b/tabix/bedidx.c
new file mode 100644
index 0000000..722877d
--- /dev/null
+++ b/tabix/bedidx.c
@@ -0,0 +1,156 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include <zlib.h>
+
+#include "ksort.h"
+KSORT_INIT_GENERIC(uint64_t)
+
+#include "kseq.h"
+KSTREAM_INIT(gzFile, gzread, 8192)
+
+typedef struct {
+	int n, m;
+	uint64_t *a;
+	int *idx;
+} bed_reglist_t;
+
+#include "khash.h"
+KHASH_MAP_INIT_STR(reg, bed_reglist_t)
+
+#define LIDX_SHIFT 13
+
+typedef kh_reg_t reghash_t;
+
+int *bed_index_core(int n, uint64_t *a, int *n_idx)
+{
+	int i, j, m, *idx;
+	m = *n_idx = 0; idx = 0;
+	for (i = 0; i < n; ++i) {
+		int beg, end;
+		beg = a[i]>>32 >> LIDX_SHIFT; end = ((uint32_t)a[i]) >> LIDX_SHIFT;
+		if (m < end + 1) {
+			int oldm = m;
+			m = end + 1;
+			kroundup32(m);
+			idx = realloc(idx, m * sizeof(int));
+			for (j = oldm; j < m; ++j) idx[j] = -1;
+		}
+		if (beg == end) {
+			if (idx[beg] < 0) idx[beg] = i;
+		} else {
+			for (j = beg; j <= end; ++j)
+				if (idx[j] < 0) idx[j] = i;
+		}
+		*n_idx = end + 1;
+	}
+	return idx;
+}
+
+void bed_index(void *_h)
+{
+	reghash_t *h = (reghash_t*)_h;
+	khint_t k;
+	for (k = 0; k < kh_end(h); ++k) {
+		if (kh_exist(h, k)) {
+			bed_reglist_t *p = &kh_val(h, k);
+			if (p->idx) free(p->idx);
+			ks_introsort(uint64_t, p->n, p->a);
+			p->idx = bed_index_core(p->n, p->a, &p->m);
+		}
+	}
+}
+
+int bed_overlap_core(const bed_reglist_t *p, int beg, int end)
+{
+	int i, min_off;
+	if (p->n == 0) return 0;
+	min_off = (beg>>LIDX_SHIFT >= p->n)? p->idx[p->n-1] : p->idx[beg>>LIDX_SHIFT];
+	if (min_off < 0) { // TODO: this block can be improved, but speed should not matter too much here
+		int n = beg>>LIDX_SHIFT;
+		if (n > p->n) n = p->n;
+		for (i = n - 1; i >= 0; --i)
+			if (p->idx[i] >= 0) break;
+		min_off = i >= 0? p->idx[i] : 0;
+	}
+	for (i = min_off; i < p->n; ++i) {
+		if ((int)(p->a[i]>>32) >= end) break; // out of range; no need to proceed
+		if ((int32_t)p->a[i] > beg && (int32_t)(p->a[i]>>32) < end)
+			return 1; // find the overlap; return
+	}
+	return 0;
+}
+
+int bed_overlap(const void *_h, const char *chr, int beg, int end)
+{
+	const reghash_t *h = (const reghash_t*)_h;
+	khint_t k;
+	if (!h) return 0;
+	k = kh_get(reg, h, chr);
+	if (k == kh_end(h)) return 0;
+	return bed_overlap_core(&kh_val(h, k), beg, end);
+}
+
+void *bed_read(const char *fn)
+{
+	reghash_t *h = kh_init(reg);
+	gzFile fp;
+	kstream_t *ks;
+	int dret;
+	kstring_t *str;
+	// read the list
+	fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r");
+	if (fp == 0) return 0;
+	str = calloc(1, sizeof(kstring_t));
+	ks = ks_init(fp);
+	while (ks_getuntil(ks, 0, str, &dret) >= 0) { // read the chr name
+		int beg = -1, end = -1;
+		bed_reglist_t *p;
+		khint_t k = kh_get(reg, h, str->s);
+		if (k == kh_end(h)) { // absent from the hash table
+			int ret;
+			char *s = strdup(str->s);
+			k = kh_put(reg, h, s, &ret);
+			memset(&kh_val(h, k), 0, sizeof(bed_reglist_t));
+		}
+		p = &kh_val(h, k);
+		if (dret != '\n') { // if the lines has other characters
+			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]))
+						end = atoi(str->s); // end
+				}
+			}
+		}
+		if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n'); // skip the rest of the line
+		if (end < 0 && beg > 0) end = beg, beg = beg - 1; // if there is only one column
+		if (beg >= 0 && end > beg) {
+			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);
+	bed_index(h);
+	return h;
+}
+
+void bed_destroy(void *_h)
+{
+	reghash_t *h = (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(kh_val(h, k).idx);
+			free((char*)kh_key(h, k));
+		}
+	}
+	kh_destroy(reg, h);
+}
diff --git a/tabix/bgzf.c b/tabix/bgzf.c
new file mode 100644
index 0000000..3bea718
--- /dev/null
+++ b/tabix/bgzf.c
@@ -0,0 +1,555 @@
+/* The MIT License
+
+   Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology
+                 2011 Attractive Chaos <attractor at 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"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <assert.h>
+#include <sys/types.h>
+#include "bgzf.h"
+
+#ifdef _USE_KNETFILE
+#include "knetfile.h"
+typedef knetFile *_bgzf_file_t;
+#define _bgzf_open(fn, mode) knet_open(fn, mode)
+#define _bgzf_dopen(fp, mode) knet_dopen(fp, mode)
+#define _bgzf_close(fp) knet_close(fp)
+#define _bgzf_fileno(fp) ((fp)->fd)
+#define _bgzf_tell(fp) knet_tell(fp)
+#define _bgzf_seek(fp, offset, whence) knet_seek(fp, offset, whence)
+#define _bgzf_read(fp, buf, len) knet_read(fp, buf, len)
+#define _bgzf_write(fp, buf, len) knet_write(fp, buf, len)
+#else // ~defined(_USE_KNETFILE)
+#if defined(_WIN32) || defined(_MSC_VER)
+#define ftello(fp) ftell(fp)
+#define fseeko(fp, offset, whence) fseek(fp, offset, whence)
+#else // ~defined(_WIN32)
+extern off_t ftello(FILE *stream);
+extern int fseeko(FILE *stream, off_t offset, int whence);
+#endif // ~defined(_WIN32)
+typedef FILE *_bgzf_file_t;
+#define _bgzf_open(fn, mode) fopen(fn, mode)
+#define _bgzf_dopen(fp, mode) fdopen(fp, mode)
+#define _bgzf_close(fp) fclose(fp)
+#define _bgzf_fileno(fp) fileno(fp)
+#define _bgzf_tell(fp) ftello(fp)
+#define _bgzf_seek(fp, offset, whence) fseeko(fp, offset, whence)
+#define _bgzf_read(fp, buf, len) fread(buf, 1, len, fp)
+#define _bgzf_write(fp, buf, len) fwrite(buf, 1, len, fp)
+#endif // ~define(_USE_KNETFILE)
+
+#define BLOCK_HEADER_LENGTH 18
+#define BLOCK_FOOTER_LENGTH 8
+
+/* BGZF/GZIP header (speciallized from RFC 1952; little endian):
+ +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+ | 31|139|  8|  4|              0|  0|255|      6| 66| 67|      2|BLK_LEN|
+ +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+*/
+static const uint8_t g_magic[19] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\0\0";
+
+#ifdef BGZF_CACHE
+typedef struct {
+	int size;
+	uint8_t *block;
+	int64_t end_offset;
+} cache_t;
+#include "khash.h"
+KHASH_MAP_INIT_INT64(cache, cache_t)
+#endif
+
+static inline void packInt16(uint8_t *buffer, uint16_t value)
+{
+	buffer[0] = value;
+	buffer[1] = value >> 8;
+}
+
+static inline int unpackInt16(const uint8_t *buffer)
+{
+	return buffer[0] | buffer[1] << 8;
+}
+
+static inline void packInt32(uint8_t *buffer, uint32_t value)
+{
+	buffer[0] = value;
+	buffer[1] = value >> 8;
+	buffer[2] = value >> 16;
+	buffer[3] = value >> 24;
+}
+
+static BGZF *bgzf_read_init()
+{
+	BGZF *fp;
+	fp = calloc(1, sizeof(BGZF));
+	fp->open_mode = 'r';
+	fp->uncompressed_block = malloc(BGZF_BLOCK_SIZE);
+	fp->compressed_block = malloc(BGZF_BLOCK_SIZE);
+#ifdef BGZF_CACHE
+	fp->cache = kh_init(cache);
+#endif
+	return fp;
+}
+
+static BGZF *bgzf_write_init(int compress_level) // compress_level==-1 for the default level
+{
+	BGZF *fp;
+	fp = calloc(1, sizeof(BGZF));
+	fp->open_mode = 'w';
+	fp->uncompressed_block = malloc(BGZF_BLOCK_SIZE);
+	fp->compressed_block = malloc(BGZF_BLOCK_SIZE);
+	fp->compress_level = compress_level < 0? Z_DEFAULT_COMPRESSION : compress_level; // Z_DEFAULT_COMPRESSION==-1
+	if (fp->compress_level > 9) fp->compress_level = Z_DEFAULT_COMPRESSION;
+	return fp;
+}
+// get the compress level from the mode string
+static int mode2level(const char *__restrict mode)
+{
+	int i, compress_level = -1;
+	for (i = 0; mode[i]; ++i)
+		if (mode[i] >= '0' && mode[i] <= '9') break;
+	if (mode[i]) compress_level = (int)mode[i] - '0';
+	if (strchr(mode, 'u')) compress_level = 0;
+	return compress_level;
+}
+
+BGZF *bgzf_open(const char *path, const char *mode)
+{
+	BGZF *fp = 0;
+	if (strchr(mode, 'r') || strchr(mode, 'R')) {
+		_bgzf_file_t fpr;
+		if ((fpr = _bgzf_open(path, "r")) == 0) return 0;
+		fp = bgzf_read_init();
+		fp->fp = fpr;
+	} else if (strchr(mode, 'w') || strchr(mode, 'W')) {
+		FILE *fpw;
+		if ((fpw = fopen(path, "w")) == 0) return 0;
+		fp = bgzf_write_init(mode2level(mode));
+		fp->fp = fpw;
+	}
+	return fp;
+}
+
+BGZF *bgzf_dopen(int fd, const char *mode)
+{
+	BGZF *fp = 0;
+	if (strchr(mode, 'r') || strchr(mode, 'R')) {
+		_bgzf_file_t fpr;
+		if ((fpr = _bgzf_dopen(fd, "r")) == 0) return 0;
+		fp = bgzf_read_init();
+		fp->fp = fpr;
+	} else if (strchr(mode, 'w') || strchr(mode, 'W')) {
+		FILE *fpw;
+		if ((fpw = fdopen(fd, "w")) == 0) return 0;
+		fp = bgzf_write_init(mode2level(mode));
+		fp->fp = fpw;
+	}
+	return fp;
+}
+
+// Deflate the block in fp->uncompressed_block into fp->compressed_block. Also adds an extra field that stores the compressed block length.
+static int deflate_block(BGZF *fp, int block_length)
+{
+	uint8_t *buffer = fp->compressed_block;
+	int buffer_size = BGZF_BLOCK_SIZE;
+	int input_length = block_length;
+	int compressed_length = 0;
+	int remaining;
+	uint32_t crc;
+
+	assert(block_length <= BGZF_BLOCK_SIZE); // guaranteed by the caller
+	memcpy(buffer, g_magic, BLOCK_HEADER_LENGTH); // the last two bytes are a place holder for the length of the block
+	while (1) { // loop to retry for blocks that do not compress enough
+		int status;
+		z_stream zs;
+		zs.zalloc = NULL;
+		zs.zfree = NULL;
+		zs.next_in = fp->uncompressed_block;
+		zs.avail_in = input_length;
+		zs.next_out = (void*)&buffer[BLOCK_HEADER_LENGTH];
+		zs.avail_out = buffer_size - BLOCK_HEADER_LENGTH - BLOCK_FOOTER_LENGTH;
+		status = deflateInit2(&zs, fp->compress_level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); // -15 to disable zlib header/footer
+		if (status != Z_OK) {
+			fp->errcode |= BGZF_ERR_ZLIB;
+			return -1;
+		}
+		status = deflate(&zs, Z_FINISH);
+		if (status != Z_STREAM_END) { // not compressed enough
+			deflateEnd(&zs); // reset the stream
+			if (status == Z_OK) { // reduce the size and recompress
+				input_length -= 1024;
+				assert(input_length > 0); // logically, this should not happen
+				continue;
+			}
+			fp->errcode |= BGZF_ERR_ZLIB;
+			return -1;
+		}
+		if (deflateEnd(&zs) != Z_OK) {
+			fp->errcode |= BGZF_ERR_ZLIB;
+			return -1;
+		}
+		compressed_length = zs.total_out;
+		compressed_length += BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH;
+		assert(compressed_length <= BGZF_BLOCK_SIZE);
+		break;
+	}
+
+	assert(compressed_length > 0);
+	packInt16((uint8_t*)&buffer[16], compressed_length - 1); // write the compressed_length; -1 to fit 2 bytes
+	crc = crc32(0L, NULL, 0L);
+	crc = crc32(crc, fp->uncompressed_block, input_length);
+	packInt32((uint8_t*)&buffer[compressed_length-8], crc);
+	packInt32((uint8_t*)&buffer[compressed_length-4], input_length);
+
+	remaining = block_length - input_length;
+	if (remaining > 0) {
+		assert(remaining <= input_length);
+		memcpy(fp->uncompressed_block, fp->uncompressed_block + input_length, remaining);
+	}
+	fp->block_offset = remaining;
+	return compressed_length;
+}
+
+// Inflate the block in fp->compressed_block into fp->uncompressed_block
+static int inflate_block(BGZF* fp, int block_length)
+{
+	z_stream zs;
+	zs.zalloc = NULL;
+	zs.zfree = NULL;
+	zs.next_in = fp->compressed_block + 18;
+	zs.avail_in = block_length - 16;
+	zs.next_out = fp->uncompressed_block;
+	zs.avail_out = BGZF_BLOCK_SIZE;
+
+	if (inflateInit2(&zs, -15) != Z_OK) {
+		fp->errcode |= BGZF_ERR_ZLIB;
+		return -1;
+	}
+	if (inflate(&zs, Z_FINISH) != Z_STREAM_END) {
+		inflateEnd(&zs);
+		fp->errcode |= BGZF_ERR_ZLIB;
+		return -1;
+	}
+	if (inflateEnd(&zs) != Z_OK) {
+		fp->errcode |= BGZF_ERR_ZLIB;
+		return -1;
+	}
+	return zs.total_out;
+}
+
+static int check_header(const uint8_t *header)
+{
+	return (header[0] == 31 && header[1] == 139 && header[2] == 8 && (header[3] & 4) != 0
+			&& unpackInt16((uint8_t*)&header[10]) == 6
+			&& header[12] == 'B' && header[13] == 'C'
+			&& unpackInt16((uint8_t*)&header[14]) == 2);
+}
+
+#ifdef BGZF_CACHE
+static void free_cache(BGZF *fp)
+{
+	khint_t k;
+	khash_t(cache) *h = (khash_t(cache)*)fp->cache;
+	if (fp->open_mode != 'r') return;
+	for (k = kh_begin(h); k < kh_end(h); ++k)
+		if (kh_exist(h, k)) free(kh_val(h, k).block);
+	kh_destroy(cache, h);
+}
+
+static int load_block_from_cache(BGZF *fp, int64_t block_address)
+{
+	khint_t k;
+	cache_t *p;
+	khash_t(cache) *h = (khash_t(cache)*)fp->cache;
+	k = kh_get(cache, h, block_address);
+	if (k == kh_end(h)) return 0;
+	p = &kh_val(h, k);
+	if (fp->block_length != 0) fp->block_offset = 0;
+	fp->block_address = block_address;
+	fp->block_length = p->size;
+	memcpy(fp->uncompressed_block, p->block, BGZF_BLOCK_SIZE);
+	_bgzf_seek((_bgzf_file_t)fp->fp, p->end_offset, SEEK_SET);
+	return p->size;
+}
+
+static void cache_block(BGZF *fp, int size)
+{
+	int ret;
+	khint_t k;
+	cache_t *p;
+	khash_t(cache) *h = (khash_t(cache)*)fp->cache;
+	if (BGZF_BLOCK_SIZE >= fp->cache_size) return;
+	if ((kh_size(h) + 1) * BGZF_BLOCK_SIZE > fp->cache_size) {
+		/* A better way would be to remove the oldest block in the
+		 * cache, but here we remove a random one for simplicity. This
+		 * should not have a big impact on performance. */
+		for (k = kh_begin(h); k < kh_end(h); ++k)
+			if (kh_exist(h, k)) break;
+		if (k < kh_end(h)) {
+			free(kh_val(h, k).block);
+			kh_del(cache, h, k);
+		}
+	}
+	k = kh_put(cache, h, fp->block_address, &ret);
+	if (ret == 0) return; // if this happens, a bug!
+	p = &kh_val(h, k);
+	p->size = fp->block_length;
+	p->end_offset = fp->block_address + size;
+	p->block = malloc(BGZF_BLOCK_SIZE);
+	memcpy(kh_val(h, k).block, fp->uncompressed_block, BGZF_BLOCK_SIZE);
+}
+#else
+static void free_cache(BGZF *fp) {}
+static int load_block_from_cache(BGZF *fp, int64_t block_address) {return 0;}
+static void cache_block(BGZF *fp, int size) {}
+#endif
+
+int bgzf_read_block(BGZF *fp)
+{
+	uint8_t header[BLOCK_HEADER_LENGTH], *compressed_block;
+	int count, size = 0, block_length, remaining;
+	int64_t block_address;
+	block_address = _bgzf_tell((_bgzf_file_t)fp->fp);
+	if (load_block_from_cache(fp, block_address)) return 0;
+	count = _bgzf_read(fp->fp, header, sizeof(header));
+	if (count == 0) { // no data read
+		fp->block_length = 0;
+		return 0;
+	}
+	if (count != sizeof(header) || !check_header(header)) {
+		fp->errcode |= BGZF_ERR_HEADER;
+		return -1;
+	}
+	size = count;
+	block_length = unpackInt16((uint8_t*)&header[16]) + 1; // +1 because when writing this number, we used "-1"
+	compressed_block = (uint8_t*)fp->compressed_block;
+	memcpy(compressed_block, header, BLOCK_HEADER_LENGTH);
+	remaining = block_length - BLOCK_HEADER_LENGTH;
+	count = _bgzf_read(fp->fp, &compressed_block[BLOCK_HEADER_LENGTH], remaining);
+	if (count != remaining) {
+		fp->errcode |= BGZF_ERR_IO;
+		return -1;
+	}
+	size += count;
+	if ((count = inflate_block(fp, block_length)) < 0) return -1;
+	if (fp->block_length != 0) fp->block_offset = 0; // Do not reset offset if this read follows a seek.
+	fp->block_address = block_address;
+	fp->block_length = count;
+	cache_block(fp, size);
+	return 0;
+}
+
+ssize_t bgzf_read(BGZF *fp, void *data, ssize_t length)
+{
+	ssize_t bytes_read = 0;
+	uint8_t *output = data;
+	if (length <= 0) return 0;
+	assert(fp->open_mode == 'r');
+	while (bytes_read < length) {
+		int copy_length, available = fp->block_length - fp->block_offset;
+		uint8_t *buffer;
+		if (available <= 0) {
+			if (bgzf_read_block(fp) != 0) return -1;
+			available = fp->block_length - fp->block_offset;
+			if (available <= 0) break;
+		}
+		copy_length = length - bytes_read < available? length - bytes_read : available;
+		buffer = fp->uncompressed_block;
+		memcpy(output, buffer + fp->block_offset, copy_length);
+		fp->block_offset += copy_length;
+		output += copy_length;
+		bytes_read += copy_length;
+	}
+	if (fp->block_offset == fp->block_length) {
+		fp->block_address = _bgzf_tell((_bgzf_file_t)fp->fp);
+		fp->block_offset = fp->block_length = 0;
+	}
+	return bytes_read;
+}
+
+int bgzf_flush(BGZF *fp)
+{
+	assert(fp->open_mode == 'w');
+	while (fp->block_offset > 0) {
+		int block_length;
+		block_length = deflate_block(fp, fp->block_offset);
+		if (block_length < 0) return -1;
+		if (fwrite(fp->compressed_block, 1, block_length, fp->fp) != block_length) {
+			fp->errcode |= BGZF_ERR_IO; // possibly truncated file
+			return -1;
+		}
+		fp->block_address += block_length;
+	}
+	return 0;
+}
+
+int bgzf_flush_try(BGZF *fp, ssize_t size)
+{
+	if (fp->block_offset + size > BGZF_BLOCK_SIZE)
+		return bgzf_flush(fp);
+	return -1;
+}
+
+ssize_t bgzf_write(BGZF *fp, const void *data, ssize_t length)
+{
+	const uint8_t *input = data;
+	int block_length = BGZF_BLOCK_SIZE, bytes_written;
+	assert(fp->open_mode == 'w');
+	input = data;
+	bytes_written = 0;
+	while (bytes_written < length) {
+		uint8_t* buffer = fp->uncompressed_block;
+		int copy_length = block_length - fp->block_offset < length - bytes_written? block_length - fp->block_offset : length - bytes_written;
+		memcpy(buffer + fp->block_offset, input, copy_length);
+		fp->block_offset += copy_length;
+		input += copy_length;
+		bytes_written += copy_length;
+		if (fp->block_offset == block_length && bgzf_flush(fp)) break;
+	}
+	return bytes_written;
+}
+
+int bgzf_close(BGZF* fp)
+{
+	int ret, count, block_length;
+	if (fp == 0) return -1;
+	if (fp->open_mode == 'w') {
+		if (bgzf_flush(fp) != 0) return -1;
+		block_length = deflate_block(fp, 0); // write an empty block
+		count = fwrite(fp->compressed_block, 1, block_length, fp->fp);
+		if (fflush(fp->fp) != 0) {
+			fp->errcode |= BGZF_ERR_IO;
+			return -1;
+		}
+	}
+	ret = fp->open_mode == 'w'? fclose(fp->fp) : _bgzf_close(fp->fp);
+	if (ret != 0) return -1;
+	free(fp->uncompressed_block);
+	free(fp->compressed_block);
+	free_cache(fp);
+	free(fp);
+	return 0;
+}
+
+void bgzf_set_cache_size(BGZF *fp, int cache_size)
+{
+	if (fp) fp->cache_size = cache_size;
+}
+
+int bgzf_check_EOF(BGZF *fp)
+{
+	static uint8_t magic[28] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0";
+	uint8_t buf[28];
+	off_t offset;
+	offset = _bgzf_tell((_bgzf_file_t)fp->fp);
+	if (_bgzf_seek(fp->fp, -28, SEEK_END) < 0) return 0;
+	_bgzf_read(fp->fp, buf, 28);
+	_bgzf_seek(fp->fp, offset, SEEK_SET);
+	return (memcmp(magic, buf, 28) == 0)? 1 : 0;
+}
+
+int64_t bgzf_seek(BGZF* fp, int64_t pos, int where)
+{
+	int block_offset;
+	int64_t block_address;
+
+	if (fp->open_mode != 'r' || where != SEEK_SET) {
+		fp->errcode |= BGZF_ERR_MISUSE;
+		return -1;
+	}
+	block_offset = pos & 0xFFFF;
+	block_address = pos >> 16;
+	if (_bgzf_seek(fp->fp, block_address, SEEK_SET) < 0) {
+		fp->errcode |= BGZF_ERR_IO;
+		return -1;
+	}
+	fp->block_length = 0;  // indicates current block has not been loaded
+	fp->block_address = block_address;
+	fp->block_offset = block_offset;
+	return 0;
+}
+
+int bgzf_is_bgzf(const char *fn)
+{
+	uint8_t buf[16];
+	int n;
+	_bgzf_file_t fp;
+	if ((fp = _bgzf_open(fn, "r")) == 0) return 0;
+	n = _bgzf_read(fp, buf, 16);
+	_bgzf_close(fp);
+	if (n != 16) return 0;
+	return memcmp(g_magic, buf, 16) == 0? 1 : 0;
+}
+
+int bgzf_getc(BGZF *fp)
+{
+	int c;
+	if (fp->block_offset >= fp->block_length) {
+		if (bgzf_read_block(fp) != 0) return -2; /* error */
+		if (fp->block_length == 0) return -1; /* end-of-file */
+	}
+	c = ((unsigned char*)fp->uncompressed_block)[fp->block_offset++];
+    if (fp->block_offset == fp->block_length) {
+        fp->block_address = _bgzf_tell((_bgzf_file_t)fp->fp);
+        fp->block_offset = 0;
+        fp->block_length = 0;
+    }
+	return c;
+}
+
+#ifndef kroundup32
+#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
+#endif
+
+int bgzf_getline(BGZF *fp, int delim, kstring_t *str)
+{
+	int l, state = 0;
+	unsigned char *buf = (unsigned char*)fp->uncompressed_block;
+	str->l = 0;
+	do {
+		if (fp->block_offset >= fp->block_length) {
+			if (bgzf_read_block(fp) != 0) { state = -2; break; }
+			if (fp->block_length == 0) { state = -1; break; }
+		}
+		for (l = fp->block_offset; l < fp->block_length && buf[l] != delim; ++l);
+		if (l < fp->block_length) state = 1;
+		l -= fp->block_offset;
+		if (str->l + l + 1 >= str->m) {
+			str->m = str->l + l + 2;
+			kroundup32(str->m);
+			str->s = (char*)realloc(str->s, str->m);
+		}
+		memcpy(str->s + str->l, buf + fp->block_offset, l);
+		str->l += l;
+		fp->block_offset += l + 1;
+		if (fp->block_offset >= fp->block_length) {
+			fp->block_address = _bgzf_tell((_bgzf_file_t)fp->fp);
+			fp->block_offset = 0;
+			fp->block_length = 0;
+		} 
+	} while (state == 0);
+	if (str->l == 0 && state < 0) return state;
+	str->s[str->l] = 0;
+	return str->l;
+}
diff --git a/tabix/bgzip.c b/tabix/bgzip.c
new file mode 100644
index 0000000..5429a22
--- /dev/null
+++ b/tabix/bgzip.c
@@ -0,0 +1,206 @@
+/* The MIT License
+
+   Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology
+
+   Permission is hereby granted, free of charge, to any person obtaining a copy
+   of this software and associated documentation files (the "Software"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/select.h>
+#include <sys/stat.h>
+#include "bgzf.h"
+
+static const int WINDOW_SIZE = 64 * 1024;
+
+static int bgzip_main_usage()
+{
+	fprintf(stderr, "\n");
+	fprintf(stderr, "Usage:   bgzip [options] [file] ...\n\n");
+	fprintf(stderr, "Options: -c      write on standard output, keep original files unchanged\n");
+	fprintf(stderr, "         -d      decompress\n");
+	fprintf(stderr, "         -f      overwrite files without asking\n");
+	fprintf(stderr, "         -b INT  decompress at virtual file pointer INT\n");
+	fprintf(stderr, "         -s INT  decompress INT bytes in the uncompressed file\n");
+	fprintf(stderr, "         -h      give this help\n");
+	fprintf(stderr, "\n");
+	return 1;
+}
+
+static int write_open(const char *fn, int is_forced)
+{
+	int fd = -1;
+	char c;
+	if (!is_forced) {
+		if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0666)) < 0 && errno == EEXIST) {
+			fprintf(stderr, "[bgzip] %s already exists; do you wish to overwrite (y or n)? ", fn);
+			scanf("%c", &c);
+			if (c != 'Y' && c != 'y') {
+				fprintf(stderr, "[bgzip] not overwritten\n");
+				exit(1);
+			}
+		}
+	}
+	if (fd < 0) {
+		if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
+			fprintf(stderr, "[bgzip] %s: Fail to write\n", fn);
+			exit(1);
+		}
+	}
+	return fd;
+}
+
+static void fail(BGZF* fp)
+{
+    fprintf(stderr, "Error: %d\n", fp->errcode);
+    exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	int c, compress, pstdout, is_forced;
+	BGZF *fp;
+	void *buffer;
+	long start, end, size;
+
+	compress = 1; pstdout = 0; start = 0; size = -1; end = -1; is_forced = 0;
+	while((c  = getopt(argc, argv, "cdhfb:s:")) >= 0){
+		switch(c){
+		case 'h': return bgzip_main_usage();
+		case 'd': compress = 0; break;
+		case 'c': pstdout = 1; break;
+		case 'b': start = atol(optarg); break;
+		case 's': size = atol(optarg); break;
+		case 'f': is_forced = 1; break;
+		}
+	}
+	if (size >= 0) end = start + size;
+	if (end >= 0 && end < start) {
+		fprintf(stderr, "[bgzip] Illegal region: [%ld, %ld]\n", start, end);
+		return 1;
+	}
+	if (compress == 1) {
+		struct stat sbuf;
+		int f_src = fileno(stdin);
+		int f_dst = fileno(stdout);
+
+		if ( argc>optind )
+		{
+			if ( stat(argv[optind],&sbuf)<0 ) 
+			{ 
+				fprintf(stderr, "[bgzip] %s: %s\n", strerror(errno), argv[optind]);
+				return 1; 
+			}
+
+			if ((f_src = open(argv[optind], O_RDONLY)) < 0) {
+				fprintf(stderr, "[bgzip] %s: %s\n", strerror(errno), argv[optind]);
+				return 1;
+			}
+
+			if (pstdout)
+				f_dst = fileno(stdout);
+			else
+			{
+				char *name = malloc(strlen(argv[optind]) + 5);
+				strcpy(name, argv[optind]);
+				strcat(name, ".gz");
+				f_dst = write_open(name, is_forced);
+				if (f_dst < 0) return 1;
+				free(name);
+			}
+		}
+		else if (!pstdout && isatty(fileno((FILE *)stdout)) )
+			return bgzip_main_usage();
+
+		fp = bgzf_dopen(f_dst, "w");
+		buffer = malloc(WINDOW_SIZE);
+		while ((c = read(f_src, buffer, WINDOW_SIZE)) > 0)
+			if (bgzf_write(fp, buffer, c) < 0) fail(fp);
+		// f_dst will be closed here
+		if (bgzf_close(fp) < 0) fail(fp);
+		if (argc > optind && !pstdout) unlink(argv[optind]);
+		free(buffer);
+		close(f_src);
+		return 0;
+	} else {
+		struct stat sbuf;
+		int f_dst;
+
+		if ( argc>optind )
+		{
+			if ( stat(argv[optind],&sbuf)<0 )
+			{
+				fprintf(stderr, "[bgzip] %s: %s\n", strerror(errno), argv[optind]);
+				return 1;
+			}
+			char *name;
+			int len = strlen(argv[optind]);
+			if ( strcmp(argv[optind]+len-3,".gz") )
+			{
+				fprintf(stderr, "[bgzip] %s: unknown suffix -- ignored\n", argv[optind]);
+				return 1;
+			}
+			fp = bgzf_open(argv[optind], "r");
+			if (fp == NULL) {
+				fprintf(stderr, "[bgzip] Could not open file: %s\n", argv[optind]);
+				return 1;
+			}
+
+			if (pstdout) {
+				f_dst = fileno(stdout);
+			}
+			else {
+				name = strdup(argv[optind]);
+				name[strlen(name) - 3] = '\0';
+				f_dst = write_open(name, is_forced);
+				free(name);
+			}
+		}
+		else if (!pstdout && isatty(fileno((FILE *)stdin)) )
+			return bgzip_main_usage();
+		else
+		{
+			f_dst = fileno(stdout);
+			fp = bgzf_dopen(fileno(stdin), "r");
+			if (fp == NULL) {
+				fprintf(stderr, "[bgzip] Could not read from stdin: %s\n", strerror(errno));
+				return 1;
+			}
+		}
+		buffer = malloc(WINDOW_SIZE);
+		if (bgzf_seek(fp, start, SEEK_SET) < 0) fail(fp);
+		while (1) {
+			if (end < 0) c = bgzf_read(fp, buffer, WINDOW_SIZE);
+			else c = bgzf_read(fp, buffer, (end - start > WINDOW_SIZE)? WINDOW_SIZE:(end - start));
+			if (c == 0) break;
+			if (c < 0) fail(fp);
+			start += c;
+			write(f_dst, buffer, c);
+			if (end >= 0 && start >= end) break;
+		}
+		free(buffer);
+		if (bgzf_close(fp) < 0) fail(fp);
+		if (!pstdout) unlink(argv[optind]);
+		return 0;
+	}
+}
diff --git a/tabix/index.c b/tabix/index.c
new file mode 100644
index 0000000..15cd65e
--- /dev/null
+++ b/tabix/index.c
@@ -0,0 +1,967 @@
+#include <ctype.h>
+#include <assert.h>
+#include <sys/stat.h>
+#include "khash.h"
+#include "ksort.h"
+#include "kstring.h"
+#include "bam_endian.h"
+#ifdef _USE_KNETFILE
+#include "knetfile.h"
+#endif
+#include "tabix.h"
+
+#define TAD_MIN_CHUNK_GAP 32768
+// 1<<14 is the size of minimum bin.
+#define TAD_LIDX_SHIFT    14
+
+typedef struct {
+	uint64_t u, v;
+} pair64_t;
+
+#define pair64_lt(a,b) ((a).u < (b).u)
+KSORT_INIT(offt, pair64_t, pair64_lt)
+
+typedef struct {
+	uint32_t m, n;
+	pair64_t *list;
+} ti_binlist_t;
+
+typedef struct {
+	int32_t n, m;
+	uint64_t *offset;
+} ti_lidx_t;
+
+KHASH_MAP_INIT_INT(i, ti_binlist_t)
+KHASH_MAP_INIT_STR(s, int)
+
+struct __ti_index_t {
+	ti_conf_t conf;
+	int32_t n, max;
+	khash_t(s) *tname;
+	khash_t(i) **index;
+	ti_lidx_t *index2;
+};
+
+struct __ti_iter_t {
+	int from_first; // read from the first record; no random access
+	int tid, beg, end, n_off, i, finished;
+	uint64_t curr_off;
+	kstring_t str;
+	const ti_index_t *idx;
+	pair64_t *off;
+};
+
+typedef struct {
+	int tid, beg, end, bin;
+} ti_intv_t;
+
+ti_conf_t ti_conf_gff = { 0, 1, 4, 5, '#', 0 };
+ti_conf_t ti_conf_bed = { TI_FLAG_UCSC, 1, 2, 3, '#', 0 };
+ti_conf_t ti_conf_psltbl = { TI_FLAG_UCSC, 15, 17, 18, '#', 0 };
+ti_conf_t ti_conf_sam = { TI_PRESET_SAM, 3, 4, 0, '@', 0 };
+ti_conf_t ti_conf_vcf = { TI_PRESET_VCF, 1, 2, 0, '#', 0 };
+
+/***************
+ * read a line *
+ ***************/
+
+/*
+int ti_readline(BGZF *fp, kstring_t *str)
+{
+	int c, l = 0;
+	str->l = 0;
+	while ((c = bgzf_getc(fp)) >= 0 && c != '\n') {
+		++l;
+		if (c != '\r') kputc(c, str);
+	}
+	if (c < 0 && l == 0) return -1; // end of file
+	return str->l;
+}
+*/
+
+/* Below is a faster implementation largely equivalent to the one
+ * commented out above. */
+int ti_readline(BGZF *fp, kstring_t *str)
+{
+	return bgzf_getline(fp, '\n', str);
+}
+
+/*************************************
+ * get the interval from a data line *
+ *************************************/
+
+static inline int ti_reg2bin(uint32_t beg, uint32_t end)
+{
+	--end;
+	if (beg>>14 == end>>14) return 4681 + (beg>>14);
+	if (beg>>17 == end>>17) return  585 + (beg>>17);
+	if (beg>>20 == end>>20) return   73 + (beg>>20);
+	if (beg>>23 == end>>23) return    9 + (beg>>23);
+	if (beg>>26 == end>>26) return    1 + (beg>>26);
+	return 0;
+}
+
+static int get_tid(ti_index_t *idx, const char *ss)
+{
+	khint_t k;
+	int tid;
+	k = kh_get(s, idx->tname, ss);
+	if (k == kh_end(idx->tname)) { // a new target sequence
+		int ret, size;
+		// update idx->n, ->max, ->index and ->index2
+		if (idx->n == idx->max) {
+			idx->max = idx->max? idx->max<<1 : 8;
+			idx->index = realloc(idx->index, idx->max * sizeof(void*));
+			idx->index2 = realloc(idx->index2, idx->max * sizeof(ti_lidx_t));
+		}
+		memset(&idx->index2[idx->n], 0, sizeof(ti_lidx_t));
+		idx->index[idx->n++] = kh_init(i);
+		// update ->tname
+		tid = size = kh_size(idx->tname);
+		k = kh_put(s, idx->tname, strdup(ss), &ret);
+		kh_value(idx->tname, k) = size;
+		assert(idx->n == kh_size(idx->tname));
+	} else tid = kh_value(idx->tname, k);
+	return tid;
+}
+
+int ti_get_intv(const ti_conf_t *conf, int len, char *line, ti_interval_t *intv)
+{
+	int i, b = 0, id = 1, ncols = 0;
+	char *s;
+	intv->ss = intv->se = 0; intv->beg = intv->end = -1;
+	for (i = 0; i <= len; ++i) {
+		if (line[i] == '\t' || line[i] == 0) {
+            ++ncols;
+			if (id == conf->sc) {
+				intv->ss = line + b; intv->se = line + i;
+			} else if (id == conf->bc) {
+				// here ->beg is 0-based.
+				intv->beg = intv->end = strtol(line + b, &s, 0);
+				if (!(conf->preset&TI_FLAG_UCSC)) --intv->beg;
+				else ++intv->end;
+				if (intv->beg < 0) intv->beg = 0;
+				if (intv->end < 1) intv->end = 1;
+			} else {
+				if ((conf->preset&0xffff) == TI_PRESET_GENERIC) {
+					if (id == conf->ec) intv->end = strtol(line + b, &s, 0);
+				} else if ((conf->preset&0xffff) == TI_PRESET_SAM) {
+					if (id == 6) { // CIGAR
+						int l = 0, op;
+						char *t;
+						for (s = line + b; s < line + i;) {
+							long x = strtol(s, &t, 10);
+							op = toupper(*t);
+							if (op == 'M' || op == 'D' || op == 'N') l += x;
+							s = t + 1;
+						}
+						if (l == 0) l = 1;
+						intv->end = intv->beg + l;
+					}
+				} else if ((conf->preset&0xffff) == TI_PRESET_VCF) {
+					// FIXME: the following is NOT tested and is likely to be buggy
+					if (id == 4) {
+						if (b < i) intv->end = intv->beg + (i - b);
+					} else if (id == 8) { // look for "END="
+						int c = line[i];
+						line[i] = 0;
+						s = strstr(line + b, "END=");
+						if (s == line + b) s += 4;
+						else if (s) {
+							s = strstr(line + b, ";END=");
+							if (s) s += 5;
+						}
+						if (s) intv->end = strtol(s, &s, 0);
+						line[i] = c;
+					}
+				}
+			}
+			b = i + 1;
+			++id;
+		}
+	}
+/*
+	if (ncols < conf->sc || ncols < conf->bc || ncols < conf->ec) {
+		if (ncols == 1) fprintf(stderr,"[get_intv] Is the file tab-delimited? The line has %d field only: %s\n", ncols, line);
+		else fprintf(stderr,"[get_intv] The line has %d field(s) only: %s\n", ncols, line);
+		exit(1);
+	}
+*/
+	if (intv->ss == 0 || intv->se == 0 || intv->beg < 0 || intv->end < 0) return -1;
+	return 0;
+}
+
+static int get_intv(ti_index_t *idx, kstring_t *str, ti_intv_t *intv)
+{
+	ti_interval_t x;
+	intv->tid = intv->beg = intv->end = intv->bin = -1;
+	if (ti_get_intv(&idx->conf, str->l, str->s, &x) == 0) {
+		int c = *x.se;
+		*x.se = '\0'; intv->tid = get_tid(idx, x.ss); *x.se = c;
+		intv->beg = x.beg; intv->end = x.end;
+		intv->bin = ti_reg2bin(intv->beg, intv->end);
+		return (intv->tid >= 0 && intv->beg >= 0 && intv->end >= 0)? 0 : -1;
+	} else {
+		fprintf(stderr, "[%s] the following line cannot be parsed and skipped: %s\n", __func__, str->s);
+		return -1;
+	}
+}
+
+/************
+ * indexing *
+ ************/
+
+// requirement: len <= LEN_MASK
+static inline void insert_offset(khash_t(i) *h, int bin, uint64_t beg, uint64_t end)
+{
+	khint_t k;
+	ti_binlist_t *l;
+	int ret;
+	k = kh_put(i, h, bin, &ret);
+	l = &kh_value(h, k);
+	if (ret) { // not present
+		l->m = 1; l->n = 0;
+		l->list = (pair64_t*)calloc(l->m, 16);
+	}
+	if (l->n == l->m) {
+		l->m <<= 1;
+		l->list = (pair64_t*)realloc(l->list, l->m * 16);
+	}
+	l->list[l->n].u = beg; l->list[l->n++].v = end;
+}
+
+static inline uint64_t insert_offset2(ti_lidx_t *index2, int _beg, int _end, uint64_t offset)
+{
+	int i, beg, end;
+	beg = _beg >> TAD_LIDX_SHIFT;
+	end = (_end - 1) >> TAD_LIDX_SHIFT;
+	if (index2->m < end + 1) {
+		int old_m = index2->m;
+		index2->m = end + 1;
+		kroundup32(index2->m);
+		index2->offset = (uint64_t*)realloc(index2->offset, index2->m * 8);
+		memset(index2->offset + old_m, 0, 8 * (index2->m - old_m));
+	}
+	if (beg == end) {
+		if (index2->offset[beg] == 0) index2->offset[beg] = offset;
+	} else {
+		for (i = beg; i <= end; ++i)
+			if (index2->offset[i] == 0) index2->offset[i] = offset;
+	}
+	if (index2->n < end + 1) index2->n = end + 1;
+	return (uint64_t)beg<<32 | end;
+}
+
+static void merge_chunks(ti_index_t *idx)
+{
+	khash_t(i) *index;
+	int i, l, m;
+	khint_t k;
+	for (i = 0; i < idx->n; ++i) {
+		index = idx->index[i];
+		for (k = kh_begin(index); k != kh_end(index); ++k) {
+			ti_binlist_t *p;
+			if (!kh_exist(index, k)) continue;
+			p = &kh_value(index, k);
+			m = 0;
+			for (l = 1; l < p->n; ++l) {
+				if (p->list[m].v>>16 == p->list[l].u>>16) p->list[m].v = p->list[l].v;
+				else p->list[++m] = p->list[l];
+			} // ~for(l)
+			p->n = m + 1;
+		} // ~for(k)
+	} // ~for(i)
+}
+
+static void fill_missing(ti_index_t *idx)
+{
+	int i, j;
+	for (i = 0; i < idx->n; ++i) {
+		ti_lidx_t *idx2 = &idx->index2[i];
+		for (j = 1; j < idx2->n; ++j)
+			if (idx2->offset[j] == 0)
+				idx2->offset[j] = idx2->offset[j-1];
+	}
+}
+
+ti_index_t *ti_index_core(BGZF *fp, const ti_conf_t *conf)
+{
+	int ret;
+	ti_index_t *idx;
+	uint32_t last_bin, save_bin;
+	int32_t last_coor, last_tid, save_tid;
+	uint64_t save_off, last_off, lineno = 0, offset0 = (uint64_t)-1, tmp;
+	kstring_t *str;
+
+	str = calloc(1, sizeof(kstring_t));
+
+	idx = (ti_index_t*)calloc(1, sizeof(ti_index_t));
+	idx->conf = *conf;
+	idx->n = idx->max = 0;
+	idx->tname = kh_init(s);
+	idx->index = 0;
+	idx->index2 = 0;
+
+	save_bin = save_tid = last_tid = last_bin = 0xffffffffu;
+	save_off = last_off = bgzf_tell(fp); last_coor = 0xffffffffu;
+	while ((ret = ti_readline(fp, str)) >= 0) {
+		ti_intv_t intv;
+		++lineno;
+		if (lineno <= idx->conf.line_skip || str->s[0] == idx->conf.meta_char) {
+			last_off = bgzf_tell(fp);
+			continue;
+		}
+		get_intv(idx, str, &intv);
+        if ( intv.beg<0 || intv.end<0 )
+        {
+            fprintf(stderr,"[ti_index_core] the indexes overlap or are out of bounds\n");
+            exit(1);
+        }
+		if (last_tid != intv.tid) { // change of chromosomes
+            if (last_tid>intv.tid )
+            {
+                fprintf(stderr,"[ti_index_core] the chromosome blocks not continuous at line %llu, is the file sorted? [pos %d]\n",(unsigned long long)lineno,intv.beg+1);
+                exit(1);
+            }
+			last_tid = intv.tid;
+			last_bin = 0xffffffffu;
+		} else if (last_coor > intv.beg) {
+			fprintf(stderr, "[ti_index_core] the file out of order at line %llu\n", (unsigned long long)lineno);
+			exit(1);
+		}
+		tmp = insert_offset2(&idx->index2[intv.tid], intv.beg, intv.end, last_off);
+		if (last_off == 0) offset0 = tmp;
+		if (intv.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);
+			save_off = last_off;
+			save_bin = last_bin = intv.bin;
+			save_tid = intv.tid;
+			if (save_tid < 0) break;
+		}
+		if (bgzf_tell(fp) <= last_off) {
+			fprintf(stderr, "[ti_index_core] bug in BGZF: %llx < %llx\n",
+					(unsigned long long)bgzf_tell(fp), (unsigned long long)last_off);
+			exit(1);
+		}
+		last_off = bgzf_tell(fp);
+		last_coor = intv.beg;
+	}
+	if (save_tid >= 0) insert_offset(idx->index[save_tid], save_bin, save_off, bgzf_tell(fp));
+	merge_chunks(idx);
+	fill_missing(idx);
+	if (offset0 != (uint64_t)-1 && idx->n && idx->index2[0].offset) {
+		int i, beg = offset0>>32, end = offset0&0xffffffffu;
+		for (i = beg; i <= end; ++i) idx->index2[0].offset[i] = 0;
+	}
+
+	free(str->s); free(str);
+	return idx;
+}
+
+void ti_index_destroy(ti_index_t *idx)
+{
+	khint_t k;
+	int i;
+	if (idx == 0) return;
+	// destroy the name hash table
+	for (k = kh_begin(idx->tname); k != kh_end(idx->tname); ++k) {
+		if (kh_exist(idx->tname, k))
+			free((char*)kh_key(idx->tname, k));
+	}
+	kh_destroy(s, idx->tname);
+	// destroy the binning index
+	for (i = 0; i < idx->n; ++i) {
+		khash_t(i) *index = idx->index[i];
+		ti_lidx_t *index2 = idx->index2 + i;
+		for (k = kh_begin(index); k != kh_end(index); ++k) {
+			if (kh_exist(index, k))
+				free(kh_value(index, k).list);
+		}
+		kh_destroy(i, index);
+		free(index2->offset);
+	}
+	free(idx->index);
+	// destroy the linear index
+	free(idx->index2);
+	free(idx);
+}
+
+/******************
+ * index file I/O *
+ ******************/
+
+void ti_index_save(const ti_index_t *idx, BGZF *fp)
+{
+	int32_t i, size, ti_is_be;
+	khint_t k;
+	ti_is_be = bam_is_big_endian();
+	bgzf_write(fp, "TBI\1", 4);
+	if (ti_is_be) {
+		uint32_t x = idx->n;
+		bgzf_write(fp, bam_swap_endian_4p(&x), 4);
+	} else bgzf_write(fp, &idx->n, 4);
+	assert(sizeof(ti_conf_t) == 24);
+	if (ti_is_be) { // write ti_conf_t;
+		uint32_t x[6];
+		memcpy(x, &idx->conf, 24);
+		for (i = 0; i < 6; ++i) bgzf_write(fp, bam_swap_endian_4p(&x[i]), 4);
+	} else bgzf_write(fp, &idx->conf, sizeof(ti_conf_t));
+	{ // write target names
+		char **name;
+		int32_t l = 0;
+		name = calloc(kh_size(idx->tname), sizeof(void*));
+		for (k = kh_begin(idx->tname); k != kh_end(idx->tname); ++k)
+			if (kh_exist(idx->tname, k))
+				name[kh_value(idx->tname, k)] = (char*)kh_key(idx->tname, k);
+		for (i = 0; i < kh_size(idx->tname); ++i)
+			l += strlen(name[i]) + 1;
+		if (ti_is_be) bgzf_write(fp, bam_swap_endian_4p(&l), 4);
+		else bgzf_write(fp, &l, 4);
+		for (i = 0; i < kh_size(idx->tname); ++i)
+			bgzf_write(fp, name[i], strlen(name[i]) + 1);
+		free(name);
+	}
+	for (i = 0; i < idx->n; ++i) {
+		khash_t(i) *index = idx->index[i];
+		ti_lidx_t *index2 = idx->index2 + i;
+		// write binning index
+		size = kh_size(index);
+		if (ti_is_be) { // big endian
+			uint32_t x = size;
+			bgzf_write(fp, bam_swap_endian_4p(&x), 4);
+		} else bgzf_write(fp, &size, 4);
+		for (k = kh_begin(index); k != kh_end(index); ++k) {
+			if (kh_exist(index, k)) {
+				ti_binlist_t *p = &kh_value(index, k);
+				if (ti_is_be) { // big endian
+					uint32_t x;
+					x = kh_key(index, k); bgzf_write(fp, bam_swap_endian_4p(&x), 4);
+					x = p->n; bgzf_write(fp, bam_swap_endian_4p(&x), 4);
+					for (x = 0; (int)x < p->n; ++x) {
+						bam_swap_endian_8p(&p->list[x].u);
+						bam_swap_endian_8p(&p->list[x].v);
+					}
+					bgzf_write(fp, p->list, 16 * p->n);
+					for (x = 0; (int)x < p->n; ++x) {
+						bam_swap_endian_8p(&p->list[x].u);
+						bam_swap_endian_8p(&p->list[x].v);
+					}
+				} else {
+					bgzf_write(fp, &kh_key(index, k), 4);
+					bgzf_write(fp, &p->n, 4);
+					bgzf_write(fp, p->list, 16 * p->n);
+				}
+			}
+		}
+		// write linear index (index2)
+		if (ti_is_be) {
+			int x = index2->n;
+			bgzf_write(fp, bam_swap_endian_4p(&x), 4);
+		} else bgzf_write(fp, &index2->n, 4);
+		if (ti_is_be) { // big endian
+			int x;
+			for (x = 0; (int)x < index2->n; ++x)
+				bam_swap_endian_8p(&index2->offset[x]);
+			bgzf_write(fp, index2->offset, 8 * index2->n);
+			for (x = 0; (int)x < index2->n; ++x)
+				bam_swap_endian_8p(&index2->offset[x]);
+		} else bgzf_write(fp, index2->offset, 8 * index2->n);
+	}
+}
+
+static ti_index_t *ti_index_load_core(BGZF *fp)
+{
+	int i, ti_is_be;
+	char magic[4];
+	ti_index_t *idx;
+	ti_is_be = bam_is_big_endian();
+	if (fp == 0) {
+		fprintf(stderr, "[ti_index_load_core] fail to load index.\n");
+		return 0;
+	}
+	bgzf_read(fp, magic, 4);
+	if (strncmp(magic, "TBI\1", 4)) {
+		fprintf(stderr, "[ti_index_load] wrong magic number.\n");
+		return 0;
+	}
+	idx = (ti_index_t*)calloc(1, sizeof(ti_index_t));	
+	bgzf_read(fp, &idx->n, 4);
+	if (ti_is_be) bam_swap_endian_4p(&idx->n);
+	idx->tname = kh_init(s);
+	idx->index = (khash_t(i)**)calloc(idx->n, sizeof(void*));
+	idx->index2 = (ti_lidx_t*)calloc(idx->n, sizeof(ti_lidx_t));
+	// read idx->conf
+	bgzf_read(fp, &idx->conf, sizeof(ti_conf_t));
+	if (ti_is_be) {
+		bam_swap_endian_4p(&idx->conf.preset);
+		bam_swap_endian_4p(&idx->conf.sc);
+		bam_swap_endian_4p(&idx->conf.bc);
+		bam_swap_endian_4p(&idx->conf.ec);
+		bam_swap_endian_4p(&idx->conf.meta_char);
+		bam_swap_endian_4p(&idx->conf.line_skip);
+	}
+	{ // read target names
+		int j, ret;
+		kstring_t *str;
+		int32_t l;
+		uint8_t *buf;
+		bgzf_read(fp, &l, 4);
+		if (ti_is_be) bam_swap_endian_4p(&l);
+		buf = calloc(l, 1);
+		bgzf_read(fp, buf, l);
+		str = calloc(1, sizeof(kstring_t));
+		for (i = j = 0; i < l; ++i) {
+			if (buf[i] == 0) {
+				khint_t k = kh_put(s, idx->tname, strdup(str->s), &ret);
+				kh_value(idx->tname, k) = j++;
+				str->l = 0;
+			} else kputc(buf[i], str);
+		}
+		free(str->s); free(str); free(buf);
+	}
+	for (i = 0; i < idx->n; ++i) {
+		khash_t(i) *index;
+		ti_lidx_t *index2 = idx->index2 + i;
+		uint32_t key, size;
+		khint_t k;
+		int j, ret;
+		ti_binlist_t *p;
+		index = idx->index[i] = kh_init(i);
+		// load binning index
+		bgzf_read(fp, &size, 4);
+		if (ti_is_be) bam_swap_endian_4p(&size);
+		for (j = 0; j < (int)size; ++j) {
+			bgzf_read(fp, &key, 4);
+			if (ti_is_be) bam_swap_endian_4p(&key);
+			k = kh_put(i, index, key, &ret);
+			p = &kh_value(index, k);
+			bgzf_read(fp, &p->n, 4);
+			if (ti_is_be) bam_swap_endian_4p(&p->n);
+			p->m = p->n;
+			p->list = (pair64_t*)malloc(p->m * 16);
+			bgzf_read(fp, p->list, 16 * p->n);
+			if (ti_is_be) {
+				int x;
+				for (x = 0; x < p->n; ++x) {
+					bam_swap_endian_8p(&p->list[x].u);
+					bam_swap_endian_8p(&p->list[x].v);
+				}
+			}
+		}
+		// load linear index
+		bgzf_read(fp, &index2->n, 4);
+		if (ti_is_be) bam_swap_endian_4p(&index2->n);
+		index2->m = index2->n;
+		index2->offset = (uint64_t*)calloc(index2->m, 8);
+		bgzf_read(fp, index2->offset, index2->n * 8);
+		if (ti_is_be)
+			for (j = 0; j < index2->n; ++j) bam_swap_endian_8p(&index2->offset[j]);
+	}
+	return idx;
+}
+
+ti_index_t *ti_index_load_local(const char *fnidx)
+{
+	BGZF *fp;
+	fp = bgzf_open(fnidx, "r");
+	if (fp) {
+		ti_index_t *idx = ti_index_load_core(fp);
+		bgzf_close(fp);
+		return idx;
+	} else return 0;
+}
+
+#ifdef _USE_KNETFILE
+static void download_from_remote(const char *url)
+{
+	const int buf_size = 1 * 1024 * 1024;
+	char *fn;
+	FILE *fp;
+	uint8_t *buf;
+	knetFile *fp_remote;
+	int l;
+	if (strstr(url, "ftp://") != url && strstr(url, "http://") != url) return;
+	l = strlen(url);
+	for (fn = (char*)url + l - 1; fn >= url; --fn)
+		if (*fn == '/') break;
+	++fn; // fn now points to the file name
+	fp_remote = knet_open(url, "r");
+	if (fp_remote == 0) {
+		fprintf(stderr, "[download_from_remote] fail to open remote file.\n");
+		return;
+	}
+	if ((fp = fopen(fn, "w")) == 0) {
+		fprintf(stderr, "[download_from_remote] fail to create file in the working directory.\n");
+		knet_close(fp_remote);
+		return;
+	}
+	buf = (uint8_t*)calloc(buf_size, 1);
+	while ((l = knet_read(fp_remote, buf, buf_size)) != 0)
+		fwrite(buf, 1, l, fp);
+	free(buf);
+	fclose(fp);
+	knet_close(fp_remote);
+}
+#else
+static void download_from_remote(const char *url)
+{
+	return;
+}
+#endif
+
+static char *get_local_version(const char *fn)
+{
+    struct stat sbuf;
+	char *fnidx = (char*)calloc(strlen(fn) + 5, 1);
+	strcat(strcpy(fnidx, fn), ".tbi");
+	if ((strstr(fnidx, "ftp://") == fnidx || strstr(fnidx, "http://") == fnidx)) {
+		char *p, *url;
+		int l = strlen(fnidx);
+		for (p = fnidx + l - 1; p >= fnidx; --p)
+			if (*p == '/') break;
+		url = fnidx; fnidx = strdup(p + 1);
+		if (stat(fnidx, &sbuf) == 0) {
+			free(url);
+			return fnidx;
+		}
+		fprintf(stderr, "[%s] downloading the index file...\n", __func__);
+		download_from_remote(url);
+		free(url);
+	}
+    if (stat(fnidx, &sbuf) == 0) return fnidx;
+	free(fnidx); return 0;
+}
+
+const char **ti_seqname(const ti_index_t *idx, int *n)
+{
+	const char **names;
+	khint_t k;
+	*n = idx->n;
+	names = calloc(idx->n, sizeof(void*));
+	for (k = kh_begin(idx->tname); k < kh_end(idx->tname); ++k)
+		if (kh_exist(idx->tname, k))
+			names[kh_val(idx->tname, k)] = kh_key(idx->tname, k);
+	return names;
+}
+
+ti_index_t *ti_index_load(const char *fn)
+{
+	ti_index_t *idx;
+    char *fname = get_local_version(fn);
+	if (fname == 0) return 0;
+	idx = ti_index_load_local(fname);
+	if (idx == 0) fprintf(stderr, "[ti_index_load] fail to load the index: %s\n", fname);
+    free(fname);
+	return idx;
+}
+
+int ti_index_build2(const char *fn, const ti_conf_t *conf, const char *_fnidx)
+{
+	char *fnidx;
+	BGZF *fp, *fpidx;
+	ti_index_t *idx;
+	if ((fp = bgzf_open(fn, "r")) == 0) {
+		fprintf(stderr, "[ti_index_build2] fail to open the file: %s\n", fn);
+		return -1;
+	}
+	idx = ti_index_core(fp, conf);
+	bgzf_close(fp);
+	if (_fnidx == 0) {
+		fnidx = (char*)calloc(strlen(fn) + 5, 1);
+		strcpy(fnidx, fn); strcat(fnidx, ".tbi");
+	} else fnidx = strdup(_fnidx);
+	fpidx = bgzf_open(fnidx, "w");
+	if (fpidx == 0) {
+		fprintf(stderr, "[ti_index_build2] fail to create the index file.\n");
+		free(fnidx);
+		return -1;
+	}
+	ti_index_save(idx, fpidx);
+	ti_index_destroy(idx);
+	bgzf_close(fpidx);
+	free(fnidx);
+	return 0;
+}
+
+int ti_index_build(const char *fn, const ti_conf_t *conf)
+{
+	return ti_index_build2(fn, conf, 0);
+}
+
+/********************************************
+ * parse a region in the format chr:beg-end *
+ ********************************************/
+
+int ti_get_tid(const ti_index_t *idx, const char *name)
+{
+	khiter_t iter;
+	const khash_t(s) *h = idx->tname;
+	iter = kh_get(s, h, name); /* get the tid */
+	if (iter == kh_end(h)) return -1;
+	return kh_value(h, iter);
+}
+
+int ti_parse_region(const ti_index_t *idx, const char *str, int *tid, int *begin, int *end)
+{
+	char *s, *p;
+	int i, l, k;
+	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;
+	if ((*tid = ti_get_tid(idx, s)) < 0) {
+		free(s);
+		return -1;
+	}
+	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;
+	free(s);
+	if (*begin > *end) return -1;
+	return 0;
+}
+
+/*******************************
+ * retrieve a specified region *
+ *******************************/
+
+#define MAX_BIN 37450 // =(8^6-1)/7+1
+
+static inline int reg2bins(uint32_t beg, uint32_t end, uint16_t list[MAX_BIN])
+{
+	int i = 0, k;
+	if (beg >= end) return 0;
+	if (end >= 1u<<29) end = 1u<<29;
+	--end;
+	list[i++] = 0;
+	for (k =    1 + (beg>>26); k <=    1 + (end>>26); ++k) list[i++] = k;
+	for (k =    9 + (beg>>23); k <=    9 + (end>>23); ++k) list[i++] = k;
+	for (k =   73 + (beg>>20); k <=   73 + (end>>20); ++k) list[i++] = k;
+	for (k =  585 + (beg>>17); k <=  585 + (end>>17); ++k) list[i++] = k;
+	for (k = 4681 + (beg>>14); k <= 4681 + (end>>14); ++k) list[i++] = k;
+	return i;
+}
+
+ti_iter_t ti_iter_first()
+{
+	ti_iter_t iter;
+	iter = calloc(1, sizeof(struct __ti_iter_t));
+	iter->from_first = 1;
+	return iter;
+}
+
+ti_iter_t ti_iter_query(const ti_index_t *idx, int tid, int beg, int end)
+{
+	uint16_t *bins;
+	int i, n_bins, n_off;
+	pair64_t *off;
+	khint_t k;
+	khash_t(i) *index;
+	uint64_t min_off;
+	ti_iter_t iter = 0;
+
+	if (beg < 0) beg = 0;
+	if (end < beg) return 0;
+	// initialize the iterator
+	iter = calloc(1, sizeof(struct __ti_iter_t));
+	iter->idx = idx; iter->tid = tid; iter->beg = beg; iter->end = end; iter->i = -1;
+	// random access
+	bins = (uint16_t*)calloc(MAX_BIN, 2);
+	n_bins = reg2bins(beg, end, bins);
+	index = idx->index[tid];
+	if (idx->index2[tid].n > 0) {
+		min_off = (beg>>TAD_LIDX_SHIFT >= idx->index2[tid].n)? idx->index2[tid].offset[idx->index2[tid].n-1]
+			: idx->index2[tid].offset[beg>>TAD_LIDX_SHIFT];
+		if (min_off == 0) { // improvement for index files built by tabix prior to 0.1.4
+			int n = beg>>TAD_LIDX_SHIFT;
+			if (n > idx->index2[tid].n) n = idx->index2[tid].n;
+			for (i = n - 1; i >= 0; --i)
+				if (idx->index2[tid].offset[i] != 0) break;
+			if (i >= 0) min_off = idx->index2[tid].offset[i];
+		}
+	} else min_off = 0; // tabix 0.1.2 may produce such index files
+	for (i = n_off = 0; i < n_bins; ++i) {
+		if ((k = kh_get(i, index, bins[i])) != kh_end(index))
+			n_off += kh_value(index, k).n;
+	}
+	if (n_off == 0) {
+		free(bins); return iter;
+	}
+	off = (pair64_t*)calloc(n_off, 16);
+	for (i = n_off = 0; i < n_bins; ++i) {
+		if ((k = kh_get(i, index, bins[i])) != kh_end(index)) {
+			int j;
+			ti_binlist_t *p = &kh_value(index, k);
+			for (j = 0; j < p->n; ++j)
+				if (p->list[j].v > min_off) off[n_off++] = p->list[j];
+		}
+	}
+	if (n_off == 0) {
+		free(bins); free(off); return iter;
+	}
+	free(bins);
+	{
+		int l;
+		ks_introsort(offt, n_off, off);
+		// resolve completely contained adjacent blocks
+		for (i = 1, l = 0; i < n_off; ++i)
+			if (off[l].v < off[i].v)
+				off[++l] = off[i];
+		n_off = l + 1;
+		// resolve overlaps between adjacent blocks; this may happen due to the merge in indexing
+		for (i = 1; i < n_off; ++i)
+			if (off[i-1].v >= off[i].u) off[i-1].v = off[i].u;
+		{ // merge adjacent blocks
+			for (i = 1, l = 0; i < n_off; ++i) {
+				if (off[l].v>>16 == off[i].u>>16) off[l].v = off[i].v;
+				else off[++l] = off[i];
+			}
+			n_off = l + 1;
+		}
+	}
+	iter->n_off = n_off; iter->off = off;
+	return iter;
+}
+
+const char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
+{
+	if (iter->finished) return 0;
+	if (iter->from_first) {
+		int ret;
+		if ((ret = ti_readline(fp, &iter->str)) < 0) {
+			iter->finished = 1;
+			return 0;
+		} else {
+			if (len) *len = iter->str.l;
+			return iter->str.s;
+		}
+	}
+	if (iter->n_off == 0) return 0;
+	while (1) {
+		int ret;
+		if (iter->curr_off == 0 || iter->curr_off >= iter->off[iter->i].v) { // then jump to the next chunk
+			if (iter->i == iter->n_off - 1) break; // no more chunks
+			if (iter->i >= 0) assert(iter->curr_off == iter->off[iter->i].v); // otherwise bug
+			if (iter->i < 0 || iter->off[iter->i].v != iter->off[iter->i+1].u) { // not adjacent chunks; then seek
+				bgzf_seek(fp, iter->off[iter->i+1].u, SEEK_SET);
+				iter->curr_off = bgzf_tell(fp);
+			}
+			++iter->i;
+		}
+		if ((ret = ti_readline(fp, &iter->str)) >= 0) {
+			ti_intv_t intv;
+			iter->curr_off = bgzf_tell(fp);
+			if (iter->str.s[0] == iter->idx->conf.meta_char) continue;
+			get_intv((ti_index_t*)iter->idx, &iter->str, &intv);
+			if (intv.tid != iter->tid || intv.beg >= iter->end) break; // no need to proceed
+			else if (intv.end > iter->beg && iter->end > intv.beg) {
+				if (len) *len = iter->str.l;
+				return iter->str.s;
+			}
+		} else break; // end of file
+	}
+	iter->finished = 1;
+	return 0;
+}
+
+void ti_iter_destroy(ti_iter_t iter)
+{
+	if (iter) {
+		free(iter->str.s); free(iter->off);
+		free(iter);
+	}
+}
+
+int ti_fetch(BGZF *fp, const ti_index_t *idx, int tid, int beg, int end, void *data, ti_fetch_f func)
+{
+	ti_iter_t iter;
+	const char *s;
+	int len;
+	iter = ti_iter_query(idx, tid, beg, end);
+	while ((s = ti_iter_read(fp, iter, &len)) != 0)
+		func(len, s, data);
+	ti_iter_destroy(iter);
+	return 0;
+}
+
+const ti_conf_t *ti_get_conf(ti_index_t *idx) { return idx? &idx->conf : 0; }
+
+/*******************
+ * High-level APIs *
+ *******************/
+
+tabix_t *ti_open(const char *fn, const char *fnidx)
+{
+	tabix_t *t;
+	BGZF *fp;
+	if ((fp = bgzf_open(fn, "r")) == 0) return 0;
+	t = calloc(1, sizeof(tabix_t));
+	t->fn = strdup(fn);
+	if (fnidx) t->fnidx = strdup(fnidx);
+	t->fp = fp;
+	return t;
+}
+
+void ti_close(tabix_t *t)
+{
+	if (t) {
+		bgzf_close(t->fp);
+		if (t->idx) ti_index_destroy(t->idx);
+		free(t->fn); free(t->fnidx);
+		free(t);
+	}
+}
+
+int ti_lazy_index_load(tabix_t *t)
+{
+	if (t->idx == 0) { // load index
+		if (t->fnidx) t->idx = ti_index_load_local(t->fnidx);
+		else t->idx = ti_index_load(t->fn);
+		if (t->idx == 0) return -1; // fail to load index
+	}
+	return 0;
+}
+
+ti_iter_t ti_queryi(tabix_t *t, int tid, int beg, int end)
+{
+	if (tid < 0) return ti_iter_first();
+	if (ti_lazy_index_load(t) != 0) return 0;
+	return ti_iter_query(t->idx, tid, beg, end);	
+}
+
+ti_iter_t ti_querys(tabix_t *t, const char *reg)
+{
+	int tid, beg, end;
+	if (reg == 0) return ti_iter_first();
+	if (ti_lazy_index_load(t) != 0) return 0;
+	if (ti_parse_region(t->idx, reg, &tid, &beg, &end) < 0) return 0;
+	return ti_iter_query(t->idx, tid, beg, end);
+}
+
+ti_iter_t ti_query(tabix_t *t, const char *name, int beg, int end)
+{
+	int tid;
+	if (name == 0) return ti_iter_first();
+	// then need to load the index
+	if (ti_lazy_index_load(t) != 0) return 0;
+	if ((tid = ti_get_tid(t->idx, name)) < 0) return 0;
+	return ti_iter_query(t->idx, tid, beg, end);
+}
+
+const char *ti_read(tabix_t *t, ti_iter_t iter, int *len)
+{
+	return ti_iter_read(t->fp, iter, len);
+}
diff --git a/tabix/knetfile.c b/tabix/knetfile.c
new file mode 100644
index 0000000..7c96a3e
--- /dev/null
+++ b/tabix/knetfile.c
@@ -0,0 +1,632 @@
+/* The MIT License
+
+   Copyright (c) 2008 Genome Research Ltd (GRL).
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   "Software"), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+   SOFTWARE.
+*/
+
+/* Contact: Heng Li <lh3 at sanger.ac.uk> */
+
+/* Probably I will not do socket programming in the next few years and
+   therefore I decide to heavily annotate this file, for Linux and
+   Windows as well.  -lh3 */
+
+#include <time.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#ifdef _WIN32
+#include <winsock.h>
+#else
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+#endif
+
+#include "knetfile.h"
+
+/* In winsock.h, the type of a socket is SOCKET, which is: "typedef
+ * u_int SOCKET". An invalid SOCKET is: "(SOCKET)(~0)", or signed
+ * integer -1. In knetfile.c, I use "int" for socket type
+ * throughout. This should be improved to avoid confusion.
+ *
+ * In Linux/Mac, recv() and read() do almost the same thing. You can see
+ * in the header file that netread() is simply an alias of read(). In
+ * Windows, however, they are different and using recv() is mandatory.
+ */
+
+/* This function tests if the file handler is ready for reading (or
+ * writing if is_read==0). */
+static int socket_wait(int fd, int is_read)
+{
+	fd_set fds, *fdr = 0, *fdw = 0;
+	struct timeval tv;
+	int ret;
+	tv.tv_sec = 5; tv.tv_usec = 0; // 5 seconds time out
+	FD_ZERO(&fds);
+	FD_SET(fd, &fds);
+	if (is_read) fdr = &fds;
+	else fdw = &fds;
+	ret = select(fd+1, fdr, fdw, 0, &tv);
+#ifndef _WIN32
+	if (ret == -1) perror("select");
+#else
+	if (ret == 0)
+		fprintf(stderr, "select time-out\n");
+	else if (ret == SOCKET_ERROR)
+		fprintf(stderr, "select: %d\n", WSAGetLastError());
+#endif
+	return ret;
+}
+
+#ifndef _WIN32
+/* This function does not work with Windows due to the lack of
+ * getaddrinfo() in winsock. It is addapted from an example in "Beej's
+ * Guide to Network Programming" (http://beej.us/guide/bgnet/). */
+static int socket_connect(const char *host, const char *port)
+{
+#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0)
+
+	int on = 1, fd;
+	struct linger lng = { 0, 0 };
+	struct addrinfo hints, *res;
+	memset(&hints, 0, sizeof(struct addrinfo));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
+	/* In Unix/Mac, getaddrinfo() is the most convenient way to get
+	 * server information. */
+	if (getaddrinfo(host, port, &hints, &res) != 0) __err_connect("getaddrinfo");
+	if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket");
+	/* The following two setsockopt() are used by ftplib
+	 * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they
+	 * necessary. */
+	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt");
+	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt");
+	if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect");
+	freeaddrinfo(res);
+	return fd;
+}
+#else
+/* MinGW's printf has problem with "%lld" */
+char *int64tostr(char *buf, int64_t x)
+{
+	int cnt;
+	int i = 0;
+	do {
+		buf[i++] = '0' + x % 10;
+		x /= 10;
+	} while (x);
+	buf[i] = 0;
+	for (cnt = i, i = 0; i < cnt/2; ++i) {
+		int c = buf[i]; buf[i] = buf[cnt-i-1]; buf[cnt-i-1] = c;
+	}
+	return buf;
+}
+
+int64_t strtoint64(const char *buf)
+{
+	int64_t x;
+	for (x = 0; *buf != '\0'; ++buf)
+		x = x * 10 + ((int64_t) *buf - 48);
+	return x;
+}
+/* In windows, the first thing is to establish the TCP connection. */
+int knet_win32_init()
+{
+	WSADATA wsaData;
+	return WSAStartup(MAKEWORD(2, 2), &wsaData);
+}
+void knet_win32_destroy()
+{
+	WSACleanup();
+}
+/* A slightly modfied version of the following function also works on
+ * Mac (and presummably Linux). However, this function is not stable on
+ * my Mac. It sometimes works fine but sometimes does not. Therefore for
+ * non-Windows OS, I do not use this one. */
+static SOCKET socket_connect(const char *host, const char *port)
+{
+#define __err_connect(func)										\
+	do {														\
+		fprintf(stderr, "%s: %d\n", func, WSAGetLastError());	\
+		return -1;												\
+	} while (0)
+
+	int on = 1;
+	SOCKET fd;
+	struct linger lng = { 0, 0 };
+	struct sockaddr_in server;
+	struct hostent *hp = 0;
+	// open socket
+	if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) __err_connect("socket");
+	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on)) == -1) __err_connect("setsockopt");
+	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&lng, sizeof(lng)) == -1) __err_connect("setsockopt");
+	// get host info
+	if (isalpha(host[0])) hp = gethostbyname(host);
+	else {
+		struct in_addr addr;
+		addr.s_addr = inet_addr(host);
+		hp = gethostbyaddr((char*)&addr, 4, AF_INET);
+	}
+	if (hp == 0) __err_connect("gethost");
+	// connect
+	server.sin_addr.s_addr = *((unsigned long*)hp->h_addr);
+	server.sin_family= AF_INET;
+	server.sin_port = htons(atoi(port));
+	if (connect(fd, (struct sockaddr*)&server, sizeof(server)) != 0) __err_connect("connect");
+	// freehostent(hp); // strangely in MSDN, hp is NOT freed (memory leak?!)
+	return fd;
+}
+#endif
+
+static off_t my_netread(int fd, void *buf, off_t len)
+{
+	off_t rest = len, curr, l = 0;
+	/* recv() and read() may not read the required length of data with
+	 * one call. They have to be called repeatedly. */
+	while (rest) {
+		if (socket_wait(fd, 1) <= 0) break; // socket is not ready for reading
+		curr = netread(fd, buf + l, rest);
+		/* According to the glibc manual, section 13.2, a zero returned
+		 * value indicates end-of-file (EOF), which should mean that
+		 * read() will not return zero if EOF has not been met but data
+		 * are not immediately available. */
+		if (curr == 0) break;
+		l += curr; rest -= curr;
+	}
+	return l;
+}
+
+/*************************
+ * FTP specific routines *
+ *************************/
+
+static int kftp_get_response(knetFile *ftp)
+{
+#ifndef _WIN32
+	unsigned char c;
+#else
+	char c;
+#endif
+	int n = 0;
+	char *p;
+	if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0;
+	while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
+		//fputc(c, stderr);
+		if (n >= ftp->max_response) {
+			ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256;
+			ftp->response = realloc(ftp->response, ftp->max_response);
+		}
+		ftp->response[n++] = c;
+		if (c == '\n') {
+			if (n >= 4 && isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2])
+				&& ftp->response[3] != '-') break;
+			n = 0;
+			continue;
+		}
+	}
+	if (n < 2) return -1;
+	ftp->response[n-2] = 0;
+	return strtol(ftp->response, &p, 0);
+}
+
+static int kftp_send_cmd(knetFile *ftp, const char *cmd, int is_get)
+{
+	if (socket_wait(ftp->ctrl_fd, 0) <= 0) return -1; // socket is not ready for writing
+	netwrite(ftp->ctrl_fd, cmd, strlen(cmd));
+	return is_get? kftp_get_response(ftp) : 0;
+}
+
+static int kftp_pasv_prep(knetFile *ftp)
+{
+	char *p;
+	int v[6];
+	kftp_send_cmd(ftp, "PASV\r\n", 1);
+	for (p = ftp->response; *p && *p != '('; ++p);
+	if (*p != '(') return -1;
+	++p;
+	sscanf(p, "%d,%d,%d,%d,%d,%d", &v[0], &v[1], &v[2], &v[3], &v[4], &v[5]);
+	memcpy(ftp->pasv_ip, v, 4 * sizeof(int));
+	ftp->pasv_port = (v[4]<<8&0xff00) + v[5];
+	return 0;
+}
+
+
+static int kftp_pasv_connect(knetFile *ftp)
+{
+	char host[80], port[10];
+	if (ftp->pasv_port == 0) {
+		fprintf(stderr, "[kftp_pasv_connect] kftp_pasv_prep() is not called before hand.\n");
+		return -1;
+	}
+	sprintf(host, "%d.%d.%d.%d", ftp->pasv_ip[0], ftp->pasv_ip[1], ftp->pasv_ip[2], ftp->pasv_ip[3]);
+	sprintf(port, "%d", ftp->pasv_port);
+	ftp->fd = socket_connect(host, port);
+	if (ftp->fd == -1) return -1;
+	return 0;
+}
+
+int kftp_connect(knetFile *ftp)
+{
+	ftp->ctrl_fd = socket_connect(ftp->host, ftp->port);
+	if (ftp->ctrl_fd == -1) return -1;
+	kftp_get_response(ftp);
+	kftp_send_cmd(ftp, "USER anonymous\r\n", 1);
+	kftp_send_cmd(ftp, "PASS kftp@\r\n", 1);
+	kftp_send_cmd(ftp, "TYPE I\r\n", 1);
+	return 0;
+}
+
+int kftp_reconnect(knetFile *ftp)
+{
+	if (ftp->ctrl_fd != -1) {
+		netclose(ftp->ctrl_fd);
+		ftp->ctrl_fd = -1;
+	}
+	netclose(ftp->fd);
+	ftp->fd = -1;
+	return kftp_connect(ftp);
+}
+
+// initialize ->type, ->host, ->retr and ->size
+knetFile *kftp_parse_url(const char *fn, const char *mode)
+{
+	knetFile *fp;
+	char *p;
+	int l;
+	if (strstr(fn, "ftp://") != fn) return 0;
+	for (p = (char*)fn + 6; *p && *p != '/'; ++p);
+	if (*p != '/') return 0;
+	l = p - fn - 6;
+	fp = calloc(1, sizeof(knetFile));
+	fp->type = KNF_TYPE_FTP;
+	fp->fd = -1;
+	/* the Linux/Mac version of socket_connect() also recognizes a port
+	 * like "ftp", but the Windows version does not. */
+	fp->port = strdup("21");
+	fp->host = calloc(l + 1, 1);
+	if (strchr(mode, 'c')) fp->no_reconnect = 1;
+	strncpy(fp->host, fn + 6, l);
+	fp->retr = calloc(strlen(p) + 8, 1);
+	sprintf(fp->retr, "RETR %s\r\n", p);
+    fp->size_cmd = calloc(strlen(p) + 8, 1);
+    sprintf(fp->size_cmd, "SIZE %s\r\n", p);
+	fp->seek_offset = 0;
+	return fp;
+}
+// place ->fd at offset off
+int kftp_connect_file(knetFile *fp)
+{
+	int ret;
+	long long file_size;
+	if (fp->fd != -1) {
+		netclose(fp->fd);
+		if (fp->no_reconnect) kftp_get_response(fp);
+	}
+	kftp_pasv_prep(fp);
+    kftp_send_cmd(fp, fp->size_cmd, 1);
+#ifndef _WIN32
+    if ( sscanf(fp->response,"%*d %lld", &file_size) != 1 )
+    {
+        fprintf(stderr,"[kftp_connect_file] %s\n", fp->response);
+        return -1;
+    }
+#else
+	const char *p = fp->response;
+	while (*p != ' ') ++p;
+	while (*p < '0' || *p > '9') ++p;
+	file_size = strtoint64(p);
+#endif
+	fp->file_size = file_size;
+	if (fp->offset>=0) {
+		char tmp[32];
+#ifndef _WIN32
+		sprintf(tmp, "REST %lld\r\n", (long long)fp->offset);
+#else
+		strcpy(tmp, "REST ");
+		int64tostr(tmp + 5, fp->offset);
+		strcat(tmp, "\r\n");
+#endif
+		kftp_send_cmd(fp, tmp, 1);
+	}
+	kftp_send_cmd(fp, fp->retr, 0);
+	kftp_pasv_connect(fp);
+	ret = kftp_get_response(fp);
+	if (ret != 150) {
+		fprintf(stderr, "[kftp_connect_file] %s\n", fp->response);
+		netclose(fp->fd);
+		fp->fd = -1;
+		return -1;
+	}
+	fp->is_ready = 1;
+	return 0;
+}
+
+
+/**************************
+ * HTTP specific routines *
+ **************************/
+
+knetFile *khttp_parse_url(const char *fn, const char *mode)
+{
+	knetFile *fp;
+	char *p, *proxy, *q;
+	int l;
+	if (strstr(fn, "http://") != fn) return 0;
+	// set ->http_host
+	for (p = (char*)fn + 7; *p && *p != '/'; ++p);
+	l = p - fn - 7;
+	fp = calloc(1, sizeof(knetFile));
+	fp->http_host = calloc(l + 1, 1);
+	strncpy(fp->http_host, fn + 7, l);
+	fp->http_host[l] = 0;
+	for (q = fp->http_host; *q && *q != ':'; ++q);
+	if (*q == ':') *q++ = 0;
+	// get http_proxy
+	proxy = getenv("http_proxy");
+	// set ->host, ->port and ->path
+	if (proxy == 0) {
+		fp->host = strdup(fp->http_host); // when there is no proxy, server name is identical to http_host name.
+		fp->port = strdup(*q? q : "80");
+		fp->path = strdup(*p? p : "/");
+	} else {
+		fp->host = (strstr(proxy, "http://") == proxy)? strdup(proxy + 7) : strdup(proxy);
+		for (q = fp->host; *q && *q != ':'; ++q);
+		if (*q == ':') *q++ = 0; 
+		fp->port = strdup(*q? q : "80");
+		fp->path = strdup(fn);
+	}
+	fp->type = KNF_TYPE_HTTP;
+	fp->ctrl_fd = fp->fd = -1;
+	fp->seek_offset = 0;
+	return fp;
+}
+
+int khttp_connect_file(knetFile *fp)
+{
+	int ret, l = 0;
+	char *buf, *p;
+	if (fp->fd != -1) netclose(fp->fd);
+	fp->fd = socket_connect(fp->host, fp->port);
+	buf = calloc(0x10000, 1); // FIXME: I am lazy... But in principle, 64KB should be large enough.
+	l += sprintf(buf + l, "GET %s HTTP/1.0\r\nHost: %s\r\n", fp->path, fp->http_host);
+    l += sprintf(buf + l, "Range: bytes=%lld-\r\n", (long long)fp->offset);
+	l += sprintf(buf + l, "\r\n");
+	netwrite(fp->fd, buf, l);
+	l = 0;
+	while (netread(fp->fd, buf + l, 1)) { // read HTTP header; FIXME: bad efficiency
+		if (buf[l] == '\n' && l >= 3)
+			if (strncmp(buf + l - 3, "\r\n\r\n", 4) == 0) break;
+		++l;
+	}
+	buf[l] = 0;
+	if (l < 14) { // prematured header
+		netclose(fp->fd);
+		fp->fd = -1;
+		return -1;
+	}
+	ret = strtol(buf + 8, &p, 0); // HTTP return code
+	if (ret == 200 && fp->offset>0) { // 200 (complete result); then skip beginning of the file
+		off_t rest = fp->offset;
+		while (rest) {
+			off_t l = rest < 0x10000? rest : 0x10000;
+			rest -= my_netread(fp->fd, buf, l);
+		}
+	} else if (ret != 206 && ret != 200) {
+		free(buf);
+		fprintf(stderr, "[khttp_connect_file] fail to open file (HTTP code: %d).\n", ret);
+		netclose(fp->fd);
+		fp->fd = -1;
+		return -1;
+	}
+	free(buf);
+	fp->is_ready = 1;
+	return 0;
+}
+
+/********************
+ * Generic routines *
+ ********************/
+
+knetFile *knet_open(const char *fn, const char *mode)
+{
+	knetFile *fp = 0;
+	if (mode[0] != 'r') {
+		fprintf(stderr, "[kftp_open] only mode \"r\" is supported.\n");
+		return 0;
+	}
+	if (strstr(fn, "ftp://") == fn) {
+		fp = kftp_parse_url(fn, mode);
+		if (fp == 0) return 0;
+		if (kftp_connect(fp) == -1) {
+			knet_close(fp);
+			return 0;
+		}
+		kftp_connect_file(fp);
+	} else if (strstr(fn, "http://") == fn) {
+		fp = khttp_parse_url(fn, mode);
+		if (fp == 0) return 0;
+		khttp_connect_file(fp);
+	} else { // local file
+#ifdef _WIN32
+		/* In windows, O_BINARY is necessary. In Linux/Mac, O_BINARY may
+		 * be undefined on some systems, although it is defined on my
+		 * Mac and the Linux I have tested on. */
+		int fd = open(fn, O_RDONLY | O_BINARY);
+#else		
+		int fd = open(fn, O_RDONLY);
+#endif
+		if (fd == -1) {
+			perror("open");
+			return 0;
+		}
+		fp = (knetFile*)calloc(1, sizeof(knetFile));
+		fp->type = KNF_TYPE_LOCAL;
+		fp->fd = fd;
+		fp->ctrl_fd = -1;
+	}
+	if (fp && fp->fd == -1) {
+		knet_close(fp);
+		return 0;
+	}
+	return fp;
+}
+
+knetFile *knet_dopen(int fd, const char *mode)
+{
+	knetFile *fp = (knetFile*)calloc(1, sizeof(knetFile));
+	fp->type = KNF_TYPE_LOCAL;
+	fp->fd = fd;
+	return fp;
+}
+
+off_t knet_read(knetFile *fp, void *buf, off_t len)
+{
+	off_t l = 0;
+	if (fp->fd == -1) return 0;
+	if (fp->type == KNF_TYPE_FTP) {
+		if (fp->is_ready == 0) {
+			if (!fp->no_reconnect) kftp_reconnect(fp);
+			kftp_connect_file(fp);
+		}
+	} else if (fp->type == KNF_TYPE_HTTP) {
+		if (fp->is_ready == 0)
+			khttp_connect_file(fp);
+	}
+	if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX
+		off_t rest = len, curr;
+		while (rest) {
+			curr = read(fp->fd, buf + l, rest);
+			if (curr == 0) break;
+			l += curr; rest -= curr;
+		}
+	} else l = my_netread(fp->fd, buf, len);
+	fp->offset += l;
+	return l;
+}
+
+off_t knet_seek(knetFile *fp, int64_t off, int whence)
+{
+	if (whence == SEEK_SET && off == fp->offset) return 0;
+	if (fp->type == KNF_TYPE_LOCAL) {
+		/* Be aware that lseek() returns the offset after seeking,
+		 * while fseek() returns zero on success. */
+		off_t offset = lseek(fp->fd, off, whence);
+		if (offset == -1) {
+            // Be silent, it is OK for knet_seek to fail when the file is streamed
+            // fprintf(stderr,"[knet_seek] %s\n", strerror(errno));
+			return -1;
+		}
+		fp->offset = offset;
+		return 0;
+	}
+    else if (fp->type == KNF_TYPE_FTP) 
+    {
+        if (whence==SEEK_CUR)
+            fp->offset += off;
+        else if (whence==SEEK_SET)
+            fp->offset = off;
+        else if ( whence==SEEK_END)
+            fp->offset = fp->file_size+off;
+		fp->is_ready = 0;
+		return 0;
+	} 
+    else if (fp->type == KNF_TYPE_HTTP) 
+    {
+		if (whence == SEEK_END) { // FIXME: can we allow SEEK_END in future?
+			fprintf(stderr, "[knet_seek] SEEK_END is not supported for HTTP. Offset is unchanged.\n");
+			errno = ESPIPE;
+			return -1;
+		}
+        if (whence==SEEK_CUR)
+            fp->offset += off;
+        else if (whence==SEEK_SET)
+            fp->offset = off;
+		fp->is_ready = 0;
+		return fp->offset;
+	}
+	errno = EINVAL;
+    fprintf(stderr,"[knet_seek] %s\n", strerror(errno));
+	return -1;
+}
+
+int knet_close(knetFile *fp)
+{
+	if (fp == 0) return 0;
+	if (fp->ctrl_fd != -1) netclose(fp->ctrl_fd); // FTP specific
+	if (fp->fd != -1) {
+		/* On Linux/Mac, netclose() is an alias of close(), but on
+		 * Windows, it is an alias of closesocket(). */
+		if (fp->type == KNF_TYPE_LOCAL) close(fp->fd);
+		else netclose(fp->fd);
+	}
+	free(fp->host); free(fp->port);
+	free(fp->response); free(fp->retr); free(fp->size_cmd); // FTP specific
+	free(fp->path); free(fp->http_host); // HTTP specific
+	free(fp);
+	return 0;
+}
+
+#ifdef KNETFILE_MAIN
+int main(void)
+{
+	char *buf;
+	knetFile *fp;
+	int type = 4, l;
+#ifdef _WIN32
+	knet_win32_init();
+#endif
+	buf = calloc(0x100000, 1);
+	if (type == 0) {
+		fp = knet_open("knetfile.c", "r");
+		knet_seek(fp, 1000, SEEK_SET);
+	} else if (type == 1) { // NCBI FTP, large file
+		fp = knet_open("ftp://ftp.ncbi.nih.gov/1000genomes/ftp/data/NA12878/alignment/NA12878.chrom6.SLX.SRP000032.2009_06.bam", "r");
+		knet_seek(fp, 2500000000ll, SEEK_SET);
+		l = knet_read(fp, buf, 255);
+	} else if (type == 2) {
+		fp = knet_open("ftp://ftp.sanger.ac.uk/pub4/treefam/tmp/index.shtml", "r");
+		knet_seek(fp, 1000, SEEK_SET);
+	} else if (type == 3) {
+		fp = knet_open("http://www.sanger.ac.uk/Users/lh3/index.shtml", "r");
+		knet_seek(fp, 1000, SEEK_SET);
+	} else if (type == 4) {
+		fp = knet_open("http://www.sanger.ac.uk/Users/lh3/ex1.bam", "r");
+		knet_read(fp, buf, 10000);
+		knet_seek(fp, 20000, SEEK_SET);
+		knet_seek(fp, 10000, SEEK_SET);
+		l = knet_read(fp, buf+10000, 10000000) + 10000;
+	}
+	if (type != 4 && type != 1) {
+		knet_read(fp, buf, 255);
+		buf[255] = 0;
+		printf("%s\n", buf);
+	} else write(fileno(stdout), buf, l);
+	knet_close(fp);
+	free(buf);
+	return 0;
+}
+#endif
diff --git a/tabix/kstring.c b/tabix/kstring.c
new file mode 100644
index 0000000..e0203fa
--- /dev/null
+++ b/tabix/kstring.c
@@ -0,0 +1,165 @@
+#include <stdarg.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdint.h>
+#include "kstring.h"
+
+int ksprintf(kstring_t *s, const char *fmt, ...)
+{
+	va_list ap;
+	int l;
+	va_start(ap, fmt);
+	l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); // This line does not work with glibc 2.0. See `man snprintf'.
+	va_end(ap);
+	if (l + 1 > s->m - s->l) {
+		s->m = s->l + l + 2;
+		kroundup32(s->m);
+		s->s = (char*)realloc(s->s, s->m);
+		va_start(ap, fmt);
+		l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap);
+	}
+	va_end(ap);
+	s->l += l;
+	return l;
+}
+
+// s MUST BE a null terminated string; l = strlen(s)
+int ksplit_core(char *s, int delimiter, int *_max, int **_offsets)
+{
+	int i, n, max, last_char, last_start, *offsets, l;
+	n = 0; max = *_max; offsets = *_offsets;
+	l = strlen(s);
+	
+#define __ksplit_aux do {												\
+		if (_offsets) {													\
+			s[i] = 0;													\
+			if (n == max) {												\
+				max = max? max<<1 : 2;									\
+				offsets = (int*)realloc(offsets, sizeof(int) * max);	\
+			}															\
+			offsets[n++] = last_start;									\
+		} else ++n;														\
+	} while (0)
+
+	for (i = 0, last_char = last_start = 0; i <= l; ++i) {
+		if (delimiter == 0) {
+			if (isspace(s[i]) || s[i] == 0) {
+				if (isgraph(last_char)) __ksplit_aux; // the end of a field
+			} else {
+				if (isspace(last_char) || last_char == 0) last_start = i;
+			}
+		} else {
+			if (s[i] == delimiter || s[i] == 0) {
+				if (last_char != 0 && last_char != delimiter) __ksplit_aux; // the end of a field
+			} else {
+				if (last_char == delimiter || last_char == 0) last_start = i;
+			}
+		}
+		last_char = s[i];
+	}
+	*_max = max; *_offsets = offsets;
+	return n;
+}
+
+/**********************
+ * Boyer-Moore search *
+ **********************/
+
+// reference: http://www-igm.univ-mlv.fr/~lecroq/string/node14.html
+int *ksBM_prep(const uint8_t *pat, int m)
+{
+	int i, *suff, *prep, *bmGs, *bmBc;
+	prep = calloc(m + 256, 1);
+	bmGs = prep; bmBc = prep + m;
+	{ // preBmBc()
+		for (i = 0; i < 256; ++i) bmBc[i] = m;
+		for (i = 0; i < m - 1; ++i) bmBc[pat[i]] = m - i - 1;
+	}
+	suff = calloc(m, sizeof(int));
+	{ // suffixes()
+		int f = 0, g;
+		suff[m - 1] = m;
+		g = m - 1;
+		for (i = m - 2; i >= 0; --i) {
+			if (i > g && suff[i + m - 1 - f] < i - g)
+				suff[i] = suff[i + m - 1 - f];
+			else {
+				if (i < g) g = i;
+				f = i;
+				while (g >= 0 && pat[g] == pat[g + m - 1 - f]) --g;
+				suff[i] = f - g;
+			}
+		}
+	}
+	{ // preBmGs()
+		int j = 0;
+		for (i = 0; i < m; ++i) bmGs[i] = m;
+		for (i = m - 1; i >= 0; --i)
+			if (suff[i] == i + 1)
+				for (; j < m - 1 - i; ++j)
+					if (bmGs[j] == m)
+						bmGs[j] = m - 1 - i;
+		for (i = 0; i <= m - 2; ++i)
+			bmGs[m - 1 - suff[i]] = m - 1 - i;
+	}
+	free(suff);
+	return prep;
+}
+
+int *ksBM_search(const uint8_t *str, int n, const uint8_t *pat, int m, int *_prep, int *n_matches)
+{
+	int i, j, *prep, *bmGs, *bmBc;
+	int *matches = 0, mm = 0, nm = 0;
+	prep = _prep? _prep : ksBM_prep(pat, m);
+	bmGs = prep; bmBc = prep + m;
+	j = 0;
+	while (j <= n - m) {
+		for (i = m - 1; i >= 0 && pat[i] == str[i+j]; --i);
+		if (i < 0) {
+			if (nm == mm) {
+				mm = mm? mm<<1 : 1;
+				matches = realloc(matches, mm * sizeof(int));
+			}
+			matches[nm++] = j;
+			j += bmGs[0];
+		} else {
+			int max = bmBc[str[i+j]] - m + 1 + i;
+			if (max < bmGs[i]) max = bmGs[i];
+			j += max;
+		}
+	}
+	*n_matches = nm;
+	if (_prep == 0) free(prep);
+	return matches;
+}
+
+#ifdef KSTRING_MAIN
+#include <stdio.h>
+int main()
+{
+	kstring_t *s;
+	int *fields, n, i;
+	s = (kstring_t*)calloc(1, sizeof(kstring_t));
+	// test ksprintf()
+	ksprintf(s, " abcdefg:    %d ", 100);
+	printf("'%s'\n", s->s);
+	// test ksplit()
+	fields = ksplit(s, 0, &n);
+	for (i = 0; i < n; ++i)
+		printf("field[%d] = '%s'\n", i, s->s + fields[i]);
+	free(s);
+
+	{
+		static char *str = "abcdefgcdg";
+		static char *pat = "cd";
+		int n, *matches;
+		matches = ksBM_search(str, strlen(str), pat, strlen(pat), 0, &n);
+		printf("%d: \n", n);
+		for (i = 0; i < n; ++i)
+			printf("- %d\n", matches[i]);
+		free(matches);
+	}
+	return 0;
+}
+#endif
diff --git a/tests/example_btag.bam b/tests/example_btag.bam
new file mode 100644
index 0000000..7cd5c0c
Binary files /dev/null and b/tests/example_btag.bam differ
diff --git a/tests/pysam_test.py b/tests/pysam_test.py
index 3407182..c8acf83 100755
--- a/tests/pysam_test.py
+++ b/tests/pysam_test.py
@@ -891,6 +891,16 @@ class TestHeaderBam(TestHeaderSam):
         self.samfile=pysam.Samfile( "ex3.bam","rb" )
 
 
+class TestHeader1000Genomes( unittest.TestCase ):
+
+    bamfile = "http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/phase2b_alignment/data/NA07048/exome_alignment/NA07048.unmapped.ILLUMINA.bwa.CEU.exome.20120522_p2b.bam"
+        
+    def testRead( self ):
+
+        f = pysam.Samfile( self.bamfile, "rb" )
+        data = f.header.copy()
+        self.assertTrue( data )
+
 class TestUnmappedReads(unittest.TestCase):
 
     def testSAM(self):

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/pysam.git



More information about the debian-med-commit mailing list