Commits

James Taylor committed 5f8fd14

Run everything through Cython 0.18. Fixed a bug in BinnedBitset when the size is larger than the max size, all tests passing

Comments (0)

Files changed (25)

lib/bx/_seqmapping.c

-/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:15 2011 */
+/* Generated by Cython 0.18 on Thu Mar  7 12:41:36 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02040000
+    #error Cython requires Python 2.4+.
 #else
-
 #include <stddef.h> /* For offsetof */
 #ifndef offsetof
 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
 #endif
-
 #if !defined(WIN32) && !defined(MS_WINDOWS)
   #ifndef __stdcall
     #define __stdcall
     #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
-
-#if PY_VERSION_HEX < 0x02040000
-  #define METH_COEXIST 0
-  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
-  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
+#ifndef Py_HUGE_VAL
+  #define Py_HUGE_VAL HUGE_VAL
 #endif
-
+#ifdef PYPY_VERSION
+#define CYTHON_COMPILING_IN_PYPY 1
+#define CYTHON_COMPILING_IN_CPYTHON 0
+#else
+#define CYTHON_COMPILING_IN_PYPY 0
+#define CYTHON_COMPILING_IN_CPYTHON 1
+#endif
 #if PY_VERSION_HEX < 0x02050000
   typedef int Py_ssize_t;
   #define PY_SSIZE_T_MAX INT_MAX
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
+  #define CYTHON_FORMAT_SSIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
-  #define PyNumber_Index(o)    PyNumber_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)
   #define PyVarObject_HEAD_INIT(type, size) \
           PyObject_HEAD_INIT(type) size,
   #define PyType_Modified(t)
-
   typedef struct {
      void *buf;
      PyObject *obj;
      Py_ssize_t *suboffsets;
      void *internal;
   } Py_buffer;
-
   #define PyBUF_SIMPLE 0
   #define PyBUF_WRITABLE 0x0001
   #define PyBUF_FORMAT 0x0004
   #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
   #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
   #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
-
+  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
+  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
+  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
+  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
 #endif
-
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #else
   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
+          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #endif
-
+#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
+  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
+#endif
 #if PY_MAJOR_VERSION >= 3
   #define Py_TPFLAGS_CHECKTYPES 0
   #define Py_TPFLAGS_HAVE_INDEX 0
 #endif
-
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+  #define CYTHON_PEP393_ENABLED 1
+  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
+                                              0 : _PyUnicode_Ready((PyObject *)(op)))
+  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
+  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
+#else
+  #define CYTHON_PEP393_ENABLED 0
+  #define __Pyx_PyUnicode_READY(op)       (0)
+  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
+  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
 #endif
-
 #if PY_VERSION_HEX < 0x02060000
   #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
   #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)
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
-
 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
-
 #if PY_MAJOR_VERSION >= 3
   #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyBoolObject                 PyLongObject
 #endif
-
 #if PY_VERSION_HEX < 0x03020000
   typedef long Py_hash_t;
   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #endif
-
-
-#if PY_MAJOR_VERSION >= 3
-  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
-  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
-#else
-  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
-  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
-#endif
-
 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
   #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
   #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
 #endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
-
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
   #define __Pyx_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))
   #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)
+#else
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
+#endif
+
 #ifndef __PYX_EXTERN_C
   #ifdef __cplusplus
     #define __PYX_EXTERN_C extern "C"
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
 #ifndef CYTHON_INLINE
   #if defined(__GNUC__)
     #define CYTHON_INLINE __inline__
     #define CYTHON_INLINE
   #endif
 #endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
 #   else
 #     define CYTHON_UNUSED
 #   endif
-# elif defined(__ICC) || defined(__INTEL_COMPILER)
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
 #   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
 #   define CYTHON_UNUSED
 # endif
 #endif
-
 typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
 
-
-/* Type Conversion Predeclarations */
-
 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
 #define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
+#if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
 
 
 #ifdef __GNUC__
   int out_size;
 };
 
-
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
-
 #if CYTHON_REFNANNY
   typedef struct {
     void (*INCREF)(void*, PyObject*, int);
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
-  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
-  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+#ifdef WITH_THREAD
+  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+          if (acquire_gil) { \
+              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
+              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+              PyGILState_Release(__pyx_gilstate_save); \
+          } else { \
+              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
+          }
+#else
+  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
+          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+#endif
+  #define __Pyx_RefNannyFinishContext() \
+          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
 #else
   #define __Pyx_RefNannyDeclarations
-  #define __Pyx_RefNannySetupContext(name)
+  #define __Pyx_RefNannySetupContext(name, acquire_gil)
   #define __Pyx_RefNannyFinishContext()
   #define __Pyx_INCREF(r) Py_INCREF(r)
   #define __Pyx_DECREF(r) Py_DECREF(r)
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
-static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
-    const char* function_name, int kw_allowed); /*proto*/
-
-static void __Pyx_RaiseDoubleKeywordsError(
-    const char* func_name, PyObject* kw_name); /*proto*/
-
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+    const char* function_name); /*proto*/
 
 #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))
-
 static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
     int r;
     if (!j) return -1;
     Py_DECREF(j);
     return r;
 }
-
 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
-    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        Py_INCREF(v);
-        Py_DECREF(PyList_GET_ITEM(o, i));
-        PyList_SET_ITEM(o, i, v);
-        return 1;
+#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)))) {
+            PyObject* old = PyList_GET_ITEM(o, n);
+            Py_INCREF(v);
+            PyList_SET_ITEM(o, n, v);
+            Py_DECREF(old);
+            return 1;
+        }
+    } 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 (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
+#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);
-    else {
-        PyObject *j = PyInt_FromSsize_t(i);
-        return __Pyx_SetItemInt_Generic(o, j, v);
     }
+#endif
+    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
 }
 
-
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
     PyObject *r;
     if (!j) return NULL;
     Py_DECREF(j);
     return r;
 }
-
-
 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __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);
+#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 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)))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
             Py_INCREF(r);
             return r;
         }
     }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-#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);
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
             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;
+    } 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));
 }
 
-
-#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) {
-    PyObject *r;
-    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-    }
-    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-    }
-    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
-        r = PySequence_GetItem(o, i);
-    }
-    else {
-        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-    }
-    return r;
-}
-
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
 
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
-static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
-    return unlikely(b < 0) ? b : !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 PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
-    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
-}
-
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+
+static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);
 
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
 
 
 static int __Pyx_check_binary_version(void);
 
-static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
-                               int __pyx_lineno, const char *__pyx_filename); /*proto*/
+typedef struct {
+    int code_line;
+    PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+    int count;
+    int max_count;
+    __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+                               int py_line, const char *filename); /*proto*/
 
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
+
 /* Module declarations from 'bx._seqmapping' */
 static PyTypeObject *__pyx_ptype_2bx_11_seqmapping_CharToIntArrayMapping = 0;
 static PyTypeObject *__pyx_ptype_2bx_11_seqmapping_IntToIntMapping = 0;
 static PyObject *__pyx_builtin_ord;
 static PyObject *__pyx_builtin_chr;
 static PyObject *__pyx_builtin_range;
+static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self); /* proto */
+static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2__init__(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4set_mapping(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_c, int __pyx_v_symbol); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6translate(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_string); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_8translate_list(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_strings); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_10reverse_map(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_val, PyObject *__pyx_v_nseqs); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_12get_out_size(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self); /* proto */
+static int __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_in_size); /* proto */
+static void __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2__dealloc__(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4set_mapping(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_index, int __pyx_v_symbol); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6translate(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, PyObject *__pyx_v_src); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_8__getitem__(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_x); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_10collapse(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_a, int __pyx_v_b); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_12expand(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_x); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_14expand_out(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_a); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_16expand_random_split(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_a); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_18get_in_size(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_20get_out_size(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_22get_table(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self); /* proto */
 static char __pyx_k_1[] = "Malloc Failed";
 static char __pyx_k_2[] = "%d not between 0 and %s";
 static char __pyx_k_3[] = "`src` argument must be a buffer of 32bit integers";
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_neg_1;
 
+/* Python wrapper */
+static int __pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  int __pyx_r;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":26
  *     cdef object reverse_table
  * 
  *         cdef int i
  */
 
-static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self) {
   int __pyx_v_i;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__");
-  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
-    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
-  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
+  __Pyx_RefNannySetupContext("__cinit__", 0);
 
   /* "bx/_seqmapping.pyx":29
  *         """Init empty mapping (all characters map to -1)"""
  * 
  */
   for (__pyx_v_i = 0; __pyx_v_i < 256; __pyx_v_i++) {
-    (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[__pyx_v_i]) = -1;
+    (__pyx_v_self->table[__pyx_v_i]) = -1;
   }
 
   /* "bx/_seqmapping.pyx":30
  * 
  *     def __init__( self ):
  */
-  ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size = 0;
+  __pyx_v_self->out_size = 0;
 
   __pyx_r = 0;
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
+/* Python wrapper */
+static int __pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  int __pyx_r;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2__init__(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":32
  *         self.out_size = 0
  * 
  * 
  */
 
-static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2__init__(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("__init__");
-  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
-    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
-  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
+  __Pyx_RefNannySetupContext("__init__", 0);
 
   /* "bx/_seqmapping.pyx":33
  * 
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-  __Pyx_GOTREF(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table);
-  __Pyx_DECREF(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table);
-  ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table = ((PyObject *)__pyx_t_1);
+  __Pyx_GOTREF(__pyx_v_self->reverse_table);
+  __Pyx_DECREF(__pyx_v_self->reverse_table);
+  __pyx_v_self->reverse_table = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
   __pyx_r = 0;
   return __pyx_r;
 }
 
-/* "bx/_seqmapping.pyx":35
- *         self.reverse_table = dict()
- * 
- *     def set_mapping( self, c, int symbol ):             # <<<<<<<<<<<<<<
- *         """Modify mapping so 'chars' map to 'symbol'"""
- *         char = ord( c )
- */
-
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping[] = "Modify mapping so 'chars' map to 'symbol'";
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_5set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_4set_mapping[] = "Modify mapping so 'chars' map to 'symbol'";
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_5set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_c = 0;
   int __pyx_v_symbol;
-  PyObject *__pyx_v_char = NULL;
-  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  Py_ssize_t __pyx_t_3;
-  int __pyx_t_4;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,&__pyx_n_s__symbol,0};
-  __Pyx_RefNannySetupContext("set_mapping");
+  __Pyx_RefNannySetupContext("set_mapping (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,&__pyx_n_s__symbol,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbol);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbol)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("set_mapping", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_mapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_mapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4set_mapping(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self), __pyx_v_c, __pyx_v_symbol);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/_seqmapping.pyx":35
+ *         self.reverse_table = dict()
+ * 
+ *     def set_mapping( self, c, int symbol ):             # <<<<<<<<<<<<<<
+ *         """Modify mapping so 'chars' map to 'symbol'"""
+ *         char = ord( c )
+ */
+
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4set_mapping(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_c, int __pyx_v_symbol) {
+  PyObject *__pyx_v_char = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_3;
+  int __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("set_mapping", 0);
 
   /* "bx/_seqmapping.pyx":37
  *     def set_mapping( self, c, int symbol ):
  *         if self.out_size <= symbol:
  */
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_v_c);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_c);
   __Pyx_GIVEREF(__pyx_v_c);
  *             self.out_size = symbol + 1
  */
   __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_char); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[__pyx_t_3]) = __pyx_v_symbol;
+  (__pyx_v_self->table[__pyx_t_3]) = __pyx_v_symbol;
 
   /* "bx/_seqmapping.pyx":39
  *         char = ord( c )
  *             self.out_size = symbol + 1
  *         self.reverse_table[ symbol ] = chr( char )
  */
-  __pyx_t_4 = (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size <= __pyx_v_symbol);
+  __pyx_t_4 = (__pyx_v_self->out_size <= __pyx_v_symbol);
   if (__pyx_t_4) {
 
     /* "bx/_seqmapping.pyx":40
  *         self.reverse_table[ symbol ] = chr( char )
  * 
  */
-    ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size = (__pyx_v_symbol + 1);
-    goto __pyx_L6;
+    __pyx_v_self->out_size = (__pyx_v_symbol + 1);
+    goto __pyx_L3;
   }
-  __pyx_L6:;
+  __pyx_L3:;
 
   /* "bx/_seqmapping.pyx":41
  *         if self.out_size <= symbol:
  *     def translate( self, string ):
  */
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_INCREF(__pyx_v_char);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_char);
   __Pyx_GIVEREF(__pyx_v_char);
   __pyx_t_1 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  if (__Pyx_SetItemInt(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table, __pyx_v_symbol, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetItemInt(__pyx_v_self->reverse_table, __pyx_v_symbol, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   return __pyx_r;
 }
 
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_7translate(PyObject *__pyx_v_self, PyObject *__pyx_v_string); /*proto*/
+static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_6translate[] = "Translate 'string' and return as int array";
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_7translate(PyObject *__pyx_v_self, PyObject *__pyx_v_string) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("translate (wrapper)", 0);
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6translate(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self), ((PyObject *)__pyx_v_string));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":43
  *         self.reverse_table[ symbol ] = chr( char )
  * 
  *         cdef int s_len, t_len
  */
 
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_string); /*proto*/
-static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_3translate[] = "Translate 'string' and return as int array";
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_string) {
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6translate(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_string) {
   int __pyx_v_s_len;
   int __pyx_v_t_len;
   unsigned char *__pyx_v_s_buf;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("translate");
+  __Pyx_RefNannySetupContext("translate", 0);
 
   /* "bx/_seqmapping.pyx":49
  *         cdef int * t_buf
   __pyx_t_3 = PyInt_FromLong(__pyx_v_s_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_GOTREF(__pyx_t_4);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  *         # Done
  *         return rval
  */
-    (__pyx_v_t_buf[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]);
+    (__pyx_v_t_buf[__pyx_v_i]) = (__pyx_v_self->table[(__pyx_v_s_buf[__pyx_v_i])]);
   }
 
   /* "bx/_seqmapping.pyx":57
   return __pyx_r;
 }
 
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_9translate_list(PyObject *__pyx_v_self, PyObject *__pyx_v_strings); /*proto*/
+static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_8translate_list[] = "Translate a list of strings into an int array";
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_9translate_list(PyObject *__pyx_v_self, PyObject *__pyx_v_strings) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("translate_list (wrapper)", 0);
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_8translate_list(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self), ((PyObject *)__pyx_v_strings));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":59
  *         return rval
  * 
  *         cdef int text_len, factor, i
  */
 
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list(PyObject *__pyx_v_self, PyObject *__pyx_v_strings); /*proto*/
-static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list[] = "Translate a list of strings into an int array";
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list(PyObject *__pyx_v_self, PyObject *__pyx_v_strings) {
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_8translate_list(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_strings) {
   int __pyx_v_text_len;
   int __pyx_v_factor;
   int __pyx_v_i;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("translate_list");
+  __Pyx_RefNannySetupContext("translate_list", 0);
 
   /* "bx/_seqmapping.pyx":67
  * 
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L5;
+    goto __pyx_L3;
   }
-  __pyx_L5:;
+  __pyx_L3:;
 
   /* "bx/_seqmapping.pyx":70
  * 
   __pyx_t_4 = PyInt_FromLong(__pyx_v_text_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __Pyx_GOTREF(__pyx_t_5);
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
     __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
   }
   for (;;) {
-    if (PyList_CheckExact(__pyx_t_4)) {
+    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_4)) {
       if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
-      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
-    } else if (PyTuple_CheckExact(__pyx_t_4)) {
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
+    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_4)) {
       if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
-      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #else
+      __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      #endif
     } else {
       __pyx_t_5 = __pyx_t_7(__pyx_t_4);
       if (unlikely(!__pyx_t_5)) {
  *                         t_buf[i] = -1
  *                     else:
  */
-        __pyx_t_2 = ((((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]) == -1);
+        __pyx_t_2 = ((__pyx_v_self->table[(__pyx_v_s_buf[__pyx_v_i])]) == -1);
         if (__pyx_t_2) {
 
           /* "bx/_seqmapping.pyx":83
  *                         t_buf[i] = t_buf[i] + ( self.table[ s_buf[i] ] * factor )
  */
           (__pyx_v_t_buf[__pyx_v_i]) = -1;
-          goto __pyx_L11;
+          goto __pyx_L9;
         }
         /*else*/ {
 
  *             factor = factor * self.out_size
  *         return rval
  */
-          (__pyx_v_t_buf[__pyx_v_i]) = ((__pyx_v_t_buf[__pyx_v_i]) + ((((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]) * __pyx_v_factor));
+          (__pyx_v_t_buf[__pyx_v_i]) = ((__pyx_v_t_buf[__pyx_v_i]) + ((__pyx_v_self->table[(__pyx_v_s_buf[__pyx_v_i])]) * __pyx_v_factor));
         }
-        __pyx_L11:;
-        goto __pyx_L10;
+        __pyx_L9:;
+        goto __pyx_L8;
       }
-      __pyx_L10:;
+      __pyx_L8:;
     }
 
     /* "bx/_seqmapping.pyx":86
  *         return rval
  * 
  */
-    __pyx_v_factor = (__pyx_v_factor * ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size);
+    __pyx_v_factor = (__pyx_v_factor * __pyx_v_self->out_size);
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
   return __pyx_r;
 }
 
-/* "bx/_seqmapping.pyx":89
- *         return rval
- * 
- *     def reverse_map( self, val, nseqs ):             # <<<<<<<<<<<<<<
- *         factor = self.out_size ** (nseqs-1)
- *         rval = []
- */
-
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_5reverse_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_5reverse_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_11reverse_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_11reverse_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_val = 0;
   PyObject *__pyx_v_nseqs = 0;
-  PyObject *__pyx_v_factor = NULL;
-  PyObject *__pyx_v_rval = NULL;
-  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__val,&__pyx_n_s__nseqs,0};
-  __Pyx_RefNannySetupContext("reverse_map");
+  __Pyx_RefNannySetupContext("reverse_map (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__val,&__pyx_n_s__nseqs,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nseqs);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nseqs)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("reverse_map", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reverse_map") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reverse_map") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_10reverse_map(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self), __pyx_v_val, __pyx_v_nseqs);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/_seqmapping.pyx":89
+ *         return rval
+ * 
+ *     def reverse_map( self, val, nseqs ):             # <<<<<<<<<<<<<<
+ *         factor = self.out_size ** (nseqs-1)
+ *         rval = []
+ */
+
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_10reverse_map(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self, PyObject *__pyx_v_val, PyObject *__pyx_v_nseqs) {
+  PyObject *__pyx_v_factor = NULL;
+  PyObject *__pyx_v_rval = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("reverse_map", 0);
   __Pyx_INCREF(__pyx_v_val);
 
   /* "bx/_seqmapping.pyx":90
  *         rval = []
  *         while factor > 0:
  */
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_Subtract(__pyx_v_nseqs, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
  *             rval.append( self.reverse_table[ int( floor( val / factor ) ) ] )
  */
   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_v_rval = __pyx_t_3;
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_rval = ((PyObject*)__pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "bx/_seqmapping.pyx":92
  *             val = val - ( floor(val/factor) * factor )
  */
   while (1) {
-    __pyx_t_3 = PyObject_RichCompare(__pyx_v_factor, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_factor, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (!__pyx_t_4) break;
  *             val = val - ( floor(val/factor) * factor )
  *             factor = floor( factor / self.out_size )
  */
-    if (unlikely(((PyObject *)__pyx_v_rval) == Py_None)) {
-      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-    }
     __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__floor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_val, __pyx_v_factor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __Pyx_GOTREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __Pyx_GOTREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
     __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table, __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetItem(__pyx_v_self->reverse_table, __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_5 = PyList_Append(__pyx_v_rval, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_val, __pyx_v_factor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_GOTREF(__pyx_t_3);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
  */
     __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__floor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(__pyx_v_self->out_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_factor, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_GOTREF(__pyx_t_3);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
  *         return rval
  * 
  */
-  if (unlikely(((PyObject *)__pyx_v_rval) == Py_None)) {
-    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "reverse"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
-  }
   __pyx_t_5 = PyList_Reverse(__pyx_v_rval); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "bx/_seqmapping.pyx":97
   return __pyx_r;
 }
 
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_13get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyObject *__pyx_pw_2bx_11_seqmapping_21CharToIntArrayMapping_13get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("get_out_size (wrapper)", 0);
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_12get_out_size(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":99
  *         return rval
  * 
  * 
  */
 
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_12get_out_size(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("get_out_size");
+  __Pyx_RefNannySetupContext("get_out_size", 0);
 
   /* "bx/_seqmapping.pyx":100
  * 
  * cdef class IntToIntMapping:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   return __pyx_r;
 }
 
-/* "bx/_seqmapping.pyx":108
- *     cdef int out_size
- * 
- *     def __cinit__( self, int in_size ):             # <<<<<<<<<<<<<<
- *         self.in_size = in_size
- *         self.table = <int *> malloc( in_size * sizeof( int ) )
- */
-
-static int __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* Python wrapper */
+static int __pyx_pw_2bx_11_seqmapping_15IntToIntMapping_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_2bx_11_seqmapping_15IntToIntMapping_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_v_in_size;
-  long __pyx_v_i;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  int __pyx_t_2;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_size,0};
-  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_size,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_size);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_size)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
       goto __pyx_L5_argtuple_error;
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self), __pyx_v_in_size);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/_seqmapping.pyx":108
+ *     cdef int out_size
+ * 
+ *     def __cinit__( self, int in_size ):             # <<<<<<<<<<<<<<
+ *         self.in_size = in_size
+ *         self.table = <int *> malloc( in_size * sizeof( int ) )
+ */
+
+static int __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_in_size) {
+  long __pyx_v_i;
+  int __pyx_r;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_t_2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__cinit__", 0);
 
   /* "bx/_seqmapping.pyx":109
  * 
  *         self.table = <int *> malloc( in_size * sizeof( int ) )
  *         if self.table == NULL: raise "Malloc Failed"
  */
-  ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size = __pyx_v_in_size;
+  __pyx_v_self->in_size = __pyx_v_in_size;
 
   /* "bx/_seqmapping.pyx":110
  *     def __cinit__( self, int in_size ):
  *         if self.table == NULL: raise "Malloc Failed"
  *         for i from 0 <= i < in_size: self.table[i] = -1
  */
-  ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table = ((int *)malloc((__pyx_v_in_size * (sizeof(int)))));
+  __pyx_v_self->table = ((int *)malloc((__pyx_v_in_size * (sizeof(int)))));
 
   /* "bx/_seqmapping.pyx":111
  *         self.in_size = in_size
  *         for i from 0 <= i < in_size: self.table[i] = -1
  *         self.out_size = 0
  */
-  __pyx_t_1 = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table == NULL);
+  __pyx_t_1 = (__pyx_v_self->table == NULL);
   if (__pyx_t_1) {
     __Pyx_Raise(((PyObject *)__pyx_kp_s_1), 0, 0, 0);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L6;
+    goto __pyx_L3;
   }
-  __pyx_L6:;
+  __pyx_L3:;
 
   /* "bx/_seqmapping.pyx":112
  *         self.table = <int *> malloc( in_size * sizeof( int ) )
  */
   __pyx_t_2 = __pyx_v_in_size;
   for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
-    (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) = -1;
+    (__pyx_v_self->table[__pyx_v_i]) = -1;
   }
 
   /* "bx/_seqmapping.pyx":113
  * 
  *     def __dealloc__( self ):
  */
-  ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size = 0;
+  __pyx_v_self->out_size = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
   return __pyx_r;
 }
 
+/* Python wrapper */
+static void __pyx_pw_2bx_11_seqmapping_15IntToIntMapping_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_2bx_11_seqmapping_15IntToIntMapping_3__dealloc__(PyObject *__pyx_v_self) {
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+  __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2__dealloc__(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self));
+  __Pyx_RefNannyFinishContext();
+}
+
 /* "bx/_seqmapping.pyx":115
  *         self.out_size = 0
  * 
  *         free( self.table )
  */
 
-static void __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_1__dealloc__(PyObject *__pyx_v_self) {
+static void __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2__dealloc__(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__");
+  __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "bx/_seqmapping.pyx":117
  *     def __dealloc__( self ):
  * 
  *     def set_mapping( self, int index, int symbol ):
  */
-  free(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table);
+  free(__pyx_v_self->table);
 
   __Pyx_RefNannyFinishContext();
 }
 
-/* "bx/_seqmapping.pyx":119
- *         free( self.table )
- * 
- *     def set_mapping( self, int index, int symbol ):             # <<<<<<<<<<<<<<
- *         assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size )
- *         self.table[index] = symbol
- */
-
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_5set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_5set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_v_index;
   int __pyx_v_symbol;
-  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__symbol,0};
-  __Pyx_RefNannySetupContext("set_mapping");
+  __Pyx_RefNannySetupContext("set_mapping (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__symbol,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbol);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbol)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("set_mapping", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_mapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_mapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4set_mapping(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self), __pyx_v_index, __pyx_v_symbol);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/_seqmapping.pyx":119
+ *         free( self.table )
+ * 
+ *     def set_mapping( self, int index, int symbol ):             # <<<<<<<<<<<<<<
+ *         assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size )
+ *         self.table[index] = symbol
+ */
+
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4set_mapping(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_index, int __pyx_v_symbol) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("set_mapping", 0);
 
   /* "bx/_seqmapping.pyx":120
  * 
   #ifndef CYTHON_WITHOUT_ASSERTIONS
   __pyx_t_1 = (-1 <= __pyx_v_index);
   if (__pyx_t_1) {
-    __pyx_t_1 = (__pyx_v_index < ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size);
+    __pyx_t_1 = (__pyx_v_index < __pyx_v_self->in_size);
   }
   if (unlikely(!__pyx_t_1)) {
     __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromLong(__pyx_v_self->in_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __Pyx_GOTREF(__pyx_t_4);
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  *         if self.out_size <= symbol:
  *             self.out_size = symbol + 1
  */
-  (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_index]) = __pyx_v_symbol;
+  (__pyx_v_self->table[__pyx_v_index]) = __pyx_v_symbol;
 
   /* "bx/_seqmapping.pyx":122
  *         assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size )
  *             self.out_size = symbol + 1
  * 
  */
-  __pyx_t_1 = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size <= __pyx_v_symbol);
+  __pyx_t_1 = (__pyx_v_self->out_size <= __pyx_v_symbol);
   if (__pyx_t_1) {
 
     /* "bx/_seqmapping.pyx":123
  * 
  *     def translate( self, src ):
  */
-    ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size = (__pyx_v_symbol + 1);
-    goto __pyx_L6;
+    __pyx_v_self->out_size = (__pyx_v_symbol + 1);
+    goto __pyx_L3;
   }
-  __pyx_L6:;
+  __pyx_L3:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   return __pyx_r;
 }
 
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_7translate(PyObject *__pyx_v_self, PyObject *__pyx_v_src); /*proto*/
+static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_6translate[] = "Translate `string` and return as int array";
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_7translate(PyObject *__pyx_v_self, PyObject *__pyx_v_src) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("translate (wrapper)", 0);
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6translate(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self), ((PyObject *)__pyx_v_src));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":125
  *             self.out_size = symbol + 1
  * 
  *         cdef int s_len, t_len
  */
 
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_src); /*proto*/
-static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_3translate[] = "Translate `string` and return as int array";
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_src) {
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6translate(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, PyObject *__pyx_v_src) {
   int __pyx_v_s_len;
   int __pyx_v_t_len;
   int *__pyx_v_s_buf;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("translate");
+  __Pyx_RefNannySetupContext("translate", 0);
 
   /* "bx/_seqmapping.pyx":130
  *         cdef int *s_buf, *t_buf
   __pyx_t_5 = PyInt_FromLong(__pyx_v_s_len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+  __Pyx_GOTREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  *                 t_buf[i] = -1
  */
       (__pyx_v_t_buf[__pyx_v_i]) = -1;
-      goto __pyx_L7;
+      goto __pyx_L5;
     }
 
     /* "bx/_seqmapping.pyx":140
  *                 t_buf[i] = -1
  *             else:
  */
-    __pyx_t_7 = ((__pyx_v_s_buf[__pyx_v_i]) >= ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size);
+    __pyx_t_7 = ((__pyx_v_s_buf[__pyx_v_i]) >= __pyx_v_self->in_size);
     if (__pyx_t_7) {
 
       /* "bx/_seqmapping.pyx":141
  *                 t_buf[i] = self.table[ s_buf[ i ] ]
  */
       (__pyx_v_t_buf[__pyx_v_i]) = -1;
-      goto __pyx_L7;
+      goto __pyx_L5;
     }
     /*else*/ {
 
  *         # Done
  *         return rval
  */
-      (__pyx_v_t_buf[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]);
+      (__pyx_v_t_buf[__pyx_v_i]) = (__pyx_v_self->table[(__pyx_v_s_buf[__pyx_v_i])]);
     }
-    __pyx_L7:;
+    __pyx_L5:;
   }
 
   /* "bx/_seqmapping.pyx":145
   return __pyx_r;
 }
 
-/* "bx/_seqmapping.pyx":147
- *         return rval
- * 
- *     def __getitem__( self, int x ):             # <<<<<<<<<<<<<<
- *         if x == -1: return -1
- *         assert 0 <= x < self.in_size
- */
-
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
   int __pyx_v_x;
-  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("__getitem__");
+  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
   assert(__pyx_arg_x); {
     __pyx_v_x = __Pyx_PyInt_AsInt(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_8__getitem__(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self), ((int)__pyx_v_x));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/_seqmapping.pyx":147
+ *         return rval
+ * 
+ *     def __getitem__( self, int x ):             # <<<<<<<<<<<<<<
+ *         if x == -1: return -1
+ *         assert 0 <= x < self.in_size
+ */
+
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_8__getitem__(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_x) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__getitem__", 0);
 
   /* "bx/_seqmapping.pyx":148
  * 
     __Pyx_INCREF(__pyx_int_neg_1);
     __pyx_r = __pyx_int_neg_1;
     goto __pyx_L0;
-    goto __pyx_L5;
+    goto __pyx_L3;
   }
-  __pyx_L5:;
+  __pyx_L3:;
 
   /* "bx/_seqmapping.pyx":149
  *     def __getitem__( self, int x ):
   #ifndef CYTHON_WITHOUT_ASSERTIONS
   __pyx_t_1 = (0 <= __pyx_v_x);
   if (__pyx_t_1) {
-    __pyx_t_1 = (__pyx_v_x < ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size);
+    __pyx_t_1 = (__pyx_v_x < __pyx_v_self->in_size);
   }
   if (unlikely(!__pyx_t_1)) {
     PyErr_SetNone(PyExc_AssertionError);
  *     def collapse( self, int a, int b ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong((__pyx_v_self->table[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
   return __pyx_r;
 }
 
-/* "bx/_seqmapping.pyx":152
- *         return self.table[ x ]
- * 
- *     def collapse( self, int a, int b ):             # <<<<<<<<<<<<<<
- *         cdef int i
- *         cdef IntToIntMapping copy
- */
-
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_5collapse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_5collapse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_11collapse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_11collapse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_v_a;
   int __pyx_v_b;
-  int __pyx_v_i;
-  struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_copy = 0;
-  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,0};
-  __Pyx_RefNannySetupContext("collapse");
+  __Pyx_RefNannySetupContext("collapse (wrapper)", 0);
   {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
+      switch (pos_args) {
         case  0:
-        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a);
-        if (likely(values[0])) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b);
-        if (likely(values[1])) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("collapse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "collapse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "collapse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_10collapse(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self), __pyx_v_a, __pyx_v_b);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/_seqmapping.pyx":152
+ *         return self.table[ x ]
+ * 
+ *     def collapse( self, int a, int b ):             # <<<<<<<<<<<<<<
+ *         cdef int i
+ *         cdef IntToIntMapping copy
+ */
+
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_10collapse(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_a, int __pyx_v_b) {
+  int __pyx_v_i;
+  struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_copy = 0;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("collapse", 0);
 
   /* "bx/_seqmapping.pyx":155
  *         cdef int i
  *         copy.out_size = self.out_size - 1
  *         if a > b: a, b = b, a
  */
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->in_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_GOTREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
  *         if a > b: a, b = b, a
  *         for i from 0 <= i < self.in_size:
  */
-  __pyx_v_copy->out_size = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size - 1);
+  __pyx_v_copy->out_size = (__pyx_v_self->out_size - 1);
 
   /* "bx/_seqmapping.pyx":157
  *         copy = IntToIntMapping( self.in_size )
     __pyx_t_5 = __pyx_v_a;
     __pyx_v_a = __pyx_t_4;
     __pyx_v_b = __pyx_t_5;
-    goto __pyx_L6;
+    goto __pyx_L3;
   }
-  __pyx_L6:;
+  __pyx_L3:;
 
   /* "bx/_seqmapping.pyx":158
  *         copy.out_size = self.out_size - 1
  *             if self.table[i] == b: copy.table[i] = a
  *             elif self.table[i] == copy.out_size: copy.table[i] = b
  */
-  __pyx_t_5 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size;
+  __pyx_t_5 = __pyx_v_self->in_size;
   for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
     /* "bx/_seqmapping.pyx":159
  *             elif self.table[i] == copy.out_size: copy.table[i] = b
  *             else: copy.table[i] = self.table[i]
  */
-    __pyx_t_3 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_b);
+    __pyx_t_3 = ((__pyx_v_self->table[__pyx_v_i]) == __pyx_v_b);
     if (__pyx_t_3) {
       (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_a;
-      goto __pyx_L9;
+      goto __pyx_L6;
     }
 
     /* "bx/_seqmapping.pyx":160
  *             else: copy.table[i] = self.table[i]
  *         return copy
  */
-    __pyx_t_3 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_copy->out_size);
+    __pyx_t_3 = ((__pyx_v_self->table[__pyx_v_i]) == __pyx_v_copy->out_size);
     if (__pyx_t_3) {
       (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_b;
-      goto __pyx_L9;
+      goto __pyx_L6;
     }
     /*else*/ {
 
  *         return copy
  * 
  */
-      (__pyx_v_copy->table[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]);
+      (__pyx_v_copy->table[__pyx_v_i]) = (__pyx_v_self->table[__pyx_v_i]);
     }
-    __pyx_L9:;
+    __pyx_L6:;
   }
 
   /* "bx/_seqmapping.pyx":162
   return __pyx_r;
 }
 
+/* Python wrapper */
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_13expand(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
+static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_12expand[] = "Grow the alphabet by making 'a' a seperate symbol. If it already mapped to a single symbol, do nothing";
+static PyObject *__pyx_pw_2bx_11_seqmapping_15IntToIntMapping_13expand(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
+  int __pyx_v_x;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("expand (wrapper)", 0);
+  assert(__pyx_arg_x); {
+    __pyx_v_x = __Pyx_PyInt_AsInt(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_12expand(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self), ((int)__pyx_v_x));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "bx/_seqmapping.pyx":164
  *         return copy
  * 
  *         cdef int i, count, a, b
  */
 
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6expand(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
-static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_6expand[] = "Grow the alphabet by making 'a' a seperate symbol. If it already mapped to a single symbol, do nothing";
-static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6expand(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
-  int __pyx_v_x;
+static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_12expand(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_self, int __pyx_v_x) {
   int __pyx_v_i;
   int __pyx_v_count;
   int __pyx_v_a;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("expand");
-  assert(__pyx_arg_x); {
-    __pyx_v_x = __Pyx_PyInt_AsInt(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
+  __Pyx_RefNannySetupContext("expand", 0);
 
   /* "bx/_seqmapping.pyx":169
  *         cdef IntToIntMapping copy
  *         # Symbols that map to -1 should not be touched
  *         if a < 0: return self
  */
-  __pyx_v_a = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_x]);
+  __pyx_v_a = (__pyx_v_self->table[__pyx_v_x]);
 
   /* "bx/_seqmapping.pyx":171
  *         a = self.table[x]
   __pyx_t_1 = (__pyx_v_a < 0);
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(__pyx_v_self);
-    __pyx_r = __pyx_v_self;
+    __Pyx_INCREF(((PyObject *)__pyx_v_self));
+    __pyx_r = ((PyObject *)__pyx_v_self);
     goto __pyx_L0;
-    goto __pyx_L5;
+    goto __pyx_L3;
   }
-  __pyx_L5:;
+  __pyx_L3:;
 
   /* "bx/_seqmapping.pyx":173
  *         if a < 0: return self
  *             if self.table[i] == a: count = count + 1
  *         # Already a singleton
  */
-  __pyx_t_2 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size;
+  __pyx_t_2 = __pyx_v_self->in_size;
   for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
 
     /* "bx/_seqmapping.pyx":175
  *         # Already a singleton
  *         if count < 2: return self
  */
-    __pyx_t_1 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_a);
+    __pyx_t_1 = ((__pyx_v_self->table[__pyx_v_i]) == __pyx_v_a);
     if (__pyx_t_1) {
       __pyx_v_count = (__pyx_v_count + 1);
-      goto __pyx_L8;
+      goto __pyx_L6;
     }
-    __pyx_L8:;
+    __pyx_L6:;
   }
 
   /* "bx/_seqmapping.pyx":177
   __pyx_t_1 = (__pyx_v_count < 2);
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(__pyx_v_self);
-    __pyx_r = __pyx_v_self;
+    __Pyx_INCREF(((PyObject *)__pyx_v_self));
+    __pyx_r = ((PyObject *)__pyx_v_self);
     goto __pyx_L0;
-    goto __pyx_L9;
+    goto __pyx_L7;
   }