From a7ffd46822ce195d51ff4d3dba0f02fe9bc73c1e Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Tue, 11 Jan 2022 16:29:37 -0500 Subject: [PATCH 01/61] Squashed commit of the following: commit 8564eb03f0d9e62abf4b7528baf5c2ae296be8f9 Merge: f6ef62c 07cc7d8 Author: Kendell Clement Date: Tue Jan 11 16:20:15 2022 -0500 Merge branch 'indel-alignment-fix' of https://github.com/edilytics/CRISPResso2 into indel-alignment-fix commit 07cc7d856ab3fcbbaa5381f17f29568192388887 Author: Cole Lyman Date: Fri Dec 10 15:29:59 2021 -0700 Fix bug in `find_indels_substitutions` This bug occurred when there was a deletion at the end of a sequence, and was thus not properly accounted for. commit f6ef62cfdf909adac1b10ea86555cd218f8b2a74 Author: Cole Lyman Date: Fri Dec 10 15:29:59 2021 -0700 Fix bug in `find_indels_substitutions` This bug occurred when there was a deletion at the end of a sequence, and was thus not properly accounted for. commit 7212f87f4be60057a6c848947ff6b5efde132a25 Author: Cole Lyman Date: Fri Dec 10 15:26:17 2021 -0700 Add a unit test for `find_indels_substitutions` This unit test checks for deletions at the end of a sequence, which are inherently outside of the include_indx_set window. commit d50b4e903b973c71a275e31d470b40e59280ee13 Author: Cole Lyman Date: Fri Dec 10 15:03:22 2021 -0700 Fix a bug in `find_indels_substitutions` The bug that this commit fixes is when an insertion occurs at the edge of the include indexes. The trouble with this earlier was that it was using the `idx` to calculate the size of the insertion, but the `idx` wasn't being incremented anymore because it was outside of the include window. commit 4db066f7bc333b7662a9232ac732ebb33ac3ace8 Author: Cole Lyman Date: Fri Dec 10 15:01:39 2021 -0700 Add test case for `find_indels_substitutions` This test case is extracted from the CRISPRessoBatch integration test and provides an example where there is an insertion at the edge of the include index. commit 3b3a7417f5bbd6c2785a2af54a47e01d2e820451 Author: Cole Lyman Date: Fri Dec 10 11:37:07 2021 -0700 Fix bug in CRISPRessoCompare where sample names were not properly set This was a place where it was (partially) missed during the crispresso2_info object refactoring. commit e9f5eff3d95b676b5ee2e23371a5604f600d34b2 Author: Cole Lyman Date: Fri Dec 10 15:26:17 2021 -0700 Add a unit test for `find_indels_substitutions` This unit test checks for deletions at the end of a sequence, which are inherently outside of the include_indx_set window. commit d4d45a918254ab19a7e7956e9e731389c6f36ecb Author: Cole Lyman Date: Fri Dec 10 15:03:22 2021 -0700 Fix a bug in `find_indels_substitutions` The bug that this commit fixes is when an insertion occurs at the edge of the include indexes. The trouble with this earlier was that it was using the `idx` to calculate the size of the insertion, but the `idx` wasn't being incremented anymore because it was outside of the include window. commit 13f00bb40239c83e6e5cf844561fdb7000d3d9ab Author: Cole Lyman Date: Fri Dec 10 15:01:39 2021 -0700 Add test case for `find_indels_substitutions` This test case is extracted from the CRISPRessoBatch integration test and provides an example where there is an insertion at the edge of the include index. commit 659ae34e8fd106f7ecc163b5bea0b5a80ab0283c Author: Cole Lyman Date: Fri Dec 10 11:37:07 2021 -0700 Fix bug in CRISPRessoCompare where sample names were not properly set This was a place where it was (partially) missed during the crispresso2_info object refactoring. --- CRISPResso2/CRISPRessoCOREResources.c | 4402 +++++++++-------- CRISPResso2/CRISPRessoCOREResources.pyx | 175 +- CRISPResso2/CRISPRessoCompareCORE.py | 5 +- .../test_CRISPRessoCOREResources.py | 159 + 4 files changed, 2464 insertions(+), 2277 deletions(-) create mode 100644 tests/unit_tests/test_CRISPRessoCOREResources.py diff --git a/CRISPResso2/CRISPRessoCOREResources.c b/CRISPResso2/CRISPRessoCOREResources.c index 56faa79d..12542b2f 100644 --- a/CRISPResso2/CRISPRessoCOREResources.c +++ b/CRISPResso2/CRISPRessoCOREResources.c @@ -1,21 +1,21 @@ -/* Generated by Cython 0.29.21 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ - "/home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h", - "/home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h", - "/home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h", - "/home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h", - "/home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h" + "/Users/cole/mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h", + "/Users/cole/mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/Users/cole/mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/Users/cole/mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/Users/cole/mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/core/include/numpy/ufuncobject.h" ], "extra_compile_args": [ "-w", "-Ofast" ], "include_dirs": [ - "/home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/core/include" + "/Users/cole/mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/core/include" ], "name": "CRISPResso2.CRISPRessoCOREResources", "sources": [ @@ -26,15 +26,17 @@ } END: Cython Metadata */ +#ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_21" -#define CYTHON_HEX_VERSION 0x001D15F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -181,7 +183,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -200,7 +202,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -219,7 +221,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -336,9 +340,68 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #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) @@ -452,8 +515,12 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 + #if defined(PyUnicode_IS_READY) #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) + #else + #define __Pyx_PyUnicode_READY(op) (0) + #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) @@ -462,7 +529,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #endif @@ -568,10 +639,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -738,6 +809,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -877,7 +949,7 @@ static const char *__pyx_f[] = { "type.pxd", }; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":690 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":690 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -886,7 +958,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":691 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":691 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -895,7 +967,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":692 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":692 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -904,7 +976,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":693 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":693 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -913,7 +985,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":697 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":697 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -922,7 +994,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":698 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":698 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -931,7 +1003,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":699 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":699 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -940,7 +1012,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":700 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":700 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -949,7 +1021,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":704 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":704 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -958,7 +1030,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":705 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":705 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -967,7 +1039,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":714 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":714 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -976,7 +1048,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":715 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":715 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -985,7 +1057,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":716 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":716 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -994,7 +1066,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":718 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":718 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -1003,7 +1075,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":719 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":719 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -1012,7 +1084,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":720 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":720 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -1021,7 +1093,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":722 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":722 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1030,7 +1102,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":723 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":723 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1039,7 +1111,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":725 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":725 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1048,7 +1120,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":726 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":726 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1057,7 +1129,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":727 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":727 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1092,7 +1164,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do /*--- Type declarations ---*/ -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":729 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":729 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1101,7 +1173,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":730 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":730 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1110,7 +1182,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":731 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":731 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1119,7 +1191,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":733 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":733 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1214,11 +1286,14 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); -/* pyfrozenset_new.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it); +/* IncludeStringH.proto */ +#include -/* PySetContains.proto */ -static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq); +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS @@ -1259,21 +1334,95 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - /* PySequenceContains.proto */ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } +/* pyfrozenset_new.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it); + +/* PySetContains.proto */ +static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq); + +/* ListExtend.proto */ +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* UnpackUnboundCMethod.proto */ +typedef struct { + PyObject *type; + PyObject **method_name; + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; + +/* CallUnboundCMethod1.proto */ +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif +#if CYTHON_FAST_PYCALL + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1321,54 +1470,9 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - /* PyObjectCall2Args.proto */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); @@ -1388,36 +1492,6 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* UnpackUnboundCMethod.proto */ -typedef struct { - PyObject *type; - PyObject **method_name; - PyCFunction func; - PyObject *method; - int flag; -} __Pyx_CachedCFunction; - -/* CallUnboundCMethod1.proto */ -static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); -#else -#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) -#endif - /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); @@ -1529,11 +1603,10 @@ 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); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif /* RealImag.proto */ #if CYTHON_CCOMPLEX @@ -1636,9 +1709,15 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + /* CIntFromPy.proto */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1710,6 +1789,7 @@ int __pyx_module_is_main_CRISPResso2__CRISPRessoCOREResources = 0; /* Implementation of 'CRISPResso2.CRISPRessoCOREResources' */ static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_sum; static PyObject *__pyx_builtin_ImportError; static const char __pyx_k_[] = "-"; static const char __pyx_k_A[] = "A"; @@ -1747,6 +1827,7 @@ static const char __pyx_k_ref_en[] = "ref_en"; static const char __pyx_k_ref_st[] = "ref_st"; static const char __pyx_k_compile[] = "compile"; static const char __pyx_k_retDict[] = "retDict"; +static const char __pyx_k_seq_len[] = "seq_len"; static const char __pyx_k_sub_seq[] = "sub_seq"; static const char __pyx_k_finditer[] = "finditer"; static const char __pyx_k_enumerate[] = "enumerate"; @@ -1756,13 +1837,16 @@ static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_inc_del_pos[] = "inc_del_pos"; static const char __pyx_k_insertion_n[] = "insertion_n"; static const char __pyx_k_read_seq_al[] = "read_seq_al"; +static const char __pyx_k_end_deletion[] = "end_deletion"; static const char __pyx_k_include_indx[] = "_include_indx"; static const char __pyx_k_intersection[] = "intersection"; static const char __pyx_k_ref_positions[] = "ref_positions"; static const char __pyx_k_deletion_sizes[] = "deletion_sizes"; static const char __pyx_k_re_find_indels[] = "re_find_indels"; +static const char __pyx_k_start_deletion[] = "start_deletion"; static const char __pyx_k_substitution_n[] = "substitution_n"; static const char __pyx_k_insertion_sizes[] = "insertion_sizes"; +static const char __pyx_k_start_insertion[] = "start_insertion"; static const char __pyx_k_include_indx_set[] = "include_indx_set"; static const char __pyx_k_calculate_homology[] = "calculate_homology"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; @@ -1772,6 +1856,7 @@ static const char __pyx_k_substitution_values[] = "substitution_values"; static const char __pyx_k_deletion_coordinates[] = "deletion_coordinates"; static const char __pyx_k_insertion_coordinates[] = "insertion_coordinates"; static const char __pyx_k_all_deletion_positions[] = "all_deletion_positions"; +static const char __pyx_k_current_insertion_size[] = "current_insertion_size"; static const char __pyx_k_substitution_positions[] = "substitution_positions"; static const char __pyx_k_all_insertion_positions[] = "all_insertion_positions"; static const char __pyx_k_all_substitution_values[] = "all_substitution_values"; @@ -1812,6 +1897,7 @@ static PyObject *__pyx_n_s_c; static PyObject *__pyx_n_s_calculate_homology; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_compile; +static PyObject *__pyx_n_s_current_insertion_size; static PyObject *__pyx_n_s_deletion_coordinates; static PyObject *__pyx_n_u_deletion_coordinates; static PyObject *__pyx_n_s_deletion_n; @@ -1821,6 +1907,7 @@ static PyObject *__pyx_n_u_deletion_positions; static PyObject *__pyx_n_s_deletion_sizes; static PyObject *__pyx_n_u_deletion_sizes; static PyObject *__pyx_n_s_en; +static PyObject *__pyx_n_s_end_deletion; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_find_indels_substitutions; static PyObject *__pyx_n_s_find_indels_substitutions_legacy; @@ -1861,8 +1948,11 @@ static PyObject *__pyx_n_s_ref_seq_al; static PyObject *__pyx_n_s_ref_st; static PyObject *__pyx_n_s_retDict; static PyObject *__pyx_n_s_score; +static PyObject *__pyx_n_s_seq_len; static PyObject *__pyx_n_s_span; static PyObject *__pyx_n_s_st; +static PyObject *__pyx_n_s_start_deletion; +static PyObject *__pyx_n_s_start_insertion; static PyObject *__pyx_n_s_sub_seq; static PyObject *__pyx_n_s_substitution_n; static PyObject *__pyx_n_u_substitution_n; @@ -1894,7 +1984,7 @@ static PyObject *__pyx_codeobj__11; * @cython.wraparound(False) * def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< * - * cdef char* sub_seq='' + * #ref_positions holds the indices for which positions map back to the original reference */ /* Python wrapper */ @@ -1974,186 +2064,328 @@ static PyObject *__pyx_pw_11CRISPResso2_23CRISPRessoCOREResources_1find_indels_s } static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_substitutions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_read_seq_al, PyObject *__pyx_v_ref_seq_al, PyObject *__pyx_v__include_indx) { - CYTHON_UNUSED char *__pyx_v_sub_seq; - int __pyx_v_st; - int __pyx_v_en; - int __pyx_v_idx_c; - int __pyx_v_idx; PyObject *__pyx_v_ref_positions = NULL; PyObject *__pyx_v_all_substitution_positions = NULL; PyObject *__pyx_v_substitution_positions = NULL; PyObject *__pyx_v_all_substitution_values = NULL; PyObject *__pyx_v_substitution_values = NULL; - PyObject *__pyx_v_nucSet = NULL; - PyObject *__pyx_v_c = NULL; - Py_ssize_t __pyx_v_substitution_n; PyObject *__pyx_v_all_deletion_positions = NULL; PyObject *__pyx_v_deletion_positions = NULL; PyObject *__pyx_v_deletion_coordinates = NULL; PyObject *__pyx_v_deletion_sizes = NULL; + int __pyx_v_start_deletion; PyObject *__pyx_v_all_insertion_positions = NULL; PyObject *__pyx_v_all_insertion_left_positions = NULL; PyObject *__pyx_v_insertion_positions = NULL; PyObject *__pyx_v_insertion_coordinates = NULL; PyObject *__pyx_v_insertion_sizes = NULL; + int __pyx_v_start_insertion; + size_t __pyx_v_seq_len; PyObject *__pyx_v_include_indx_set = NULL; - PyObject *__pyx_v_p = NULL; - PyObject *__pyx_v_ref_st = NULL; - PyObject *__pyx_v_ref_en = NULL; - PyObject *__pyx_v_inc_del_pos = NULL; - PyObject *__pyx_v_deletion_n = NULL; - PyObject *__pyx_v_insertion_n = NULL; - PyObject *__pyx_v_retDict = NULL; + CYTHON_UNUSED PyObject *__pyx_v_nucSet = NULL; + int __pyx_v_idx; + int __pyx_v_idx_c; + int __pyx_v_current_insertion_size; + PyObject *__pyx_v_c = NULL; + PyObject *__pyx_v_end_deletion = NULL; + size_t __pyx_v_substitution_n; + size_t __pyx_v_deletion_n; + size_t __pyx_v_insertion_n; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *(*__pyx_t_12)(PyObject *); - int __pyx_t_13; - Py_ssize_t __pyx_t_14; - long __pyx_t_15; - int __pyx_t_16; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + size_t __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("find_indels_substitutions", 0); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":24 - * def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): - * - * cdef char* sub_seq='' # <<<<<<<<<<<<<< - * - * cdef int st - */ - __pyx_v_sub_seq = ((char *)""); - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":41 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":33 * # aln A - T T T G G C C * # 1 2 3 4-4 5 6 7 8 tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -2163,7 +2395,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 49, __pyx_L1_error) + else __PYX_ERR(0, 58, __pyx_L1_error) } break; } @@ -2171,133 +2403,132 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su } __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5); __pyx_t_5 = 0; - __pyx_v_idx_c = __pyx_t_2; - __pyx_t_2 = (__pyx_t_2 + 1); + __pyx_v_idx_c = __pyx_t_3; + __pyx_t_3 = (__pyx_t_3 + 1); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":50 - * idx=0 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":59 + * cdef int current_insertion_size = 0 * for idx_c, c in enumerate(ref_seq_al): - * if c in nucSet: # <<<<<<<<<<<<<< + * if c != '-': # <<<<<<<<<<<<<< * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': */ - __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_v_c, __pyx_v_nucSet, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 50, __pyx_L1_error) - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_c, __pyx_kp_u_, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) + if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":51 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":60 * for idx_c, c in enumerate(ref_seq_al): - * if c in nucSet: + * if c != '-': * ref_positions.append(idx) # <<<<<<<<<<<<<< * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': * all_substitution_positions.append(idx) */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":52 - * if c in nucSet: + /* "CRISPResso2/CRISPRessoCOREResources.pyx":61 + * if c != '-': * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': # <<<<<<<<<<<<<< * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ref_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ref_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_6) { + if (__pyx_t_10) { } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_6 = __pyx_t_10; goto __pyx_L7_bool_binop_done; } - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_kp_u_, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_6) { + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_9, __pyx_kp_u_, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_10) { } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_6 = __pyx_t_10; goto __pyx_L7_bool_binop_done; } - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_n_u_N, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_7 = __pyx_t_6; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_9, __pyx_n_u_N, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_6 = __pyx_t_10; __pyx_L7_bool_binop_done:; - if (__pyx_t_7) { + if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":53 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":62 * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': * all_substitution_positions.append(idx) # <<<<<<<<<<<<<< * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_substitution_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_all_substitution_positions, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":54 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":63 * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) # <<<<<<<<<<<<<< * if idx in _include_indx: * substitution_positions.append(idx) */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_substitution_values, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_all_substitution_values, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":55 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":64 * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: # <<<<<<<<<<<<<< * substitution_positions.append(idx) * substitution_values.append(read_seq_al[idx_c]) */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_10, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_6 = (__pyx_t_7 != 0); - if (__pyx_t_6) { + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_9, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = (__pyx_t_6 != 0); + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":56 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":65 * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: * substitution_positions.append(idx) # <<<<<<<<<<<<<< * substitution_values.append(read_seq_al[idx_c]) - * + * if start_insertion != -1: # this is the end of an insertion */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_substitution_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_substitution_positions, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":57 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":66 * if idx in _include_indx: * substitution_positions.append(idx) * substitution_values.append(read_seq_al[idx_c]) # <<<<<<<<<<<<<< - * - * idx+=1 + * if start_insertion != -1: # this is the end of an insertion + * all_insertion_left_positions.append(start_insertion) */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_substitution_values, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_substitution_values, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":55 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":64 * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: # <<<<<<<<<<<<<< @@ -2306,8 +2537,8 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":52 - * if c in nucSet: + /* "CRISPResso2/CRISPRessoCOREResources.pyx":61 + * if c != '-': * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': # <<<<<<<<<<<<<< * all_substitution_positions.append(idx) @@ -2315,1133 +2546,864 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":59 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":67 + * substitution_positions.append(idx) * substitution_values.append(read_seq_al[idx_c]) - * - * idx+=1 # <<<<<<<<<<<<<< - * - * else: + * if start_insertion != -1: # this is the end of an insertion # <<<<<<<<<<<<<< + * all_insertion_left_positions.append(start_insertion) + * all_insertion_positions.append(start_insertion) + */ + __pyx_t_10 = ((__pyx_v_start_insertion != -1L) != 0); + if (__pyx_t_10) { + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":68 + * substitution_values.append(read_seq_al[idx_c]) + * if start_insertion != -1: # this is the end of an insertion + * all_insertion_left_positions.append(start_insertion) # <<<<<<<<<<<<<< + * all_insertion_positions.append(start_insertion) + * all_insertion_positions.append(idx) + */ + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_start_insertion); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_all_insertion_left_positions, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":69 + * if start_insertion != -1: # this is the end of an insertion + * all_insertion_left_positions.append(start_insertion) + * all_insertion_positions.append(start_insertion) # <<<<<<<<<<<<<< + * all_insertion_positions.append(idx) + * if start_insertion in include_indx_set and idx in include_indx_set: + */ + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_start_insertion); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":70 + * all_insertion_left_positions.append(start_insertion) + * all_insertion_positions.append(start_insertion) + * all_insertion_positions.append(idx) # <<<<<<<<<<<<<< + * if start_insertion in include_indx_set and idx in include_indx_set: + * insertion_coordinates.append((start_insertion, idx)) + */ + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":71 + * all_insertion_positions.append(start_insertion) + * all_insertion_positions.append(idx) + * if start_insertion in include_indx_set and idx in include_indx_set: # <<<<<<<<<<<<<< + * insertion_coordinates.append((start_insertion, idx)) + * insertion_positions.append(start_insertion) + */ + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_start_insertion); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_t_9, __pyx_v_include_indx_set, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = (__pyx_t_6 != 0); + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_t_9, __pyx_v_include_indx_set, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_6 = (__pyx_t_11 != 0); + __pyx_t_10 = __pyx_t_6; + __pyx_L13_bool_binop_done:; + if (__pyx_t_10) { + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":72 + * all_insertion_positions.append(idx) + * if start_insertion in include_indx_set and idx in include_indx_set: + * insertion_coordinates.append((start_insertion, idx)) # <<<<<<<<<<<<<< + * insertion_positions.append(start_insertion) + * insertion_positions.append(idx) + */ + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_start_insertion); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_insertion_coordinates, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":73 + * if start_insertion in include_indx_set and idx in include_indx_set: + * insertion_coordinates.append((start_insertion, idx)) + * insertion_positions.append(start_insertion) # <<<<<<<<<<<<<< + * insertion_positions.append(idx) + * insertion_sizes.append(current_insertion_size) + */ + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start_insertion); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":74 + * insertion_coordinates.append((start_insertion, idx)) + * insertion_positions.append(start_insertion) + * insertion_positions.append(idx) # <<<<<<<<<<<<<< + * insertion_sizes.append(current_insertion_size) + * start_insertion = -1 + */ + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":75 + * insertion_positions.append(start_insertion) + * insertion_positions.append(idx) + * insertion_sizes.append(current_insertion_size) # <<<<<<<<<<<<<< + * start_insertion = -1 + * current_insertion_size = 0 + */ + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_current_insertion_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_insertion_sizes, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":71 + * all_insertion_positions.append(start_insertion) + * all_insertion_positions.append(idx) + * if start_insertion in include_indx_set and idx in include_indx_set: # <<<<<<<<<<<<<< + * insertion_coordinates.append((start_insertion, idx)) + * insertion_positions.append(start_insertion) + */ + } + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":76 + * insertion_positions.append(idx) + * insertion_sizes.append(current_insertion_size) + * start_insertion = -1 # <<<<<<<<<<<<<< + * current_insertion_size = 0 + * idx += 1 + */ + __pyx_v_start_insertion = -1; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":67 + * substitution_positions.append(idx) + * substitution_values.append(read_seq_al[idx_c]) + * if start_insertion != -1: # this is the end of an insertion # <<<<<<<<<<<<<< + * all_insertion_left_positions.append(start_insertion) + * all_insertion_positions.append(start_insertion) + */ + } + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":77 + * insertion_sizes.append(current_insertion_size) + * start_insertion = -1 + * current_insertion_size = 0 # <<<<<<<<<<<<<< + * idx += 1 + * else: # the current ref position is - + */ + __pyx_v_current_insertion_size = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":78 + * start_insertion = -1 + * current_insertion_size = 0 + * idx += 1 # <<<<<<<<<<<<<< + * else: # the current ref position is - + * if idx == 0: */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":50 - * idx=0 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":59 + * cdef int current_insertion_size = 0 * for idx_c, c in enumerate(ref_seq_al): - * if c in nucSet: # <<<<<<<<<<<<<< + * if c != '-': # <<<<<<<<<<<<<< * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': */ goto __pyx_L5; } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":62 - * - * else: - * if idx==0: # <<<<<<<<<<<<<< + /* "CRISPResso2/CRISPRessoCOREResources.pyx":80 + * idx += 1 + * else: # the current ref position is - + * if idx == 0: # <<<<<<<<<<<<<< * ref_positions.append(-1) * else: */ /*else*/ { - __pyx_t_6 = ((__pyx_v_idx == 0) != 0); - if (__pyx_t_6) { + __pyx_t_10 = ((__pyx_v_idx == 0) != 0); + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":63 - * else: - * if idx==0: + /* "CRISPResso2/CRISPRessoCOREResources.pyx":81 + * else: # the current ref position is - + * if idx == 0: * ref_positions.append(-1) # <<<<<<<<<<<<<< * else: * ref_positions.append(-idx) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_int_neg_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_int_neg_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 81, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":62 - * - * else: - * if idx==0: # <<<<<<<<<<<<<< + /* "CRISPResso2/CRISPRessoCOREResources.pyx":80 + * idx += 1 + * else: # the current ref position is - + * if idx == 0: # <<<<<<<<<<<<<< * ref_positions.append(-1) * else: */ - goto __pyx_L11; + goto __pyx_L15; } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":65 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":83 * ref_positions.append(-1) * else: * ref_positions.append(-idx) # <<<<<<<<<<<<<< - * - * substitution_n = len(substitution_positions) + * if idx > 0 and start_insertion == -1: # this is the first index of an insertion + * start_insertion = idx - 1 */ /*else*/ { - __pyx_t_10 = __Pyx_PyInt_From_int((-__pyx_v_idx)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int((-__pyx_v_idx)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_L11:; - } - __pyx_L5:; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":49 - * nucSet = set(['A', 'T', 'C', 'G', 'N']) - * idx=0 - * for idx_c, c in enumerate(ref_seq_al): # <<<<<<<<<<<<<< - * if c in nucSet: - * ref_positions.append(idx) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L15:; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":67 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":84 + * else: * ref_positions.append(-idx) - * - * substitution_n = len(substitution_positions) # <<<<<<<<<<<<<< - * - * #the remainder of positions are with reference to the original reference sequence indexes we calculated above + * if idx > 0 and start_insertion == -1: # this is the first index of an insertion # <<<<<<<<<<<<<< + * start_insertion = idx - 1 + * current_insertion_size += 1 */ - __pyx_t_3 = PyList_GET_SIZE(__pyx_v_substitution_positions); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 67, __pyx_L1_error) - __pyx_v_substitution_n = __pyx_t_3; + __pyx_t_6 = ((__pyx_v_idx > 0) != 0); + if (__pyx_t_6) { + } else { + __pyx_t_10 = __pyx_t_6; + goto __pyx_L17_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_start_insertion == -1L) != 0); + __pyx_t_10 = __pyx_t_6; + __pyx_L17_bool_binop_done:; + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":70 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":85 + * ref_positions.append(-idx) + * if idx > 0 and start_insertion == -1: # this is the first index of an insertion + * start_insertion = idx - 1 # <<<<<<<<<<<<<< + * current_insertion_size += 1 * - * #the remainder of positions are with reference to the original reference sequence indexes we calculated above - * all_deletion_positions=[] # <<<<<<<<<<<<<< - * deletion_positions=[] - * deletion_coordinates=[] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_all_deletion_positions = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_start_insertion = (__pyx_v_idx - 1); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":71 - * #the remainder of positions are with reference to the original reference sequence indexes we calculated above - * all_deletion_positions=[] - * deletion_positions=[] # <<<<<<<<<<<<<< - * deletion_coordinates=[] - * deletion_sizes=[] + /* "CRISPResso2/CRISPRessoCOREResources.pyx":84 + * else: + * ref_positions.append(-idx) + * if idx > 0 and start_insertion == -1: # this is the first index of an insertion # <<<<<<<<<<<<<< + * start_insertion = idx - 1 + * current_insertion_size += 1 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_deletion_positions = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":72 - * all_deletion_positions=[] - * deletion_positions=[] - * deletion_coordinates=[] # <<<<<<<<<<<<<< - * deletion_sizes=[] + /* "CRISPResso2/CRISPRessoCOREResources.pyx":86 + * if idx > 0 and start_insertion == -1: # this is the first index of an insertion + * start_insertion = idx - 1 + * current_insertion_size += 1 # <<<<<<<<<<<<<< * + * if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_deletion_coordinates = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_current_insertion_size = (__pyx_v_current_insertion_size + 1); + } + __pyx_L5:; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":73 - * deletion_positions=[] - * deletion_coordinates=[] - * deletion_sizes=[] # <<<<<<<<<<<<<< + /* "CRISPResso2/CRISPRessoCOREResources.pyx":88 + * current_insertion_size += 1 * - * all_insertion_positions=[] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_deletion_sizes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":75 - * deletion_sizes=[] - * - * all_insertion_positions=[] # <<<<<<<<<<<<<< - * all_insertion_left_positions=[] - * insertion_positions=[] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_all_insertion_positions = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":76 - * - * all_insertion_positions=[] - * all_insertion_left_positions=[] # <<<<<<<<<<<<<< - * insertion_positions=[] - * insertion_coordinates = [] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_all_insertion_left_positions = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":77 - * all_insertion_positions=[] - * all_insertion_left_positions=[] - * insertion_positions=[] # <<<<<<<<<<<<<< - * insertion_coordinates = [] - * insertion_sizes=[] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_insertion_positions = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":78 - * all_insertion_left_positions=[] - * insertion_positions=[] - * insertion_coordinates = [] # <<<<<<<<<<<<<< - * insertion_sizes=[] - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_insertion_coordinates = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":79 - * insertion_positions=[] - * insertion_coordinates = [] - * insertion_sizes=[] # <<<<<<<<<<<<<< - * - * include_indx_set = set(_include_indx) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_insertion_sizes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":81 - * insertion_sizes=[] - * - * include_indx_set = set(_include_indx) # <<<<<<<<<<<<<< - * for p in re_find_indels.finditer(read_seq_al): - * st,en=p.span() - */ - __pyx_t_1 = PySet_New(__pyx_v__include_indx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_include_indx_set = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":82 - * - * include_indx_set = set(_include_indx) - * for p in re_find_indels.finditer(read_seq_al): # <<<<<<<<<<<<<< - * st,en=p.span() - * ref_st = 0 - */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_re_find_indels); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_finditer); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_read_seq_al) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_read_seq_al); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_9))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 82, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 82, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_9); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 82, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":83 - * include_indx_set = set(_include_indx) - * for p in re_find_indels.finditer(read_seq_al): - * st,en=p.span() # <<<<<<<<<<<<<< - * ref_st = 0 - * if st-1 > 0: - */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_span); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 83, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_10 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L14_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 1; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 83, __pyx_L1_error) - __pyx_t_12 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L15_unpacking_done; - __pyx_L14_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 83, __pyx_L1_error) - __pyx_L15_unpacking_done:; - } - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_st = __pyx_t_2; - __pyx_v_en = __pyx_t_13; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":84 - * for p in re_find_indels.finditer(read_seq_al): - * st,en=p.span() - * ref_st = 0 # <<<<<<<<<<<<<< - * if st-1 > 0: - * ref_st = ref_positions[st] - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_XDECREF_SET(__pyx_v_ref_st, __pyx_int_0); - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":85 - * st,en=p.span() - * ref_st = 0 - * if st-1 > 0: # <<<<<<<<<<<<<< - * ref_st = ref_positions[st] - * ref_en = idx-1 - */ - __pyx_t_6 = (((__pyx_v_st - 1) > 0) != 0); - if (__pyx_t_6) { - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":86 - * ref_st = 0 - * if st-1 > 0: - * ref_st = ref_positions[st] # <<<<<<<<<<<<<< - * ref_en = idx-1 - * if en < len(ref_positions): - */ - __pyx_t_1 = PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_v_st); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_ref_st, __pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":85 - * st,en=p.span() - * ref_st = 0 - * if st-1 > 0: # <<<<<<<<<<<<<< - * ref_st = ref_positions[st] - * ref_en = idx-1 - */ - } - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":87 - * if st-1 > 0: - * ref_st = ref_positions[st] - * ref_en = idx-1 # <<<<<<<<<<<<<< - * if en < len(ref_positions): - * ref_en = ref_positions[en] - */ - __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_idx - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_ref_en, __pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":88 - * ref_st = ref_positions[st] - * ref_en = idx-1 - * if en < len(ref_positions): # <<<<<<<<<<<<<< - * ref_en = ref_positions[en] - * all_deletion_positions.extend(range(ref_st,ref_en)) - */ - __pyx_t_14 = PyList_GET_SIZE(__pyx_v_ref_positions); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 88, __pyx_L1_error) - __pyx_t_6 = ((__pyx_v_en < __pyx_t_14) != 0); - if (__pyx_t_6) { - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":89 - * ref_en = idx-1 - * if en < len(ref_positions): - * ref_en = ref_positions[en] # <<<<<<<<<<<<<< - * all_deletion_positions.extend(range(ref_st,ref_en)) - * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) - */ - __pyx_t_1 = PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_v_en); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_ref_en, __pyx_t_1); - __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":88 - * ref_st = ref_positions[st] - * ref_en = idx-1 - * if en < len(ref_positions): # <<<<<<<<<<<<<< - * ref_en = ref_positions[en] - * all_deletion_positions.extend(range(ref_st,ref_en)) - */ - } - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":90 - * if en < len(ref_positions): - * ref_en = ref_positions[en] - * all_deletion_positions.extend(range(ref_st,ref_en)) # <<<<<<<<<<<<<< - * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) - * if(len(inc_del_pos)>0): - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_ref_st); - __Pyx_GIVEREF(__pyx_v_ref_st); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ref_st); - __Pyx_INCREF(__pyx_v_ref_en); - __Pyx_GIVEREF(__pyx_v_ref_en); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref_en); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyList_Extend(__pyx_v_all_deletion_positions, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":91 - * ref_en = ref_positions[en] - * all_deletion_positions.extend(range(ref_st,ref_en)) - * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) # <<<<<<<<<<<<<< - * if(len(inc_del_pos)>0): - * deletion_positions.extend(range(ref_st,ref_en)) - */ - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_ref_st); - __Pyx_GIVEREF(__pyx_v_ref_st); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ref_st); - __Pyx_INCREF(__pyx_v_ref_en); - __Pyx_GIVEREF(__pyx_v_ref_en); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ref_en); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_intersection, __pyx_v_include_indx_set, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_inc_del_pos, __pyx_t_5); - __pyx_t_5 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":92 - * all_deletion_positions.extend(range(ref_st,ref_en)) - * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) - * if(len(inc_del_pos)>0): # <<<<<<<<<<<<<< - * deletion_positions.extend(range(ref_st,ref_en)) - * deletion_coordinates.append((ref_st,ref_en)) - */ - __pyx_t_14 = PyObject_Length(__pyx_v_inc_del_pos); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_t_6 = ((__pyx_t_14 > 0) != 0); - if (__pyx_t_6) { - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":93 - * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) - * if(len(inc_del_pos)>0): - * deletion_positions.extend(range(ref_st,ref_en)) # <<<<<<<<<<<<<< - * deletion_coordinates.append((ref_st,ref_en)) - * deletion_sizes.append(en-st) - */ - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_ref_st); - __Pyx_GIVEREF(__pyx_v_ref_st); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ref_st); - __Pyx_INCREF(__pyx_v_ref_en); - __Pyx_GIVEREF(__pyx_v_ref_en); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ref_en); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyList_Extend(__pyx_v_deletion_positions, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":94 - * if(len(inc_del_pos)>0): - * deletion_positions.extend(range(ref_st,ref_en)) - * deletion_coordinates.append((ref_st,ref_en)) # <<<<<<<<<<<<<< - * deletion_sizes.append(en-st) - * - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_ref_st); - __Pyx_GIVEREF(__pyx_v_ref_st); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ref_st); - __Pyx_INCREF(__pyx_v_ref_en); - __Pyx_GIVEREF(__pyx_v_ref_en); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref_en); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deletion_coordinates, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":95 - * deletion_positions.extend(range(ref_st,ref_en)) - * deletion_coordinates.append((ref_st,ref_en)) - * deletion_sizes.append(en-st) # <<<<<<<<<<<<<< - * - * deletion_n = np.sum(deletion_sizes) - */ - __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_en - __pyx_v_st)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deletion_sizes, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":92 - * all_deletion_positions.extend(range(ref_st,ref_en)) - * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) - * if(len(inc_del_pos)>0): # <<<<<<<<<<<<<< - * deletion_positions.extend(range(ref_st,ref_en)) - * deletion_coordinates.append((ref_st,ref_en)) - */ - } - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":82 - * - * include_indx_set = set(_include_indx) - * for p in re_find_indels.finditer(read_seq_al): # <<<<<<<<<<<<<< - * st,en=p.span() - * ref_st = 0 - */ - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":97 - * deletion_sizes.append(en-st) - * - * deletion_n = np.sum(deletion_sizes) # <<<<<<<<<<<<<< - * - * for p in re_find_indels.finditer(ref_seq_al): - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_deletion_sizes) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_deletion_sizes); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_deletion_n = __pyx_t_9; - __pyx_t_9 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":99 - * deletion_n = np.sum(deletion_sizes) - * - * for p in re_find_indels.finditer(ref_seq_al): # <<<<<<<<<<<<<< - * st,en=p.span() - * #sometimes insertions run off the end of the reference - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re_find_indels); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_finditer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_9 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_ref_seq_al) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_ref_seq_al); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { - __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } - } else { - __pyx_t_9 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 99, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_9); - __pyx_t_9 = 0; - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":100 - * - * for p in re_find_indels.finditer(ref_seq_al): - * st,en=p.span() # <<<<<<<<<<<<<< - * #sometimes insertions run off the end of the reference - * if st == 0: # if insertion happened before ref + * if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion # <<<<<<<<<<<<<< + * if idx_c - 1 > 0: + * start_deletion = ref_positions[idx_c] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_span); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { - PyObject* sequence = __pyx_t_9; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 100, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_10 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_10); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - #endif - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_6) { } else { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_t_12 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L22_unpacking_done; - __pyx_L21_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_L22_unpacking_done:; + __pyx_t_10 = __pyx_t_6; + goto __pyx_L20_bool_binop_done; } - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_st = __pyx_t_13; - __pyx_v_en = __pyx_t_2; + __pyx_t_6 = ((__pyx_v_start_deletion == -1L) != 0); + __pyx_t_10 = __pyx_t_6; + __pyx_L20_bool_binop_done:; + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":102 - * st,en=p.span() - * #sometimes insertions run off the end of the reference - * if st == 0: # if insertion happened before ref # <<<<<<<<<<<<<< - * continue - * if en == len(ref_seq_al): # if insertion happened after ref + /* "CRISPResso2/CRISPRessoCOREResources.pyx":89 + * + * if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion + * if idx_c - 1 > 0: # <<<<<<<<<<<<<< + * start_deletion = ref_positions[idx_c] + * else: */ - __pyx_t_6 = ((__pyx_v_st == 0) != 0); - if (__pyx_t_6) { + __pyx_t_10 = (((__pyx_v_idx_c - 1) > 0) != 0); + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":103 - * #sometimes insertions run off the end of the reference - * if st == 0: # if insertion happened before ref - * continue # <<<<<<<<<<<<<< - * if en == len(ref_seq_al): # if insertion happened after ref - * continue + /* "CRISPResso2/CRISPRessoCOREResources.pyx":90 + * if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion + * if idx_c - 1 > 0: + * start_deletion = ref_positions[idx_c] # <<<<<<<<<<<<<< + * else: + * start_deletion = 0 */ - goto __pyx_L19_continue; + __pyx_t_12 = __Pyx_PyInt_As_int(PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_v_idx_c)); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_v_start_deletion = __pyx_t_12; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":102 - * st,en=p.span() - * #sometimes insertions run off the end of the reference - * if st == 0: # if insertion happened before ref # <<<<<<<<<<<<<< - * continue - * if en == len(ref_seq_al): # if insertion happened after ref + /* "CRISPResso2/CRISPRessoCOREResources.pyx":89 + * + * if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion + * if idx_c - 1 > 0: # <<<<<<<<<<<<<< + * start_deletion = ref_positions[idx_c] + * else: + */ + goto __pyx_L22; + } + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":92 + * start_deletion = ref_positions[idx_c] + * else: + * start_deletion = 0 # <<<<<<<<<<<<<< + * elif read_seq_al[idx_c] != '-' and start_deletion != -1: # this is the end of a deletion + * end_deletion = ref_positions[idx_c] + */ + /*else*/ { + __pyx_v_start_deletion = 0; + } + __pyx_L22:; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":88 + * current_insertion_size += 1 + * + * if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion # <<<<<<<<<<<<<< + * if idx_c - 1 > 0: + * start_deletion = ref_positions[idx_c] */ + goto __pyx_L19; } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":104 - * if st == 0: # if insertion happened before ref - * continue - * if en == len(ref_seq_al): # if insertion happened after ref # <<<<<<<<<<<<<< - * continue - * ref_st = ref_positions[st-1] + /* "CRISPResso2/CRISPRessoCOREResources.pyx":93 + * else: + * start_deletion = 0 + * elif read_seq_al[idx_c] != '-' and start_deletion != -1: # this is the end of a deletion # <<<<<<<<<<<<<< + * end_deletion = ref_positions[idx_c] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) */ - __pyx_t_14 = PyObject_Length(__pyx_v_ref_seq_al); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 104, __pyx_L1_error) - __pyx_t_6 = ((__pyx_v_en == __pyx_t_14) != 0); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { + } else { + __pyx_t_10 = __pyx_t_6; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_start_deletion != -1L) != 0); + __pyx_t_10 = __pyx_t_6; + __pyx_L23_bool_binop_done:; + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":105 - * continue - * if en == len(ref_seq_al): # if insertion happened after ref - * continue # <<<<<<<<<<<<<< - * ref_st = ref_positions[st-1] - * ref_en = ref_positions[en] + /* "CRISPResso2/CRISPRessoCOREResources.pyx":94 + * start_deletion = 0 + * elif read_seq_al[idx_c] != '-' and start_deletion != -1: # this is the end of a deletion + * end_deletion = ref_positions[idx_c] # <<<<<<<<<<<<<< + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): */ - goto __pyx_L19_continue; + __pyx_t_5 = PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_v_idx_c); + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_end_deletion, __pyx_t_5); + __pyx_t_5 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":104 - * if st == 0: # if insertion happened before ref - * continue - * if en == len(ref_seq_al): # if insertion happened after ref # <<<<<<<<<<<<<< - * continue - * ref_st = ref_positions[st-1] + /* "CRISPResso2/CRISPRessoCOREResources.pyx":95 + * elif read_seq_al[idx_c] != '-' and start_deletion != -1: # this is the end of a deletion + * end_deletion = ref_positions[idx_c] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) # <<<<<<<<<<<<<< + * if include_indx_set.intersection(range(start_deletion, end_deletion)): + * deletion_positions.extend(range(start_deletion, end_deletion)) */ - } + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_end_deletion); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_all_deletion_positions, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":106 - * if en == len(ref_seq_al): # if insertion happened after ref - * continue - * ref_st = ref_positions[st-1] # <<<<<<<<<<<<<< - * ref_en = ref_positions[en] - * + /* "CRISPResso2/CRISPRessoCOREResources.pyx":96 + * end_deletion = ref_positions[idx_c] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): # <<<<<<<<<<<<<< + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) */ - __pyx_t_15 = (__pyx_v_st - 1); - __pyx_t_9 = PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_t_15); - __Pyx_INCREF(__pyx_t_9); - __Pyx_XDECREF_SET(__pyx_v_ref_st, __pyx_t_9); - __pyx_t_9 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_end_deletion); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_intersection, __pyx_v_include_indx_set, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_10) { + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":97 + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): + * deletion_positions.extend(range(start_deletion, end_deletion)) # <<<<<<<<<<<<<< + * deletion_coordinates.append((start_deletion, end_deletion)) + * deletion_sizes.append(end_deletion - start_deletion) + */ + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_end_deletion); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_deletion_positions, __pyx_t_8); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":98 + * if include_indx_set.intersection(range(start_deletion, end_deletion)): + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) # <<<<<<<<<<<<<< + * deletion_sizes.append(end_deletion - start_deletion) + * start_deletion = -1 + */ + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_end_deletion); + __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_deletion_coordinates, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":99 + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) + * deletion_sizes.append(end_deletion - start_deletion) # <<<<<<<<<<<<<< + * start_deletion = -1 + * + */ + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyNumber_Subtract(__pyx_v_end_deletion, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_deletion_sizes, __pyx_t_8); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":96 + * end_deletion = ref_positions[idx_c] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): # <<<<<<<<<<<<<< + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) + */ + } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":107 - * continue - * ref_st = ref_positions[st-1] - * ref_en = ref_positions[en] # <<<<<<<<<<<<<< + /* "CRISPResso2/CRISPRessoCOREResources.pyx":100 + * deletion_coordinates.append((start_deletion, end_deletion)) + * deletion_sizes.append(end_deletion - start_deletion) + * start_deletion = -1 # <<<<<<<<<<<<<< * - * all_insertion_left_positions.append(ref_st) + * if start_deletion != -1: */ - __pyx_t_9 = PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_v_en); - __Pyx_INCREF(__pyx_t_9); - __Pyx_XDECREF_SET(__pyx_v_ref_en, __pyx_t_9); - __pyx_t_9 = 0; + __pyx_v_start_deletion = -1; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":109 - * ref_en = ref_positions[en] - * - * all_insertion_left_positions.append(ref_st) # <<<<<<<<<<<<<< - * all_insertion_positions.append(ref_st) - * all_insertion_positions.append(ref_en) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":93 + * else: + * start_deletion = 0 + * elif read_seq_al[idx_c] != '-' and start_deletion != -1: # this is the end of a deletion # <<<<<<<<<<<<<< + * end_deletion = ref_positions[idx_c] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_left_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 109, __pyx_L1_error) + } + __pyx_L19:; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":110 - * - * all_insertion_left_positions.append(ref_st) - * all_insertion_positions.append(ref_st) # <<<<<<<<<<<<<< - * all_insertion_positions.append(ref_en) - * if(ref_st in _include_indx and ref_en in _include_indx): + /* "CRISPResso2/CRISPRessoCOREResources.pyx":58 + * cdef int idx_c + * cdef int current_insertion_size = 0 + * for idx_c, c in enumerate(ref_seq_al): # <<<<<<<<<<<<<< + * if c != '-': + * ref_positions.append(idx) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 110, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":111 - * all_insertion_left_positions.append(ref_st) - * all_insertion_positions.append(ref_st) - * all_insertion_positions.append(ref_en) # <<<<<<<<<<<<<< - * if(ref_st in _include_indx and ref_en in _include_indx): - * insertion_coordinates.append((ref_st,ref_en)) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":102 + * start_deletion = -1 + * + * if start_deletion != -1: # <<<<<<<<<<<<<< + * end_deletion = ref_positions[seq_len - 1] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_v_ref_en); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_10 = ((__pyx_v_start_deletion != -1L) != 0); + if (__pyx_t_10) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":112 - * all_insertion_positions.append(ref_st) - * all_insertion_positions.append(ref_en) - * if(ref_st in _include_indx and ref_en in _include_indx): # <<<<<<<<<<<<<< - * insertion_coordinates.append((ref_st,ref_en)) - * insertion_positions.append(ref_st) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":103 + * + * if start_deletion != -1: + * end_deletion = ref_positions[seq_len - 1] # <<<<<<<<<<<<<< + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): */ - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_ref_st, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) - __pyx_t_16 = (__pyx_t_7 != 0); - if (__pyx_t_16) { - } else { - __pyx_t_6 = __pyx_t_16; - goto __pyx_L26_bool_binop_done; - } - __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_v_ref_en, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) - __pyx_t_7 = (__pyx_t_16 != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L26_bool_binop_done:; - if (__pyx_t_6) { + __pyx_t_13 = (__pyx_v_seq_len - 1); + __pyx_t_1 = PyList_GET_ITEM(__pyx_v_ref_positions, __pyx_t_13); + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_end_deletion, __pyx_t_1); + __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":113 - * all_insertion_positions.append(ref_en) - * if(ref_st in _include_indx and ref_en in _include_indx): - * insertion_coordinates.append((ref_st,ref_en)) # <<<<<<<<<<<<<< - * insertion_positions.append(ref_st) - * insertion_positions.append(ref_en) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":104 + * if start_deletion != -1: + * end_deletion = ref_positions[seq_len - 1] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) # <<<<<<<<<<<<<< + * if include_indx_set.intersection(range(start_deletion, end_deletion)): + * deletion_positions.extend(range(start_deletion, end_deletion)) */ - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_ref_st); - __Pyx_GIVEREF(__pyx_v_ref_st); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ref_st); - __Pyx_INCREF(__pyx_v_ref_en); - __Pyx_GIVEREF(__pyx_v_ref_en); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_ref_en); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_coordinates, __pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_end_deletion); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_all_deletion_positions, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":114 - * if(ref_st in _include_indx and ref_en in _include_indx): - * insertion_coordinates.append((ref_st,ref_en)) - * insertion_positions.append(ref_st) # <<<<<<<<<<<<<< - * insertion_positions.append(ref_en) - * insertion_sizes.append(en-st) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":105 + * end_deletion = ref_positions[seq_len - 1] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): # <<<<<<<<<<<<<< + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_end_deletion); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_intersection, __pyx_v_include_indx_set, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_10) { + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":106 + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): + * deletion_positions.extend(range(start_deletion, end_deletion)) # <<<<<<<<<<<<<< + * deletion_coordinates.append((start_deletion, end_deletion)) + * deletion_sizes.append(end_deletion - start_deletion) + */ + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_end_deletion); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_deletion_positions, __pyx_t_8); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":115 - * insertion_coordinates.append((ref_st,ref_en)) - * insertion_positions.append(ref_st) - * insertion_positions.append(ref_en) # <<<<<<<<<<<<<< - * insertion_sizes.append(en-st) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":107 + * if include_indx_set.intersection(range(start_deletion, end_deletion)): + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) # <<<<<<<<<<<<<< + * deletion_sizes.append(end_deletion - start_deletion) * */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_v_ref_en); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 115, __pyx_L1_error) - - /* "CRISPResso2/CRISPRessoCOREResources.pyx":116 - * insertion_positions.append(ref_st) - * insertion_positions.append(ref_en) - * insertion_sizes.append(en-st) # <<<<<<<<<<<<<< + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); + __Pyx_INCREF(__pyx_v_end_deletion); + __Pyx_GIVEREF(__pyx_v_end_deletion); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_end_deletion); + __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_deletion_coordinates, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":108 + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) + * deletion_sizes.append(end_deletion - start_deletion) # <<<<<<<<<<<<<< * - * insertion_n = np.sum(insertion_sizes) + * cdef size_t substitution_n = len(substitution_positions) */ - __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_en - __pyx_v_st)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_sizes, __pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start_deletion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyNumber_Subtract(__pyx_v_end_deletion, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_deletion_sizes, __pyx_t_8); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":112 - * all_insertion_positions.append(ref_st) - * all_insertion_positions.append(ref_en) - * if(ref_st in _include_indx and ref_en in _include_indx): # <<<<<<<<<<<<<< - * insertion_coordinates.append((ref_st,ref_en)) - * insertion_positions.append(ref_st) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":105 + * end_deletion = ref_positions[seq_len - 1] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) + * if include_indx_set.intersection(range(start_deletion, end_deletion)): # <<<<<<<<<<<<<< + * deletion_positions.extend(range(start_deletion, end_deletion)) + * deletion_coordinates.append((start_deletion, end_deletion)) */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":99 - * deletion_n = np.sum(deletion_sizes) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":102 + * start_deletion = -1 * - * for p in re_find_indels.finditer(ref_seq_al): # <<<<<<<<<<<<<< - * st,en=p.span() - * #sometimes insertions run off the end of the reference + * if start_deletion != -1: # <<<<<<<<<<<<<< + * end_deletion = ref_positions[seq_len - 1] + * all_deletion_positions.extend(range(start_deletion, end_deletion)) */ - __pyx_L19_continue:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":118 - * insertion_sizes.append(en-st) + /* "CRISPResso2/CRISPRessoCOREResources.pyx":110 + * deletion_sizes.append(end_deletion - start_deletion) * - * insertion_n = np.sum(insertion_sizes) # <<<<<<<<<<<<<< + * cdef size_t substitution_n = len(substitution_positions) # <<<<<<<<<<<<<< + * cdef size_t deletion_n = sum(deletion_sizes) + * cdef size_t insertion_n = sum(insertion_sizes) + */ + __pyx_t_2 = PyList_GET_SIZE(__pyx_v_substitution_positions); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_v_substitution_n = __pyx_t_2; + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":111 * + * cdef size_t substitution_n = len(substitution_positions) + * cdef size_t deletion_n = sum(deletion_sizes) # <<<<<<<<<<<<<< + * cdef size_t insertion_n = sum(insertion_sizes) * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_insertion_sizes) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_insertion_sizes); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_insertion_n = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_v_deletion_sizes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_t_8); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_deletion_n = __pyx_t_13; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":122 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":112 + * cdef size_t substitution_n = len(substitution_positions) + * cdef size_t deletion_n = sum(deletion_sizes) + * cdef size_t insertion_n = sum(insertion_sizes) # <<<<<<<<<<<<<< * - * retDict = { - * 'all_insertion_positions':all_insertion_positions, # <<<<<<<<<<<<<< - * 'all_insertion_left_positions':all_insertion_left_positions, - * 'insertion_positions':insertion_positions, + * return { */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_insertion_positions, __pyx_v_all_insertion_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_v_insertion_sizes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_t_8); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_insertion_n = __pyx_t_13; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":123 - * retDict = { - * 'all_insertion_positions':all_insertion_positions, - * 'all_insertion_left_positions':all_insertion_left_positions, # <<<<<<<<<<<<<< - * 'insertion_positions':insertion_positions, - * 'insertion_coordinates':insertion_coordinates, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":114 + * cdef size_t insertion_n = sum(insertion_sizes) + * + * return { # <<<<<<<<<<<<<< + * 'all_insertion_positions': all_insertion_positions, + * 'all_insertion_left_positions': all_insertion_left_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_insertion_left_positions, __pyx_v_all_insertion_left_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":124 - * 'all_insertion_positions':all_insertion_positions, - * 'all_insertion_left_positions':all_insertion_left_positions, - * 'insertion_positions':insertion_positions, # <<<<<<<<<<<<<< - * 'insertion_coordinates':insertion_coordinates, - * 'insertion_sizes':insertion_sizes, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":115 + * + * return { + * 'all_insertion_positions': all_insertion_positions, # <<<<<<<<<<<<<< + * 'all_insertion_left_positions': all_insertion_left_positions, + * 'insertion_positions': insertion_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_positions, __pyx_v_insertion_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyDict_NewPresized(17); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_all_insertion_positions, __pyx_v_all_insertion_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":125 - * 'all_insertion_left_positions':all_insertion_left_positions, - * 'insertion_positions':insertion_positions, - * 'insertion_coordinates':insertion_coordinates, # <<<<<<<<<<<<<< - * 'insertion_sizes':insertion_sizes, - * 'insertion_n':insertion_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":116 + * return { + * 'all_insertion_positions': all_insertion_positions, + * 'all_insertion_left_positions': all_insertion_left_positions, # <<<<<<<<<<<<<< + * 'insertion_positions': insertion_positions, + * 'insertion_coordinates': insertion_coordinates, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_coordinates, __pyx_v_insertion_coordinates) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_all_insertion_left_positions, __pyx_v_all_insertion_left_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":126 - * 'insertion_positions':insertion_positions, - * 'insertion_coordinates':insertion_coordinates, - * 'insertion_sizes':insertion_sizes, # <<<<<<<<<<<<<< - * 'insertion_n':insertion_n, - * + /* "CRISPResso2/CRISPRessoCOREResources.pyx":117 + * 'all_insertion_positions': all_insertion_positions, + * 'all_insertion_left_positions': all_insertion_left_positions, + * 'insertion_positions': insertion_positions, # <<<<<<<<<<<<<< + * 'insertion_coordinates': insertion_coordinates, + * 'insertion_sizes': insertion_sizes, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_sizes, __pyx_v_insertion_sizes) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_insertion_positions, __pyx_v_insertion_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":127 - * 'insertion_coordinates':insertion_coordinates, - * 'insertion_sizes':insertion_sizes, - * 'insertion_n':insertion_n, # <<<<<<<<<<<<<< - * - * 'all_deletion_positions':all_deletion_positions, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":118 + * 'all_insertion_left_positions': all_insertion_left_positions, + * 'insertion_positions': insertion_positions, + * 'insertion_coordinates': insertion_coordinates, # <<<<<<<<<<<<<< + * 'insertion_sizes': insertion_sizes, + * 'insertion_n': insertion_n, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_n, __pyx_v_insertion_n) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_insertion_coordinates, __pyx_v_insertion_coordinates) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":129 - * 'insertion_n':insertion_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":119 + * 'insertion_positions': insertion_positions, + * 'insertion_coordinates': insertion_coordinates, + * 'insertion_sizes': insertion_sizes, # <<<<<<<<<<<<<< + * 'insertion_n': insertion_n, * - * 'all_deletion_positions':all_deletion_positions, # <<<<<<<<<<<<<< - * 'deletion_positions':deletion_positions, - * 'deletion_coordinates':deletion_coordinates, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_deletion_positions, __pyx_v_all_deletion_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_insertion_sizes, __pyx_v_insertion_sizes) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":130 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":120 + * 'insertion_coordinates': insertion_coordinates, + * 'insertion_sizes': insertion_sizes, + * 'insertion_n': insertion_n, # <<<<<<<<<<<<<< * - * 'all_deletion_positions':all_deletion_positions, - * 'deletion_positions':deletion_positions, # <<<<<<<<<<<<<< - * 'deletion_coordinates':deletion_coordinates, - * 'deletion_sizes':deletion_sizes, + * 'all_deletion_positions': all_deletion_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_positions, __pyx_v_deletion_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_insertion_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_insertion_n, __pyx_t_1) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":131 - * 'all_deletion_positions':all_deletion_positions, - * 'deletion_positions':deletion_positions, - * 'deletion_coordinates':deletion_coordinates, # <<<<<<<<<<<<<< - * 'deletion_sizes':deletion_sizes, - * 'deletion_n':deletion_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":122 + * 'insertion_n': insertion_n, + * + * 'all_deletion_positions': all_deletion_positions, # <<<<<<<<<<<<<< + * 'deletion_positions': deletion_positions, + * 'deletion_coordinates': deletion_coordinates, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_coordinates, __pyx_v_deletion_coordinates) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_all_deletion_positions, __pyx_v_all_deletion_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":132 - * 'deletion_positions':deletion_positions, - * 'deletion_coordinates':deletion_coordinates, - * 'deletion_sizes':deletion_sizes, # <<<<<<<<<<<<<< - * 'deletion_n':deletion_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":123 * + * 'all_deletion_positions': all_deletion_positions, + * 'deletion_positions': deletion_positions, # <<<<<<<<<<<<<< + * 'deletion_coordinates': deletion_coordinates, + * 'deletion_sizes': deletion_sizes, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_sizes, __pyx_v_deletion_sizes) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_deletion_positions, __pyx_v_deletion_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":133 - * 'deletion_coordinates':deletion_coordinates, - * 'deletion_sizes':deletion_sizes, - * 'deletion_n':deletion_n, # <<<<<<<<<<<<<< - * - * 'all_substitution_positions':all_substitution_positions, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":124 + * 'all_deletion_positions': all_deletion_positions, + * 'deletion_positions': deletion_positions, + * 'deletion_coordinates': deletion_coordinates, # <<<<<<<<<<<<<< + * 'deletion_sizes': deletion_sizes, + * 'deletion_n': deletion_n, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_n, __pyx_v_deletion_n) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_deletion_coordinates, __pyx_v_deletion_coordinates) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":135 - * 'deletion_n':deletion_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":125 + * 'deletion_positions': deletion_positions, + * 'deletion_coordinates': deletion_coordinates, + * 'deletion_sizes': deletion_sizes, # <<<<<<<<<<<<<< + * 'deletion_n': deletion_n, * - * 'all_substitution_positions':all_substitution_positions, # <<<<<<<<<<<<<< - * 'substitution_positions':substitution_positions, - * 'all_substitution_values':np.array(all_substitution_values), */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_substitution_positions, __pyx_v_all_substitution_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_deletion_sizes, __pyx_v_deletion_sizes) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":136 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":126 + * 'deletion_coordinates': deletion_coordinates, + * 'deletion_sizes': deletion_sizes, + * 'deletion_n': deletion_n, # <<<<<<<<<<<<<< * - * 'all_substitution_positions':all_substitution_positions, - * 'substitution_positions':substitution_positions, # <<<<<<<<<<<<<< - * 'all_substitution_values':np.array(all_substitution_values), - * 'substitution_values':np.array(substitution_values), + * 'all_substitution_positions': all_substitution_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_positions, __pyx_v_substitution_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_deletion_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_deletion_n, __pyx_t_1) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":137 - * 'all_substitution_positions':all_substitution_positions, - * 'substitution_positions':substitution_positions, - * 'all_substitution_values':np.array(all_substitution_values), # <<<<<<<<<<<<<< - * 'substitution_values':np.array(substitution_values), - * 'substitution_n':substitution_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":128 + * 'deletion_n': deletion_n, + * + * 'all_substitution_positions': all_substitution_positions, # <<<<<<<<<<<<<< + * 'substitution_positions': substitution_positions, + * 'all_substitution_values': np.array(all_substitution_values), */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_all_substitution_values) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_all_substitution_values); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_substitution_values, __pyx_t_10) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_all_substitution_positions, __pyx_v_all_substitution_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":138 - * 'substitution_positions':substitution_positions, - * 'all_substitution_values':np.array(all_substitution_values), - * 'substitution_values':np.array(substitution_values), # <<<<<<<<<<<<<< - * 'substitution_n':substitution_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":129 * + * 'all_substitution_positions': all_substitution_positions, + * 'substitution_positions': substitution_positions, # <<<<<<<<<<<<<< + * 'all_substitution_values': np.array(all_substitution_values), + * 'substitution_values': np.array(substitution_values), */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_substitution_positions, __pyx_v_substitution_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + + /* "CRISPResso2/CRISPRessoCOREResources.pyx":130 + * 'all_substitution_positions': all_substitution_positions, + * 'substitution_positions': substitution_positions, + * 'all_substitution_values': np.array(all_substitution_values), # <<<<<<<<<<<<<< + * 'substitution_values': np.array(substitution_values), + * 'substitution_n': substitution_n, + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; @@ -3454,47 +3416,66 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su __Pyx_DECREF_SET(__pyx_t_9, function); } } - __pyx_t_10 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_v_substitution_values) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_substitution_values); + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_v_all_substitution_values) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_all_substitution_values); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_values, __pyx_t_10) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_all_substitution_values, __pyx_t_1) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":139 - * 'all_substitution_values':np.array(all_substitution_values), - * 'substitution_values':np.array(substitution_values), - * 'substitution_n':substitution_n, # <<<<<<<<<<<<<< + /* "CRISPResso2/CRISPRessoCOREResources.pyx":131 + * 'substitution_positions': substitution_positions, + * 'all_substitution_values': np.array(all_substitution_values), + * 'substitution_values': np.array(substitution_values), # <<<<<<<<<<<<<< + * 'substitution_n': substitution_n, * - * 'ref_positions':ref_positions, */ - __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_substitution_n); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_n, __pyx_t_10) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_substitution_values) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_substitution_values); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_substitution_values, __pyx_t_1) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":141 - * 'substitution_n':substitution_n, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":132 + * 'all_substitution_values': np.array(all_substitution_values), + * 'substitution_values': np.array(substitution_values), + * 'substitution_n': substitution_n, # <<<<<<<<<<<<<< * - * 'ref_positions':ref_positions, # <<<<<<<<<<<<<< - * } - * return retDict + * 'ref_positions': ref_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_ref_positions, __pyx_v_ref_positions) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __pyx_v_retDict = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_substitution_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_substitution_n, __pyx_t_1) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":143 - * 'ref_positions':ref_positions, + /* "CRISPResso2/CRISPRessoCOREResources.pyx":134 + * 'substitution_n': substitution_n, + * + * 'ref_positions': ref_positions, # <<<<<<<<<<<<<< * } - * return retDict # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_retDict); - __pyx_r = __pyx_v_retDict; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_ref_positions, __pyx_v_ref_positions) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; goto __pyx_L0; /* "CRISPResso2/CRISPRessoCOREResources.pyx":22 @@ -3502,16 +3483,15 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su * @cython.wraparound(False) * def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< * - * cdef char* sub_seq='' + * #ref_positions holds the indices for which positions map back to the original reference */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("CRISPResso2.CRISPRessoCOREResources.find_indels_substitutions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3520,8 +3500,6 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su __Pyx_XDECREF(__pyx_v_substitution_positions); __Pyx_XDECREF(__pyx_v_all_substitution_values); __Pyx_XDECREF(__pyx_v_substitution_values); - __Pyx_XDECREF(__pyx_v_nucSet); - __Pyx_XDECREF(__pyx_v_c); __Pyx_XDECREF(__pyx_v_all_deletion_positions); __Pyx_XDECREF(__pyx_v_deletion_positions); __Pyx_XDECREF(__pyx_v_deletion_coordinates); @@ -3532,19 +3510,15 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_find_indels_su __Pyx_XDECREF(__pyx_v_insertion_coordinates); __Pyx_XDECREF(__pyx_v_insertion_sizes); __Pyx_XDECREF(__pyx_v_include_indx_set); - __Pyx_XDECREF(__pyx_v_p); - __Pyx_XDECREF(__pyx_v_ref_st); - __Pyx_XDECREF(__pyx_v_ref_en); - __Pyx_XDECREF(__pyx_v_inc_del_pos); - __Pyx_XDECREF(__pyx_v_deletion_n); - __Pyx_XDECREF(__pyx_v_insertion_n); - __Pyx_XDECREF(__pyx_v_retDict); + __Pyx_XDECREF(__pyx_v_nucSet); + __Pyx_XDECREF(__pyx_v_c); + __Pyx_XDECREF(__pyx_v_end_deletion); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "CRISPResso2/CRISPRessoCOREResources.pyx":148 +/* "CRISPResso2/CRISPRessoCOREResources.pyx":141 * @cython.nonecheck(False) * @cython.wraparound(False) * def find_indels_substitutions_legacy(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< @@ -3590,17 +3564,17 @@ static PyObject *__pyx_pw_11CRISPResso2_23CRISPRessoCOREResources_3find_indels_s case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ref_seq_al)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("find_indels_substitutions_legacy", 1, 3, 3, 1); __PYX_ERR(0, 148, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("find_indels_substitutions_legacy", 1, 3, 3, 1); __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_include_indx)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("find_indels_substitutions_legacy", 1, 3, 3, 2); __PYX_ERR(0, 148, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("find_indels_substitutions_legacy", 1, 3, 3, 2); __PYX_ERR(0, 141, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_indels_substitutions_legacy") < 0)) __PYX_ERR(0, 148, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_indels_substitutions_legacy") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3615,7 +3589,7 @@ static PyObject *__pyx_pw_11CRISPResso2_23CRISPRessoCOREResources_3find_indels_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("find_indels_substitutions_legacy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 148, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("find_indels_substitutions_legacy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("CRISPResso2.CRISPRessoCOREResources.find_indels_substitutions_legacy", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3682,7 +3656,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("find_indels_substitutions_legacy", 0); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":150 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":143 * def find_indels_substitutions_legacy(read_seq_al, ref_seq_al, _include_indx): * * cdef char* sub_seq='' # <<<<<<<<<<<<<< @@ -3691,84 +3665,84 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ __pyx_v_sub_seq = ((char *)""); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":167 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":160 * # aln A - T T T G G C C * # 1 2 3 4-4 5 6 7 8 tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 168, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 168, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -3818,7 +3792,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 175, __pyx_L1_error) + else __PYX_ERR(0, 168, __pyx_L1_error) } break; } @@ -3829,130 +3803,130 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __pyx_v_idx_c = __pyx_t_2; __pyx_t_2 = (__pyx_t_2 + 1); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":176 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":169 * idx=0 * for idx_c, c in enumerate(ref_seq_al): * if c in nucSet: # <<<<<<<<<<<<<< * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': */ - __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_v_c, __pyx_v_nucSet, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_v_c, __pyx_v_nucSet, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 169, __pyx_L1_error) __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":177 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":170 * for idx_c, c in enumerate(ref_seq_al): * if c in nucSet: * ref_positions.append(idx) # <<<<<<<<<<<<<< * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': * all_substitution_positions.append(idx) */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":178 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":171 * if c in nucSet: * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': # <<<<<<<<<<<<<< * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ref_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ref_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_6) { } else { __pyx_t_7 = __pyx_t_6; goto __pyx_L7_bool_binop_done; } - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_kp_u_, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_kp_u_, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_6) { } else { __pyx_t_7 = __pyx_t_6; goto __pyx_L7_bool_binop_done; } - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_n_u_N, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_10, __pyx_n_u_N, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_7 = __pyx_t_6; __pyx_L7_bool_binop_done:; if (__pyx_t_7) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":179 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":172 * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': * all_substitution_positions.append(idx) # <<<<<<<<<<<<<< * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_substitution_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_substitution_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":180 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":173 * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) # <<<<<<<<<<<<<< * if idx in _include_indx: * substitution_positions.append(idx) */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_substitution_values, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_substitution_values, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":181 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":174 * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: # <<<<<<<<<<<<<< * substitution_positions.append(idx) * substitution_values.append(read_seq_al[idx_c]) */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_10, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_10, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_6 = (__pyx_t_7 != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":182 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":175 * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: * substitution_positions.append(idx) # <<<<<<<<<<<<<< * substitution_values.append(read_seq_al[idx_c]) * */ - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_substitution_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_substitution_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":183 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":176 * if idx in _include_indx: * substitution_positions.append(idx) * substitution_values.append(read_seq_al[idx_c]) # <<<<<<<<<<<<<< * * idx+=1 */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_read_seq_al, __pyx_v_idx_c, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_substitution_values, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_substitution_values, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":181 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":174 * all_substitution_positions.append(idx) * all_substitution_values.append(read_seq_al[idx_c]) * if idx in _include_indx: # <<<<<<<<<<<<<< @@ -3961,7 +3935,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":178 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":171 * if c in nucSet: * ref_positions.append(idx) * if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': # <<<<<<<<<<<<<< @@ -3970,7 +3944,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":185 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":178 * substitution_values.append(read_seq_al[idx_c]) * * idx+=1 # <<<<<<<<<<<<<< @@ -3979,7 +3953,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":176 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":169 * idx=0 * for idx_c, c in enumerate(ref_seq_al): * if c in nucSet: # <<<<<<<<<<<<<< @@ -3989,7 +3963,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s goto __pyx_L5; } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":188 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":181 * * else: * if idx==0: # <<<<<<<<<<<<<< @@ -4000,16 +3974,16 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __pyx_t_6 = ((__pyx_v_idx == 0) != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":189 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":182 * else: * if idx==0: * ref_positions.append(-1) # <<<<<<<<<<<<<< * else: * ref_positions.append(-idx) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_int_neg_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_int_neg_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 182, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":188 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":181 * * else: * if idx==0: # <<<<<<<<<<<<<< @@ -4019,7 +3993,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s goto __pyx_L11; } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":191 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":184 * ref_positions.append(-1) * else: * ref_positions.append(-idx) # <<<<<<<<<<<<<< @@ -4027,16 +4001,16 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s * substitution_n = len(substitution_positions) */ /*else*/ { - __pyx_t_10 = __Pyx_PyInt_From_int((-__pyx_v_idx)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From_int((-__pyx_v_idx)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ref_positions, __pyx_t_10); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __pyx_L11:; } __pyx_L5:; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":175 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":168 * nucSet = set(['A', 'T', 'C', 'G', 'N']) * idx=0 * for idx_c, c in enumerate(ref_seq_al): # <<<<<<<<<<<<<< @@ -4046,146 +4020,146 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":193 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":186 * ref_positions.append(-idx) * * substitution_n = len(substitution_positions) # <<<<<<<<<<<<<< * * #the remainder of positions are with reference to the original reference sequence indexes we calculated above */ - __pyx_t_3 = PyList_GET_SIZE(__pyx_v_substitution_positions); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_3 = PyList_GET_SIZE(__pyx_v_substitution_positions); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 186, __pyx_L1_error) __pyx_v_substitution_n = __pyx_t_3; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":196 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":189 * * #the remainder of positions are with reference to the original reference sequence indexes we calculated above * all_deletion_positions=[] # <<<<<<<<<<<<<< * deletion_positions=[] * deletion_coordinates=[] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_all_deletion_positions = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":197 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":190 * #the remainder of positions are with reference to the original reference sequence indexes we calculated above * all_deletion_positions=[] * deletion_positions=[] # <<<<<<<<<<<<<< * deletion_coordinates=[] * deletion_sizes=[] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_deletion_positions = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":198 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":191 * all_deletion_positions=[] * deletion_positions=[] * deletion_coordinates=[] # <<<<<<<<<<<<<< * deletion_sizes=[] * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_deletion_coordinates = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":199 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":192 * deletion_positions=[] * deletion_coordinates=[] * deletion_sizes=[] # <<<<<<<<<<<<<< * * all_insertion_positions=[] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_deletion_sizes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":201 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":194 * deletion_sizes=[] * * all_insertion_positions=[] # <<<<<<<<<<<<<< * all_insertion_left_positions=[] * insertion_positions=[] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_all_insertion_positions = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":202 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":195 * * all_insertion_positions=[] * all_insertion_left_positions=[] # <<<<<<<<<<<<<< * insertion_positions=[] * insertion_coordinates = [] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_all_insertion_left_positions = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":203 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":196 * all_insertion_positions=[] * all_insertion_left_positions=[] * insertion_positions=[] # <<<<<<<<<<<<<< * insertion_coordinates = [] * insertion_sizes=[] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_insertion_positions = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":204 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":197 * all_insertion_left_positions=[] * insertion_positions=[] * insertion_coordinates = [] # <<<<<<<<<<<<<< * insertion_sizes=[] * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_insertion_coordinates = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":205 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":198 * insertion_positions=[] * insertion_coordinates = [] * insertion_sizes=[] # <<<<<<<<<<<<<< * * include_indx_set = set(_include_indx) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_insertion_sizes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":207 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":200 * insertion_sizes=[] * * include_indx_set = set(_include_indx) # <<<<<<<<<<<<<< * for p in re_find_indels.finditer(read_seq_al): * st,en=p.span() */ - __pyx_t_1 = PySet_New(__pyx_v__include_indx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_1 = PySet_New(__pyx_v__include_indx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_include_indx_set = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":208 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":201 * * include_indx_set = set(_include_indx) * for p in re_find_indels.finditer(read_seq_al): # <<<<<<<<<<<<<< * st,en=p.span() * ref_st = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_re_find_indels); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_re_find_indels); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_finditer); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_finditer); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; @@ -4200,16 +4174,16 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_read_seq_al) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_read_seq_al); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -4217,17 +4191,17 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s if (likely(PyList_CheckExact(__pyx_t_9))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -4237,7 +4211,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 208, __pyx_L1_error) + else __PYX_ERR(0, 201, __pyx_L1_error) } break; } @@ -4246,14 +4220,14 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":209 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":202 * include_indx_set = set(_include_indx) * for p in re_find_indels.finditer(read_seq_al): * st,en=p.span() # <<<<<<<<<<<<<< * ref_st = 0 * if st-1 > 0: */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_span); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_span); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { @@ -4267,7 +4241,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_10); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -4276,7 +4250,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 209, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4289,15 +4263,15 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -4305,7 +4279,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_GOTREF(__pyx_t_10); index = 1; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 209, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 202, __pyx_L1_error) __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L15_unpacking_done; @@ -4313,17 +4287,17 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 209, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) __pyx_L15_unpacking_done:; } - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_st = __pyx_t_2; __pyx_v_en = __pyx_t_13; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":210 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":203 * for p in re_find_indels.finditer(read_seq_al): * st,en=p.span() * ref_st = 0 # <<<<<<<<<<<<<< @@ -4333,7 +4307,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_int_0); __Pyx_XDECREF_SET(__pyx_v_ref_st, __pyx_int_0); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":211 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":204 * st,en=p.span() * ref_st = 0 * if st-1 > 0: # <<<<<<<<<<<<<< @@ -4343,7 +4317,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __pyx_t_6 = (((__pyx_v_st - 1) > 0) != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":212 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":205 * ref_st = 0 * if st-1 > 0: * ref_st = ref_positions[st] # <<<<<<<<<<<<<< @@ -4355,7 +4329,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_DECREF_SET(__pyx_v_ref_st, __pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":211 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":204 * st,en=p.span() * ref_st = 0 * if st-1 > 0: # <<<<<<<<<<<<<< @@ -4364,30 +4338,30 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":213 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":206 * if st-1 > 0: * ref_st = ref_positions[st] * ref_en = idx-1 # <<<<<<<<<<<<<< * if en < len(ref_positions): * ref_en = ref_positions[en] */ - __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_idx - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_idx - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_ref_en, __pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":214 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":207 * ref_st = ref_positions[st] * ref_en = idx-1 * if en < len(ref_positions): # <<<<<<<<<<<<<< * ref_en = ref_positions[en] * all_deletion_positions.extend(range(ref_st,ref_en)) */ - __pyx_t_14 = PyList_GET_SIZE(__pyx_v_ref_positions); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_14 = PyList_GET_SIZE(__pyx_v_ref_positions); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 207, __pyx_L1_error) __pyx_t_6 = ((__pyx_v_en < __pyx_t_14) != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":215 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":208 * ref_en = idx-1 * if en < len(ref_positions): * ref_en = ref_positions[en] # <<<<<<<<<<<<<< @@ -4399,7 +4373,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_DECREF_SET(__pyx_v_ref_en, __pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":214 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":207 * ref_st = ref_positions[st] * ref_en = idx-1 * if en < len(ref_positions): # <<<<<<<<<<<<<< @@ -4408,14 +4382,14 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":216 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":209 * if en < len(ref_positions): * ref_en = ref_positions[en] * all_deletion_positions.extend(range(ref_st,ref_en)) # <<<<<<<<<<<<<< * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) * if(len(inc_del_pos)>0): */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_ref_st); __Pyx_GIVEREF(__pyx_v_ref_st); @@ -4423,20 +4397,20 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_v_ref_en); __Pyx_GIVEREF(__pyx_v_ref_en); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref_en); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyList_Extend(__pyx_v_all_deletion_positions, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Extend(__pyx_v_all_deletion_positions, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":217 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":210 * ref_en = ref_positions[en] * all_deletion_positions.extend(range(ref_st,ref_en)) * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) # <<<<<<<<<<<<<< * if(len(inc_del_pos)>0): * deletion_positions.extend(range(ref_st,ref_en)) */ - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_ref_st); __Pyx_GIVEREF(__pyx_v_ref_st); @@ -4444,34 +4418,34 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_v_ref_en); __Pyx_GIVEREF(__pyx_v_ref_en); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ref_en); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_intersection, __pyx_v_include_indx_set, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_intersection, __pyx_v_include_indx_set, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_inc_del_pos, __pyx_t_5); __pyx_t_5 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":218 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":211 * all_deletion_positions.extend(range(ref_st,ref_en)) * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) * if(len(inc_del_pos)>0): # <<<<<<<<<<<<<< * deletion_positions.extend(range(ref_st,ref_en)) * deletion_coordinates.append((ref_st,ref_en)) */ - __pyx_t_14 = PyObject_Length(__pyx_v_inc_del_pos); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_14 = PyObject_Length(__pyx_v_inc_del_pos); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 211, __pyx_L1_error) __pyx_t_6 = ((__pyx_t_14 > 0) != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":219 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":212 * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) * if(len(inc_del_pos)>0): * deletion_positions.extend(range(ref_st,ref_en)) # <<<<<<<<<<<<<< * deletion_coordinates.append((ref_st,ref_en)) * deletion_sizes.append(en-st) */ - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_ref_st); __Pyx_GIVEREF(__pyx_v_ref_st); @@ -4479,20 +4453,20 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_v_ref_en); __Pyx_GIVEREF(__pyx_v_ref_en); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ref_en); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyList_Extend(__pyx_v_deletion_positions, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Extend(__pyx_v_deletion_positions, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":220 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":213 * if(len(inc_del_pos)>0): * deletion_positions.extend(range(ref_st,ref_en)) * deletion_coordinates.append((ref_st,ref_en)) # <<<<<<<<<<<<<< * deletion_sizes.append(en-st) * */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_ref_st); __Pyx_GIVEREF(__pyx_v_ref_st); @@ -4500,22 +4474,22 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_v_ref_en); __Pyx_GIVEREF(__pyx_v_ref_en); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref_en); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deletion_coordinates, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deletion_coordinates, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":221 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":214 * deletion_positions.extend(range(ref_st,ref_en)) * deletion_coordinates.append((ref_st,ref_en)) * deletion_sizes.append(en-st) # <<<<<<<<<<<<<< * * deletion_n = np.sum(deletion_sizes) */ - __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_en - __pyx_v_st)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_en - __pyx_v_st)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deletion_sizes, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deletion_sizes, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":218 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":211 * all_deletion_positions.extend(range(ref_st,ref_en)) * inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) * if(len(inc_del_pos)>0): # <<<<<<<<<<<<<< @@ -4524,7 +4498,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":208 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":201 * * include_indx_set = set(_include_indx) * for p in re_find_indels.finditer(read_seq_al): # <<<<<<<<<<<<<< @@ -4534,16 +4508,16 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":223 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":216 * deletion_sizes.append(en-st) * * deletion_n = np.sum(deletion_sizes) # <<<<<<<<<<<<<< * * for p in re_find_indels.finditer(ref_seq_al): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -4558,22 +4532,22 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_9 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_deletion_sizes) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_deletion_sizes); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 223, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_deletion_n = __pyx_t_9; __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":225 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":218 * deletion_n = np.sum(deletion_sizes) * * for p in re_find_indels.finditer(ref_seq_al): # <<<<<<<<<<<<<< * st,en=p.span() * #sometimes insertions run off the end of the reference */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re_find_indels); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re_find_indels); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_finditer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_finditer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; @@ -4588,16 +4562,16 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_9 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_ref_seq_al) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_ref_seq_al); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 225, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; for (;;) { @@ -4605,17 +4579,17 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 218, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 218, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } @@ -4625,7 +4599,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 225, __pyx_L1_error) + else __PYX_ERR(0, 218, __pyx_L1_error) } break; } @@ -4634,14 +4608,14 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":226 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":219 * * for p in re_find_indels.finditer(ref_seq_al): * st,en=p.span() # <<<<<<<<<<<<<< * #sometimes insertions run off the end of the reference * if st == 0: # if insertion happened before ref */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_span); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_span); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { @@ -4655,7 +4629,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { @@ -4664,7 +4638,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 226, __pyx_L1_error) + __PYX_ERR(0, 219, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4677,15 +4651,15 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_10); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_11 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -4693,7 +4667,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L21_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 226, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L22_unpacking_done; @@ -4701,17 +4675,17 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 226, __pyx_L1_error) + __PYX_ERR(0, 219, __pyx_L1_error) __pyx_L22_unpacking_done:; } - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_st = __pyx_t_13; __pyx_v_en = __pyx_t_2; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":228 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":221 * st,en=p.span() * #sometimes insertions run off the end of the reference * if st == 0: # if insertion happened before ref # <<<<<<<<<<<<<< @@ -4721,7 +4695,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __pyx_t_6 = ((__pyx_v_st == 0) != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":229 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":222 * #sometimes insertions run off the end of the reference * if st == 0: # if insertion happened before ref * continue # <<<<<<<<<<<<<< @@ -4730,7 +4704,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ goto __pyx_L19_continue; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":228 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":221 * st,en=p.span() * #sometimes insertions run off the end of the reference * if st == 0: # if insertion happened before ref # <<<<<<<<<<<<<< @@ -4739,18 +4713,18 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":230 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":223 * if st == 0: # if insertion happened before ref * continue * if en == len(ref_seq_al): # if insertion happened after ref # <<<<<<<<<<<<<< * continue * ref_st = ref_positions[st-1] */ - __pyx_t_14 = PyObject_Length(__pyx_v_ref_seq_al); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_14 = PyObject_Length(__pyx_v_ref_seq_al); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 223, __pyx_L1_error) __pyx_t_6 = ((__pyx_v_en == __pyx_t_14) != 0); if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":231 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":224 * continue * if en == len(ref_seq_al): # if insertion happened after ref * continue # <<<<<<<<<<<<<< @@ -4759,7 +4733,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ goto __pyx_L19_continue; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":230 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":223 * if st == 0: # if insertion happened before ref * continue * if en == len(ref_seq_al): # if insertion happened after ref # <<<<<<<<<<<<<< @@ -4768,7 +4742,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":232 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":225 * if en == len(ref_seq_al): # if insertion happened after ref * continue * ref_st = ref_positions[st-1] # <<<<<<<<<<<<<< @@ -4781,7 +4755,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_XDECREF_SET(__pyx_v_ref_st, __pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":233 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":226 * continue * ref_st = ref_positions[st-1] * ref_en = ref_positions[en] # <<<<<<<<<<<<<< @@ -4793,61 +4767,61 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_XDECREF_SET(__pyx_v_ref_en, __pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":235 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":228 * ref_en = ref_positions[en] * * all_insertion_left_positions.append(ref_st) # <<<<<<<<<<<<<< * all_insertion_positions.append(ref_st) * all_insertion_positions.append(ref_en) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_left_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_left_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 228, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":236 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":229 * * all_insertion_left_positions.append(ref_st) * all_insertion_positions.append(ref_st) # <<<<<<<<<<<<<< * all_insertion_positions.append(ref_en) * if(ref_st in _include_indx or ref_en in _include_indx): */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 229, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":237 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":230 * all_insertion_left_positions.append(ref_st) * all_insertion_positions.append(ref_st) * all_insertion_positions.append(ref_en) # <<<<<<<<<<<<<< * if(ref_st in _include_indx or ref_en in _include_indx): * insertion_coordinates.append((ref_st,ref_en)) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_v_ref_en); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_all_insertion_positions, __pyx_v_ref_en); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 230, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":238 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":231 * all_insertion_positions.append(ref_st) * all_insertion_positions.append(ref_en) * if(ref_st in _include_indx or ref_en in _include_indx): # <<<<<<<<<<<<<< * insertion_coordinates.append((ref_st,ref_en)) * insertion_positions.append(ref_st) */ - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_ref_st, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_ref_st, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 231, __pyx_L1_error) __pyx_t_16 = (__pyx_t_7 != 0); if (!__pyx_t_16) { } else { __pyx_t_6 = __pyx_t_16; goto __pyx_L26_bool_binop_done; } - __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_v_ref_en, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_v_ref_en, __pyx_v__include_indx, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 231, __pyx_L1_error) __pyx_t_7 = (__pyx_t_16 != 0); __pyx_t_6 = __pyx_t_7; __pyx_L26_bool_binop_done:; if (__pyx_t_6) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":239 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":232 * all_insertion_positions.append(ref_en) * if(ref_st in _include_indx or ref_en in _include_indx): * insertion_coordinates.append((ref_st,ref_en)) # <<<<<<<<<<<<<< * insertion_positions.append(ref_st) * insertion_positions.append(ref_en) */ - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_ref_st); __Pyx_GIVEREF(__pyx_v_ref_st); @@ -4855,40 +4829,40 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __Pyx_INCREF(__pyx_v_ref_en); __Pyx_GIVEREF(__pyx_v_ref_en); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_ref_en); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_coordinates, __pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_coordinates, __pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":240 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":233 * if(ref_st in _include_indx or ref_en in _include_indx): * insertion_coordinates.append((ref_st,ref_en)) * insertion_positions.append(ref_st) # <<<<<<<<<<<<<< * insertion_positions.append(ref_en) * insertion_sizes.append(en-st) */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_v_ref_st); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":241 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":234 * insertion_coordinates.append((ref_st,ref_en)) * insertion_positions.append(ref_st) * insertion_positions.append(ref_en) # <<<<<<<<<<<<<< * insertion_sizes.append(en-st) * */ - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_v_ref_en); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_positions, __pyx_v_ref_en); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 234, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":242 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":235 * insertion_positions.append(ref_st) * insertion_positions.append(ref_en) * insertion_sizes.append(en-st) # <<<<<<<<<<<<<< * * insertion_n = np.sum(insertion_sizes) */ - __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_en - __pyx_v_st)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_en - __pyx_v_st)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_sizes, __pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_insertion_sizes, __pyx_t_9); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":238 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":231 * all_insertion_positions.append(ref_st) * all_insertion_positions.append(ref_en) * if(ref_st in _include_indx or ref_en in _include_indx): # <<<<<<<<<<<<<< @@ -4897,7 +4871,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s */ } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":225 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":218 * deletion_n = np.sum(deletion_sizes) * * for p in re_find_indels.finditer(ref_seq_al): # <<<<<<<<<<<<<< @@ -4908,16 +4882,16 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":244 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":237 * insertion_sizes.append(en-st) * * insertion_n = np.sum(insertion_sizes) # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; @@ -4932,141 +4906,141 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_insertion_sizes) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_insertion_sizes); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_insertion_n = __pyx_t_1; __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":248 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":241 * * retDict = { * 'all_insertion_positions':all_insertion_positions, # <<<<<<<<<<<<<< * 'all_insertion_left_positions':all_insertion_left_positions, * 'insertion_positions':insertion_positions, */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_insertion_positions, __pyx_v_all_insertion_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_insertion_positions, __pyx_v_all_insertion_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":249 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":242 * retDict = { * 'all_insertion_positions':all_insertion_positions, * 'all_insertion_left_positions':all_insertion_left_positions, # <<<<<<<<<<<<<< * 'insertion_positions':insertion_positions, * 'insertion_coordinates':insertion_coordinates, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_insertion_left_positions, __pyx_v_all_insertion_left_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_insertion_left_positions, __pyx_v_all_insertion_left_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":250 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":243 * 'all_insertion_positions':all_insertion_positions, * 'all_insertion_left_positions':all_insertion_left_positions, * 'insertion_positions':insertion_positions, # <<<<<<<<<<<<<< * 'insertion_coordinates':insertion_coordinates, * 'insertion_sizes':insertion_sizes, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_positions, __pyx_v_insertion_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_positions, __pyx_v_insertion_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":251 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":244 * 'all_insertion_left_positions':all_insertion_left_positions, * 'insertion_positions':insertion_positions, * 'insertion_coordinates':insertion_coordinates, # <<<<<<<<<<<<<< * 'insertion_sizes':insertion_sizes, * 'insertion_n':insertion_n, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_coordinates, __pyx_v_insertion_coordinates) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_coordinates, __pyx_v_insertion_coordinates) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":252 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":245 * 'insertion_positions':insertion_positions, * 'insertion_coordinates':insertion_coordinates, * 'insertion_sizes':insertion_sizes, # <<<<<<<<<<<<<< * 'insertion_n':insertion_n, * */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_sizes, __pyx_v_insertion_sizes) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_sizes, __pyx_v_insertion_sizes) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":253 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":246 * 'insertion_coordinates':insertion_coordinates, * 'insertion_sizes':insertion_sizes, * 'insertion_n':insertion_n, # <<<<<<<<<<<<<< * * 'all_deletion_positions':all_deletion_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_n, __pyx_v_insertion_n) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_insertion_n, __pyx_v_insertion_n) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":255 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":248 * 'insertion_n':insertion_n, * * 'all_deletion_positions':all_deletion_positions, # <<<<<<<<<<<<<< * 'deletion_positions':deletion_positions, * 'deletion_coordinates':deletion_coordinates, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_deletion_positions, __pyx_v_all_deletion_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_deletion_positions, __pyx_v_all_deletion_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":256 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":249 * * 'all_deletion_positions':all_deletion_positions, * 'deletion_positions':deletion_positions, # <<<<<<<<<<<<<< * 'deletion_coordinates':deletion_coordinates, * 'deletion_sizes':deletion_sizes, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_positions, __pyx_v_deletion_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_positions, __pyx_v_deletion_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":257 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":250 * 'all_deletion_positions':all_deletion_positions, * 'deletion_positions':deletion_positions, * 'deletion_coordinates':deletion_coordinates, # <<<<<<<<<<<<<< * 'deletion_sizes':deletion_sizes, * 'deletion_n':deletion_n, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_coordinates, __pyx_v_deletion_coordinates) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_coordinates, __pyx_v_deletion_coordinates) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":258 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":251 * 'deletion_positions':deletion_positions, * 'deletion_coordinates':deletion_coordinates, * 'deletion_sizes':deletion_sizes, # <<<<<<<<<<<<<< * 'deletion_n':deletion_n, * */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_sizes, __pyx_v_deletion_sizes) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_sizes, __pyx_v_deletion_sizes) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":259 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":252 * 'deletion_coordinates':deletion_coordinates, * 'deletion_sizes':deletion_sizes, * 'deletion_n':deletion_n, # <<<<<<<<<<<<<< * * 'all_substitution_positions':all_substitution_positions, */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_n, __pyx_v_deletion_n) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_deletion_n, __pyx_v_deletion_n) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":261 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":254 * 'deletion_n':deletion_n, * * 'all_substitution_positions':all_substitution_positions, # <<<<<<<<<<<<<< * 'substitution_positions':substitution_positions, * 'all_substitution_values':np.array(all_substitution_values), */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_substitution_positions, __pyx_v_all_substitution_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_substitution_positions, __pyx_v_all_substitution_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":262 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":255 * * 'all_substitution_positions':all_substitution_positions, * 'substitution_positions':substitution_positions, # <<<<<<<<<<<<<< * 'all_substitution_values':np.array(all_substitution_values), * 'substitution_values':np.array(substitution_values), */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_positions, __pyx_v_substitution_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_positions, __pyx_v_substitution_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":263 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":256 * 'all_substitution_positions':all_substitution_positions, * 'substitution_positions':substitution_positions, * 'all_substitution_values':np.array(all_substitution_values), # <<<<<<<<<<<<<< * 'substitution_values':np.array(substitution_values), * 'substitution_n':substitution_n, */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; @@ -5081,22 +5055,22 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_10 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_all_substitution_values) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_all_substitution_values); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_substitution_values, __pyx_t_10) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_all_substitution_values, __pyx_t_10) < 0) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":264 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":257 * 'substitution_positions':substitution_positions, * 'all_substitution_values':np.array(all_substitution_values), * 'substitution_values':np.array(substitution_values), # <<<<<<<<<<<<<< * 'substitution_n':substitution_n, * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; @@ -5111,36 +5085,36 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s } __pyx_t_10 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_v_substitution_values) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_substitution_values); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 264, __pyx_L1_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_values, __pyx_t_10) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_values, __pyx_t_10) < 0) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":265 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":258 * 'all_substitution_values':np.array(all_substitution_values), * 'substitution_values':np.array(substitution_values), * 'substitution_n':substitution_n, # <<<<<<<<<<<<<< * * 'ref_positions':ref_positions, */ - __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_substitution_n); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 265, __pyx_L1_error) + __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_substitution_n); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_n, __pyx_t_10) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_substitution_n, __pyx_t_10) < 0) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":267 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":260 * 'substitution_n':substitution_n, * * 'ref_positions':ref_positions, # <<<<<<<<<<<<<< * } * return retDict */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_ref_positions, __pyx_v_ref_positions) < 0) __PYX_ERR(0, 248, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_ref_positions, __pyx_v_ref_positions) < 0) __PYX_ERR(0, 241, __pyx_L1_error) __pyx_v_retDict = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":269 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":262 * 'ref_positions':ref_positions, * } * return retDict # <<<<<<<<<<<<<< @@ -5152,7 +5126,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s __pyx_r = __pyx_v_retDict; goto __pyx_L0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":148 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":141 * @cython.nonecheck(False) * @cython.wraparound(False) * def find_indels_substitutions_legacy(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< @@ -5199,7 +5173,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_2find_indels_s return __pyx_r; } -/* "CRISPResso2/CRISPRessoCOREResources.pyx":272 +/* "CRISPResso2/CRISPRessoCOREResources.pyx":265 * * * def calculate_homology(a, b): # <<<<<<<<<<<<<< @@ -5242,11 +5216,11 @@ static PyObject *__pyx_pw_11CRISPResso2_23CRISPRessoCOREResources_5calculate_hom case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_homology", 1, 2, 2, 1); __PYX_ERR(0, 272, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_homology", 1, 2, 2, 1); __PYX_ERR(0, 265, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_homology") < 0)) __PYX_ERR(0, 272, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_homology") < 0)) __PYX_ERR(0, 265, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5259,7 +5233,7 @@ static PyObject *__pyx_pw_11CRISPResso2_23CRISPRessoCOREResources_5calculate_hom } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calculate_homology", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 272, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_homology", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 265, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("CRISPResso2.CRISPRessoCOREResources.calculate_homology", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5291,27 +5265,27 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom int __pyx_clineno = 0; __Pyx_RefNannySetupContext("calculate_homology", 0); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":273 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":266 * * def calculate_homology(a, b): * cdef char *al = a # <<<<<<<<<<<<<< * cdef char *bl = b * cdef size_t l = strlen(al) */ - __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_a); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_a); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L1_error) __pyx_v_al = __pyx_t_1; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":274 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":267 * def calculate_homology(a, b): * cdef char *al = a * cdef char *bl = b # <<<<<<<<<<<<<< * cdef size_t l = strlen(al) * cdef float score = 0.0 */ - __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_b); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_b); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error) __pyx_v_bl = __pyx_t_1; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":275 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":268 * cdef char *al = a * cdef char *bl = b * cdef size_t l = strlen(al) # <<<<<<<<<<<<<< @@ -5320,7 +5294,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom */ __pyx_v_l = strlen(__pyx_v_al); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":276 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":269 * cdef char *bl = b * cdef size_t l = strlen(al) * cdef float score = 0.0 # <<<<<<<<<<<<<< @@ -5329,7 +5303,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom */ __pyx_v_score = 0.0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":278 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":271 * cdef float score = 0.0 * * for i in range(l): # <<<<<<<<<<<<<< @@ -5341,7 +5315,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":279 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":272 * * for i in range(l): * if al[i] == bl[i]: # <<<<<<<<<<<<<< @@ -5351,7 +5325,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom __pyx_t_5 = (((__pyx_v_al[__pyx_v_i]) == (__pyx_v_bl[__pyx_v_i])) != 0); if (__pyx_t_5) { - /* "CRISPResso2/CRISPRessoCOREResources.pyx":280 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":273 * for i in range(l): * if al[i] == bl[i]: * score+=1 # <<<<<<<<<<<<<< @@ -5359,7 +5333,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom */ __pyx_v_score = (__pyx_v_score + 1.0); - /* "CRISPResso2/CRISPRessoCOREResources.pyx":279 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":272 * * for i in range(l): * if al[i] == bl[i]: # <<<<<<<<<<<<<< @@ -5369,7 +5343,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom } } - /* "CRISPResso2/CRISPRessoCOREResources.pyx":281 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":274 * if al[i] == bl[i]: * score+=1 * return score/l # <<<<<<<<<<<<<< @@ -5377,15 +5351,15 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_l == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 281, __pyx_L1_error) + __PYX_ERR(0, 274, __pyx_L1_error) } - __pyx_t_6 = PyFloat_FromDouble((__pyx_v_score / ((float)__pyx_v_l))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_6 = PyFloat_FromDouble((__pyx_v_score / ((float)__pyx_v_l))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":272 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":265 * * * def calculate_homology(a, b): # <<<<<<<<<<<<<< @@ -5404,7 +5378,7 @@ static PyObject *__pyx_pf_11CRISPResso2_23CRISPRessoCOREResources_4calculate_hom return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":735 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":735 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -5421,7 +5395,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":736 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":736 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -5435,7 +5409,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":735 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":735 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -5454,7 +5428,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":738 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":738 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -5471,7 +5445,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":739 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":739 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -5485,7 +5459,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":738 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":738 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -5504,7 +5478,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":741 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":741 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -5521,7 +5495,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":742 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":742 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -5535,7 +5509,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":741 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":741 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -5554,7 +5528,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":744 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":744 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -5571,7 +5545,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":745 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":745 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -5585,7 +5559,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":744 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":744 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -5604,7 +5578,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":747 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":747 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -5621,7 +5595,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":748 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":748 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -5635,7 +5609,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":747 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":747 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -5654,7 +5628,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":750 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":750 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -5668,7 +5642,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":751 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":751 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -5678,7 +5652,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); if (__pyx_t_1) { - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":752 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":752 * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< @@ -5690,7 +5664,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":751 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":751 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -5699,7 +5673,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ } - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":754 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":754 * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< @@ -5713,7 +5687,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ goto __pyx_L0; } - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":750 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":750 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -5728,7 +5702,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":931 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":929 * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5740,7 +5714,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_array_base", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":932 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":930 * * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< @@ -5749,7 +5723,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":933 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":931 * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< @@ -5758,7 +5732,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":931 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":929 * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5770,7 +5744,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":935 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":933 * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5785,7 +5759,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":936 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":934 * * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< @@ -5794,7 +5768,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":937 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":935 * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< @@ -5804,7 +5778,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = ((__pyx_v_base == NULL) != 0); if (__pyx_t_1) { - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":938 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":936 * base = PyArray_BASE(arr) * if base is NULL: * return None # <<<<<<<<<<<<<< @@ -5815,7 +5789,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":937 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":935 * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< @@ -5824,7 +5798,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ } - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":939 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":937 * if base is NULL: * return None * return base # <<<<<<<<<<<<<< @@ -5836,7 +5810,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":935 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":933 * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5851,7 +5825,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":943 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":941 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -5875,7 +5849,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("import_array", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":944 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":942 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -5891,16 +5865,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":945 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":943 * cdef inline int import_array() except -1: * try: * __pyx_import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 945, __pyx_L3_error) + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error) - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":944 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":942 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -5914,7 +5888,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":946 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":944 * try: * __pyx_import_array() * except Exception: # <<<<<<<<<<<<<< @@ -5924,28 +5898,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 946, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":947 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":945 * __pyx_import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 947, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 947, __pyx_L5_except_error) + __PYX_ERR(1, 945, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":944 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":942 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -5960,7 +5934,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_L8_try_end:; } - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":943 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":941 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -5983,7 +5957,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":949 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":947 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -6007,7 +5981,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("import_umath", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":950 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":948 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -6023,16 +5997,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":951 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":949 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 951, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error) - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":950 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":948 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -6046,7 +6020,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":952 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":950 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -6056,28 +6030,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 952, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":953 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":951 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 953, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 953, __pyx_L5_except_error) + __PYX_ERR(1, 951, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":950 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":948 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -6092,7 +6066,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_L8_try_end:; } - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":949 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":947 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -6115,7 +6089,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":955 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":953 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -6139,7 +6113,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":956 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":954 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -6155,16 +6129,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":957 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":955 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error) - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":956 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":954 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -6178,7 +6152,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":958 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":956 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -6188,28 +6162,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 958, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":959 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":957 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef extern from *: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 959, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 959, __pyx_L5_except_error) + __PYX_ERR(1, 957, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":956 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":954 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -6224,7 +6198,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_L8_try_end:; } - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":955 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":953 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -6247,7 +6221,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":969 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":967 * * * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< @@ -6260,7 +6234,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":981 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":979 * bool * """ * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< @@ -6270,7 +6244,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_ __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":969 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":967 * * * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< @@ -6284,7 +6258,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_ return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":984 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":982 * * * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< @@ -6297,7 +6271,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_datetime64_object", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":996 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":994 * bool * """ * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< @@ -6307,7 +6281,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":984 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":982 * * * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< @@ -6321,7 +6295,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":999 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":997 * * * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -6332,7 +6306,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { npy_datetime __pyx_r; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1006 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1004 * also needed. That can be found using `get_datetime64_unit`. * """ * return (obj).obval # <<<<<<<<<<<<<< @@ -6342,7 +6316,7 @@ static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":999 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":997 * * * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -6355,7 +6329,7 @@ static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject * return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1009 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1007 * * * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -6366,7 +6340,7 @@ static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject * static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { npy_timedelta __pyx_r; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1013 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1011 * returns the int64 value underlying scalar numpy timedelta64 object * """ * return (obj).obval # <<<<<<<<<<<<<< @@ -6376,7 +6350,7 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1009 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1007 * * * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -6389,7 +6363,7 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject return __pyx_r; } -/* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1016 +/* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1014 * * * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< @@ -6400,7 +6374,7 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { NPY_DATETIMEUNIT __pyx_r; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1020 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1018 * returns the unit part of the dtype for a numpy datetime64 object. * """ * return (obj).obmeta.base # <<<<<<<<<<<<<< @@ -6408,7 +6382,7 @@ static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObjec __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); goto __pyx_L0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1016 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1014 * * * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< @@ -6496,6 +6470,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_calculate_homology, __pyx_k_calculate_homology, sizeof(__pyx_k_calculate_homology), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1}, + {&__pyx_n_s_current_insertion_size, __pyx_k_current_insertion_size, sizeof(__pyx_k_current_insertion_size), 0, 0, 1, 1}, {&__pyx_n_s_deletion_coordinates, __pyx_k_deletion_coordinates, sizeof(__pyx_k_deletion_coordinates), 0, 0, 1, 1}, {&__pyx_n_u_deletion_coordinates, __pyx_k_deletion_coordinates, sizeof(__pyx_k_deletion_coordinates), 0, 1, 0, 1}, {&__pyx_n_s_deletion_n, __pyx_k_deletion_n, sizeof(__pyx_k_deletion_n), 0, 0, 1, 1}, @@ -6505,6 +6480,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_deletion_sizes, __pyx_k_deletion_sizes, sizeof(__pyx_k_deletion_sizes), 0, 0, 1, 1}, {&__pyx_n_u_deletion_sizes, __pyx_k_deletion_sizes, sizeof(__pyx_k_deletion_sizes), 0, 1, 0, 1}, {&__pyx_n_s_en, __pyx_k_en, sizeof(__pyx_k_en), 0, 0, 1, 1}, + {&__pyx_n_s_end_deletion, __pyx_k_end_deletion, sizeof(__pyx_k_end_deletion), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_find_indels_substitutions, __pyx_k_find_indels_substitutions, sizeof(__pyx_k_find_indels_substitutions), 0, 0, 1, 1}, {&__pyx_n_s_find_indels_substitutions_legacy, __pyx_k_find_indels_substitutions_legacy, sizeof(__pyx_k_find_indels_substitutions_legacy), 0, 0, 1, 1}, @@ -6545,8 +6521,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ref_st, __pyx_k_ref_st, sizeof(__pyx_k_ref_st), 0, 0, 1, 1}, {&__pyx_n_s_retDict, __pyx_k_retDict, sizeof(__pyx_k_retDict), 0, 0, 1, 1}, {&__pyx_n_s_score, __pyx_k_score, sizeof(__pyx_k_score), 0, 0, 1, 1}, + {&__pyx_n_s_seq_len, __pyx_k_seq_len, sizeof(__pyx_k_seq_len), 0, 0, 1, 1}, {&__pyx_n_s_span, __pyx_k_span, sizeof(__pyx_k_span), 0, 0, 1, 1}, {&__pyx_n_s_st, __pyx_k_st, sizeof(__pyx_k_st), 0, 0, 1, 1}, + {&__pyx_n_s_start_deletion, __pyx_k_start_deletion, sizeof(__pyx_k_start_deletion), 0, 0, 1, 1}, + {&__pyx_n_s_start_insertion, __pyx_k_start_insertion, sizeof(__pyx_k_start_insertion), 0, 0, 1, 1}, {&__pyx_n_s_sub_seq, __pyx_k_sub_seq, sizeof(__pyx_k_sub_seq), 0, 0, 1, 1}, {&__pyx_n_s_substitution_n, __pyx_k_substitution_n, sizeof(__pyx_k_substitution_n), 0, 0, 1, 1}, {&__pyx_n_u_substitution_n, __pyx_k_substitution_n, sizeof(__pyx_k_substitution_n), 0, 1, 0, 1}, @@ -6559,9 +6538,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 49, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 90, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 947, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -6571,25 +6551,25 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":947 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":945 * __pyx_import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 947, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 945, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":953 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":951 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 953, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 951, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); @@ -6609,36 +6589,36 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * @cython.wraparound(False) * def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< * - * cdef char* sub_seq='' + * #ref_positions holds the indices for which positions map back to the original reference */ - __pyx_tuple__6 = PyTuple_Pack(33, __pyx_n_s_read_seq_al, __pyx_n_s_ref_seq_al, __pyx_n_s_include_indx, __pyx_n_s_sub_seq, __pyx_n_s_st, __pyx_n_s_en, __pyx_n_s_idx_c, __pyx_n_s_idx, __pyx_n_s_ref_positions, __pyx_n_s_all_substitution_positions, __pyx_n_s_substitution_positions, __pyx_n_s_all_substitution_values, __pyx_n_s_substitution_values, __pyx_n_s_nucSet, __pyx_n_s_c, __pyx_n_s_substitution_n, __pyx_n_s_all_deletion_positions, __pyx_n_s_deletion_positions, __pyx_n_s_deletion_coordinates, __pyx_n_s_deletion_sizes, __pyx_n_s_all_insertion_positions, __pyx_n_s_all_insertion_left_positions, __pyx_n_s_insertion_positions, __pyx_n_s_insertion_coordinates, __pyx_n_s_insertion_sizes, __pyx_n_s_include_indx_set, __pyx_n_s_p, __pyx_n_s_ref_st, __pyx_n_s_ref_en, __pyx_n_s_inc_del_pos, __pyx_n_s_deletion_n, __pyx_n_s_insertion_n, __pyx_n_s_retDict); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(30, __pyx_n_s_read_seq_al, __pyx_n_s_ref_seq_al, __pyx_n_s_include_indx, __pyx_n_s_ref_positions, __pyx_n_s_all_substitution_positions, __pyx_n_s_substitution_positions, __pyx_n_s_all_substitution_values, __pyx_n_s_substitution_values, __pyx_n_s_all_deletion_positions, __pyx_n_s_deletion_positions, __pyx_n_s_deletion_coordinates, __pyx_n_s_deletion_sizes, __pyx_n_s_start_deletion, __pyx_n_s_all_insertion_positions, __pyx_n_s_all_insertion_left_positions, __pyx_n_s_insertion_positions, __pyx_n_s_insertion_coordinates, __pyx_n_s_insertion_sizes, __pyx_n_s_start_insertion, __pyx_n_s_seq_len, __pyx_n_s_include_indx_set, __pyx_n_s_nucSet, __pyx_n_s_idx, __pyx_n_s_idx_c, __pyx_n_s_current_insertion_size, __pyx_n_s_c, __pyx_n_s_end_deletion, __pyx_n_s_substitution_n, __pyx_n_s_deletion_n, __pyx_n_s_insertion_n); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(3, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_CRISPResso2_CRISPRessoCOREResour, __pyx_n_s_find_indels_substitutions, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(3, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_CRISPResso2_CRISPRessoCOREResour, __pyx_n_s_find_indels_substitutions, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 22, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":148 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":141 * @cython.nonecheck(False) * @cython.wraparound(False) * def find_indels_substitutions_legacy(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< * * cdef char* sub_seq='' */ - __pyx_tuple__8 = PyTuple_Pack(33, __pyx_n_s_read_seq_al, __pyx_n_s_ref_seq_al, __pyx_n_s_include_indx, __pyx_n_s_sub_seq, __pyx_n_s_st, __pyx_n_s_en, __pyx_n_s_idx_c, __pyx_n_s_idx, __pyx_n_s_ref_positions, __pyx_n_s_all_substitution_positions, __pyx_n_s_substitution_positions, __pyx_n_s_all_substitution_values, __pyx_n_s_substitution_values, __pyx_n_s_nucSet, __pyx_n_s_c, __pyx_n_s_substitution_n, __pyx_n_s_all_deletion_positions, __pyx_n_s_deletion_positions, __pyx_n_s_deletion_coordinates, __pyx_n_s_deletion_sizes, __pyx_n_s_all_insertion_positions, __pyx_n_s_all_insertion_left_positions, __pyx_n_s_insertion_positions, __pyx_n_s_insertion_coordinates, __pyx_n_s_insertion_sizes, __pyx_n_s_include_indx_set, __pyx_n_s_p, __pyx_n_s_ref_st, __pyx_n_s_ref_en, __pyx_n_s_inc_del_pos, __pyx_n_s_deletion_n, __pyx_n_s_insertion_n, __pyx_n_s_retDict); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(33, __pyx_n_s_read_seq_al, __pyx_n_s_ref_seq_al, __pyx_n_s_include_indx, __pyx_n_s_sub_seq, __pyx_n_s_st, __pyx_n_s_en, __pyx_n_s_idx_c, __pyx_n_s_idx, __pyx_n_s_ref_positions, __pyx_n_s_all_substitution_positions, __pyx_n_s_substitution_positions, __pyx_n_s_all_substitution_values, __pyx_n_s_substitution_values, __pyx_n_s_nucSet, __pyx_n_s_c, __pyx_n_s_substitution_n, __pyx_n_s_all_deletion_positions, __pyx_n_s_deletion_positions, __pyx_n_s_deletion_coordinates, __pyx_n_s_deletion_sizes, __pyx_n_s_all_insertion_positions, __pyx_n_s_all_insertion_left_positions, __pyx_n_s_insertion_positions, __pyx_n_s_insertion_coordinates, __pyx_n_s_insertion_sizes, __pyx_n_s_include_indx_set, __pyx_n_s_p, __pyx_n_s_ref_st, __pyx_n_s_ref_en, __pyx_n_s_inc_del_pos, __pyx_n_s_deletion_n, __pyx_n_s_insertion_n, __pyx_n_s_retDict); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_CRISPResso2_CRISPRessoCOREResour, __pyx_n_s_find_indels_substitutions_legacy, 148, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_CRISPResso2_CRISPRessoCOREResour, __pyx_n_s_find_indels_substitutions_legacy, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 141, __pyx_L1_error) - /* "CRISPResso2/CRISPRessoCOREResources.pyx":272 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":265 * * * def calculate_homology(a, b): # <<<<<<<<<<<<<< * cdef char *al = a * cdef char *bl = b */ - __pyx_tuple__10 = PyTuple_Pack(7, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_al, __pyx_n_s_bl, __pyx_n_s_l, __pyx_n_s_score, __pyx_n_s_i); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(7, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_al, __pyx_n_s_bl, __pyx_n_s_l, __pyx_n_s_score, __pyx_n_s_i); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_CRISPResso2_CRISPRessoCOREResour, __pyx_n_s_calculate_homology, 272, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_CRISPResso2_CRISPRessoCOREResour, __pyx_n_s_calculate_homology, 265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6918,11 +6898,9 @@ if (!__Pyx_RefNanny) { #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; @@ -7021,35 +6999,35 @@ if (!__Pyx_RefNanny) { * @cython.wraparound(False) * def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< * - * cdef char* sub_seq='' + * #ref_positions holds the indices for which positions map back to the original reference */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11CRISPResso2_23CRISPRessoCOREResources_1find_indels_substitutions, NULL, __pyx_n_s_CRISPResso2_CRISPRessoCOREResour_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_indels_substitutions, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":148 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":141 * @cython.nonecheck(False) * @cython.wraparound(False) * def find_indels_substitutions_legacy(read_seq_al, ref_seq_al, _include_indx): # <<<<<<<<<<<<<< * * cdef char* sub_seq='' */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11CRISPResso2_23CRISPRessoCOREResources_3find_indels_substitutions_legacy, NULL, __pyx_n_s_CRISPResso2_CRISPRessoCOREResour_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11CRISPResso2_23CRISPRessoCOREResources_3find_indels_substitutions_legacy, NULL, __pyx_n_s_CRISPResso2_CRISPRessoCOREResour_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_indels_substitutions_legacy, __pyx_t_1) < 0) __PYX_ERR(0, 148, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_find_indels_substitutions_legacy, __pyx_t_1) < 0) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "CRISPResso2/CRISPRessoCOREResources.pyx":272 + /* "CRISPResso2/CRISPRessoCOREResources.pyx":265 * * * def calculate_homology(a, b): # <<<<<<<<<<<<<< * cdef char *al = a * cdef char *bl = b */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11CRISPResso2_23CRISPRessoCOREResources_5calculate_homology, NULL, __pyx_n_s_CRISPResso2_CRISPRessoCOREResour_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11CRISPResso2_23CRISPRessoCOREResources_5calculate_homology, NULL, __pyx_n_s_CRISPResso2_CRISPRessoCOREResour_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculate_homology, __pyx_t_1) < 0) __PYX_ERR(0, 272, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculate_homology, __pyx_t_1) < 0) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "CRISPResso2/CRISPRessoCOREResources.pyx":1 @@ -7062,7 +7040,7 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "../../../../home/kenclem1/anaconda3/envs/crispresso3/lib/python3.8/site-packages/numpy/__init__.pxd":1016 + /* "../../../mambaforge/envs/crispresso/lib/python3.9/site-packages/numpy/__init__.pxd":1014 * * * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< @@ -7194,234 +7172,93 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* pyfrozenset_new */ -static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { - if (it) { - PyObject* result; -#if CYTHON_COMPILING_IN_PYPY - PyObject* args; - args = PyTuple_Pack(1, it); - if (unlikely(!args)) - return NULL; - result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); - Py_DECREF(args); - return result; -#else - if (PyFrozenSet_CheckExact(it)) { - Py_INCREF(it); - return it; - } - result = PyFrozenSet_New(it); - if (unlikely(!result)) - return NULL; - if (likely(PySet_GET_SIZE(result))) - return result; - Py_DECREF(result); -#endif - } -#if CYTHON_USE_TYPE_SLOTS - return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL); -#else - return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL); -#endif -} - -/* PySetContains */ -static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) { - int result = -1; - if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) { - PyObject *tmpkey; - PyErr_Clear(); - tmpkey = __Pyx_PyFrozenSet_New(key); - if (tmpkey != NULL) { - result = PySet_Contains(set, tmpkey); - Py_DECREF(tmpkey); - } - } - return result; -} -static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) { - int result = PySet_Contains(set, key); - if (unlikely(result < 0)) { - result = __Pyx_PySet_ContainsUnhashable(set, key); - } - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; } + name++; } - return m->sq_item(o, i); + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; } /* BytesEquals */ @@ -7569,69 +7406,241 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif - return (equals == Py_NE); + return (equals == Py_NE); +#endif +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* pyfrozenset_new */ +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { + if (it) { + PyObject* result; +#if CYTHON_COMPILING_IN_PYPY + PyObject* args; + args = PyTuple_Pack(1, it); + if (unlikely(!args)) + return NULL; + result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); + Py_DECREF(args); + return result; +#else + if (PyFrozenSet_CheckExact(it)) { + Py_INCREF(it); + return it; + } + result = PyFrozenSet_New(it); + if (unlikely(!result)) + return NULL; + if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result))) + return result; + Py_DECREF(result); +#endif + } +#if CYTHON_USE_TYPE_SLOTS + return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL); +#else + return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL); +#endif +} + +/* PySetContains */ +static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) { + int result = -1; + if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) { + PyObject *tmpkey; + PyErr_Clear(); + tmpkey = __Pyx_PyFrozenSet_New(key); + if (tmpkey != NULL) { + result = PySet_Contains(set, tmpkey); + Py_DECREF(tmpkey); + } + } + return result; +} +static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) { + int result = PySet_Contains(set, key); + if (unlikely(result < 0)) { + result = __Pyx_PySet_ContainsUnhashable(set, key); + } + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* UnpackUnboundCMethod */ +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } #endif + return 0; } -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { +/* CallUnboundCMethod1 */ #if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + if (likely(cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return (*(cfunc->func))(self, arg); + } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { + if (PY_VERSION_HEX >= 0x030700A0) { + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); + } else { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + return __Pyx__CallUnboundCMethod1(cfunc, self, arg); } #endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); } -#endif #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); + args = PyTuple_Pack(2, self, arg); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); #endif - return __Pyx_GetBuiltinName(name); +bad: + Py_XDECREF(args); + return result; } /* PyCFunctionFastCall */ @@ -7776,55 +7785,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #endif #endif -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { @@ -7862,28 +7822,118 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, &arg, 1); } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (__Pyx_PyFastCFunction_Check(func)) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); + Py_DECREF(function); +done: return result; } -#endif /* PyObjectCallNoArg */ #if CYTHON_COMPILING_IN_CPYTHON @@ -7967,78 +8017,6 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { return 0; } -/* UnpackUnboundCMethod */ -static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { - PyObject *method; - method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); - if (unlikely(!method)) - return -1; - target->method = method; -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION >= 3 - if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) - #endif - { - PyMethodDescrObject *descr = (PyMethodDescrObject*) method; - target->func = descr->d_method->ml_meth; - target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); - } -#endif - return 0; -} - -/* CallUnboundCMethod1 */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { - if (likely(cfunc->func)) { - int flag = cfunc->flag; - if (flag == METH_O) { - return (*(cfunc->func))(self, arg); - } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { - if (PY_VERSION_HEX >= 0x030700A0) { - return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); - } else { - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } - return __Pyx__CallUnboundCMethod1(cfunc, self, arg); -} -#endif -static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ - PyObject *args, *result = NULL; - if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; -#if CYTHON_COMPILING_IN_CPYTHON - if (cfunc->func && (cfunc->flag & METH_VARARGS)) { - args = PyTuple_New(1); - if (unlikely(!args)) goto bad; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - if (cfunc->flag & METH_KEYWORDS) - result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); - else - result = (*cfunc->func)(self, args); - } else { - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); - } -#else - args = PyTuple_Pack(2, self, arg); - if (unlikely(!args)) goto bad; - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); -#endif -bad: - Py_XDECREF(args); - return result; -} - /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * @@ -8535,7 +8513,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -8632,30 +8610,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -8674,11 +8653,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -8732,68 +8716,6 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return (target_type) value;\ } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -9104,7 +9026,14 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -9291,9 +9220,54 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { return (int) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { - const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -9480,9 +9454,54 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { return (size_t) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -10033,6 +10052,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/CRISPResso2/CRISPRessoCOREResources.pyx b/CRISPResso2/CRISPRessoCOREResources.pyx index 9610bcf5..3eb98383 100644 --- a/CRISPResso2/CRISPRessoCOREResources.pyx +++ b/CRISPResso2/CRISPRessoCOREResources.pyx @@ -21,14 +21,6 @@ re_find_indels = re.compile("(-*-)") @cython.wraparound(False) def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): - cdef char* sub_seq='' - - cdef int st - cdef int en - - cdef int idx_c - cdef int idx - #ref_positions holds the indices for which positions map back to the original reference # for example, # 1 2 3 4 5 6 7 8 @@ -44,10 +36,27 @@ def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): all_substitution_values=[] substitution_values=[] + all_deletion_positions = [] + deletion_positions = [] + deletion_coordinates = [] + deletion_sizes = [] + cdef int start_deletion = -1 # the -1 value indicates that there currently isn't a deletion + + all_insertion_positions = [] + all_insertion_left_positions = [] + insertion_positions = [] + insertion_coordinates = [] + insertion_sizes = [] + cdef int start_insertion = -1 # the -1 value indicates that there currently isn't an insertion + + cdef size_t seq_len = len(ref_seq_al) + include_indx_set = set(_include_indx) nucSet = set(['A', 'T', 'C', 'G', 'N']) - idx=0 + cdef int idx = 0 + cdef int idx_c + cdef int current_insertion_size = 0 for idx_c, c in enumerate(ref_seq_al): - if c in nucSet: + if c != '-': ref_positions.append(idx) if ref_seq_al[idx_c]!=read_seq_al[idx_c] and read_seq_al[idx_c] != '-' and read_seq_al[idx_c] != 'N': all_substitution_positions.append(idx) @@ -55,92 +64,76 @@ def find_indels_substitutions(read_seq_al, ref_seq_al, _include_indx): if idx in _include_indx: substitution_positions.append(idx) substitution_values.append(read_seq_al[idx_c]) - - idx+=1 - - else: - if idx==0: + if start_insertion != -1: # this is the end of an insertion + all_insertion_left_positions.append(start_insertion) + all_insertion_positions.append(start_insertion) + all_insertion_positions.append(idx) + if start_insertion in include_indx_set and idx in include_indx_set: + insertion_coordinates.append((start_insertion, idx)) + insertion_positions.append(start_insertion) + insertion_positions.append(idx) + insertion_sizes.append(current_insertion_size) + start_insertion = -1 + current_insertion_size = 0 + idx += 1 + else: # the current ref position is - + if idx == 0: ref_positions.append(-1) else: ref_positions.append(-idx) + if idx > 0 and start_insertion == -1: # this is the first index of an insertion + start_insertion = idx - 1 + current_insertion_size += 1 - substitution_n = len(substitution_positions) - - #the remainder of positions are with reference to the original reference sequence indexes we calculated above - all_deletion_positions=[] - deletion_positions=[] - deletion_coordinates=[] - deletion_sizes=[] - - all_insertion_positions=[] - all_insertion_left_positions=[] - insertion_positions=[] - insertion_coordinates = [] - insertion_sizes=[] - - include_indx_set = set(_include_indx) - for p in re_find_indels.finditer(read_seq_al): - st,en=p.span() - ref_st = 0 - if st-1 > 0: - ref_st = ref_positions[st] - ref_en = idx-1 - if en < len(ref_positions): - ref_en = ref_positions[en] - all_deletion_positions.extend(range(ref_st,ref_en)) - inc_del_pos = include_indx_set.intersection(range(ref_st,ref_en)) - if(len(inc_del_pos)>0): - deletion_positions.extend(range(ref_st,ref_en)) - deletion_coordinates.append((ref_st,ref_en)) - deletion_sizes.append(en-st) - - deletion_n = np.sum(deletion_sizes) - - for p in re_find_indels.finditer(ref_seq_al): - st,en=p.span() - #sometimes insertions run off the end of the reference - if st == 0: # if insertion happened before ref - continue - if en == len(ref_seq_al): # if insertion happened after ref - continue - ref_st = ref_positions[st-1] - ref_en = ref_positions[en] - - all_insertion_left_positions.append(ref_st) - all_insertion_positions.append(ref_st) - all_insertion_positions.append(ref_en) - if(ref_st in _include_indx and ref_en in _include_indx): - insertion_coordinates.append((ref_st,ref_en)) - insertion_positions.append(ref_st) - insertion_positions.append(ref_en) - insertion_sizes.append(en-st) - - insertion_n = np.sum(insertion_sizes) - - - retDict = { - 'all_insertion_positions':all_insertion_positions, - 'all_insertion_left_positions':all_insertion_left_positions, - 'insertion_positions':insertion_positions, - 'insertion_coordinates':insertion_coordinates, - 'insertion_sizes':insertion_sizes, - 'insertion_n':insertion_n, - - 'all_deletion_positions':all_deletion_positions, - 'deletion_positions':deletion_positions, - 'deletion_coordinates':deletion_coordinates, - 'deletion_sizes':deletion_sizes, - 'deletion_n':deletion_n, - - 'all_substitution_positions':all_substitution_positions, - 'substitution_positions':substitution_positions, - 'all_substitution_values':np.array(all_substitution_values), - 'substitution_values':np.array(substitution_values), - 'substitution_n':substitution_n, - - 'ref_positions':ref_positions, + if read_seq_al[idx_c] == '-' and start_deletion == -1: # this is the first part of a deletion + if idx_c - 1 > 0: + start_deletion = ref_positions[idx_c] + else: + start_deletion = 0 + elif read_seq_al[idx_c] != '-' and start_deletion != -1: # this is the end of a deletion + end_deletion = ref_positions[idx_c] + all_deletion_positions.extend(range(start_deletion, end_deletion)) + if include_indx_set.intersection(range(start_deletion, end_deletion)): + deletion_positions.extend(range(start_deletion, end_deletion)) + deletion_coordinates.append((start_deletion, end_deletion)) + deletion_sizes.append(end_deletion - start_deletion) + start_deletion = -1 + + if start_deletion != -1: + end_deletion = ref_positions[seq_len - 1] + all_deletion_positions.extend(range(start_deletion, end_deletion)) + if include_indx_set.intersection(range(start_deletion, end_deletion)): + deletion_positions.extend(range(start_deletion, end_deletion)) + deletion_coordinates.append((start_deletion, end_deletion)) + deletion_sizes.append(end_deletion - start_deletion) + + cdef size_t substitution_n = len(substitution_positions) + cdef size_t deletion_n = sum(deletion_sizes) + cdef size_t insertion_n = sum(insertion_sizes) + + return { + 'all_insertion_positions': all_insertion_positions, + 'all_insertion_left_positions': all_insertion_left_positions, + 'insertion_positions': insertion_positions, + 'insertion_coordinates': insertion_coordinates, + 'insertion_sizes': insertion_sizes, + 'insertion_n': insertion_n, + + 'all_deletion_positions': all_deletion_positions, + 'deletion_positions': deletion_positions, + 'deletion_coordinates': deletion_coordinates, + 'deletion_sizes': deletion_sizes, + 'deletion_n': deletion_n, + + 'all_substitution_positions': all_substitution_positions, + 'substitution_positions': substitution_positions, + 'all_substitution_values': np.array(all_substitution_values), + 'substitution_values': np.array(substitution_values), + 'substitution_n': substitution_n, + + 'ref_positions': ref_positions, } - return retDict + @cython.boundscheck(False) @cython.nonecheck(False) diff --git a/CRISPResso2/CRISPRessoCompareCORE.py b/CRISPResso2/CRISPRessoCompareCORE.py index 144fd778..f81e95c0 100644 --- a/CRISPResso2/CRISPRessoCompareCORE.py +++ b/CRISPResso2/CRISPRessoCompareCORE.py @@ -108,16 +108,15 @@ def main(): sample_1_name = args.sample_1_name if args.sample_1_name is None: sample_1_name = "Sample 1" - if 'name' in run_info_1 and run_info_1['running_info']['name'] != '': + if 'running_info' in run_info_1 and 'name' in run_info_1['running_info'] and run_info_1['running_info']['name']: sample_1_name = run_info_1['running_info']['name'] sample_2_name = args.sample_2_name if args.sample_2_name is None: sample_2_name = "Sample 2" - if 'name' in run_info_2 and run_info_2['running_info']['name'] != '': + if 'running_info' in run_info_2 and 'name' in run_info_2['running_info'] and run_info_2['running_info']['name']: sample_2_name = run_info_2['running_info']['name'] - get_name_from_folder=lambda x: os.path.basename(os.path.abspath(x)).replace('CRISPResso_on_', '') if not args.name: diff --git a/tests/unit_tests/test_CRISPRessoCOREResources.py b/tests/unit_tests/test_CRISPRessoCOREResources.py new file mode 100644 index 00000000..17b6f801 --- /dev/null +++ b/tests/unit_tests/test_CRISPRessoCOREResources.py @@ -0,0 +1,159 @@ +from CRISPResso2 import CRISPRessoCOREResources + +def test_find_indels_substitutions(): + # no insertion or deletion + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + [18, 19], + ) + assert payload['insertion_n'] == 0 + assert payload['deletion_n'] == 0 + assert payload['substitution_n'] == 0 + + # deletion outside of quantification window + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + [21, 22], + ) + assert payload['insertion_n'] == 0 + assert payload['substitution_n'] == 0 + assert payload['deletion_n'] == 0 + + # deletion overlap quantification window + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + [18, 19], + ) + assert payload['insertion_n'] == 0 + assert payload['substitution_n'] == 0 + assert payload['deletion_n'] == 3 + assert payload['all_deletion_positions'] == [18, 19, 20] + assert payload['deletion_positions'] == [18, 19, 20] + assert payload['deletion_coordinates'] == [(18, 21)] + + # insertion outside of quantification window + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + 'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', + [21, 22], + ) + assert payload['insertion_n'] == 0 + assert payload['substitution_n'] == 0 + assert payload['deletion_n'] == 0 + + # insertion overlap quantification window + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + 'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', + [18, 19], + ) + assert payload['insertion_n'] == 0 + assert payload['all_insertion_positions'] == [17, 18] + assert payload['all_insertion_left_positions'] == [17] + assert payload['deletion_n'] == 0 + assert payload['substitution_n'] == 0 + + # deletion at ends + payload = CRISPRessoCOREResources.find_indels_substitutions( + '---GGAATCCCTTCTGCAGCACCTGGATCGCTTTTC----', + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + [18, 19], + ) + assert payload['insertion_n'] == 0 + assert payload['deletion_n'] == 0 + assert payload['substitution_n'] == 0 + + # insertion at ends + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', + '----GAATCCCTTCTGCAGCACCTGGATCGCTTTTC----', + [18, 19], + ) + assert payload['insertion_n'] == 0 + assert payload['deletion_n'] == 0 + assert payload['substitution_n'] == 0 + + # insertion at the edge of include_indx_set + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'TAATCGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAAGAGGGCGGCTTTGGGCGGGGTC-CAGTTCCGGGATTA--GCGAACTTAGAGCAC-----ACGTCTGAACTCCAGTCACCGATGTATATCTCGTATGCCGTCTTCTGCTTGAAAAAAAAAAACTTACTCTCACTTAACTCTTGCTTCCCTCCTGACGCCGATG', + '----CGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAGC------------ACCTGGATCGCTTTTCCGAGCTTCTGGCGGTCTCA-AGCACTACCTACGTCAGCACCTGGGACCCCGCCAC------CGTGCGCCGGGC----CTTGCAGTGGGCGCGCTACCTGCGCCACATCCATCGG--CGCTTTGGTCGG-----', + [91, 92], + ) + correct_payload = { + 'all_insertion_positions': [91, 92, 126, 127, 161, 162, 173, 174, 210, 211], + 'all_insertion_left_positions': [91, 126, 161, 173, 210], + 'insertion_positions': [91, 92], + 'insertion_coordinates': [(91, 92)], + 'insertion_sizes': [12], + 'insertion_n': 12, + 'all_deletion_positions': [101, 116, 117, 132, 133, 134, 135, 136], + 'deletion_positions': [], + 'deletion_coordinates': [], + 'deletion_sizes': [], + 'deletion_n': 0.0, + 'all_substitution_positions': [90, 91, 92, 93, 95, 98, 103, 104, 110, 112, 115, 121, 122, 125, 142, 144, 147, 148, 149, 150, 152, 154, 158, 159, 160, 161, 165, 166, 171, 172, 173, 178, 180, 181, 182, 183, 184, 185, 186, 187, 188, 191, 192, 195, 196, 197, 198, 200, 201, 203, 205, 206, 208, 210, 212, 215, 216, 217, 219, 222], + 'substitution_positions': [91, 92], + 'substitution_n': 2, + 'ref_positions': [-1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, -162, -162, -162, -162, -162, -162, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, -174, -174, -174, -174, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, -211, -211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, -223, -223, -223, -223, -223], + } + assert payload['all_insertion_positions'] == correct_payload['all_insertion_positions'] + assert payload['all_insertion_left_positions'] == correct_payload['all_insertion_left_positions'] + assert payload['insertion_positions'] == correct_payload['insertion_positions'] + assert payload['insertion_coordinates'] == correct_payload['insertion_coordinates'] + assert payload['insertion_sizes'] == correct_payload['insertion_sizes'] + assert payload['insertion_n'] == correct_payload['insertion_n'] + assert payload['all_deletion_positions'] == correct_payload['all_deletion_positions'] + assert payload['deletion_positions'] == correct_payload['deletion_positions'] + assert payload['deletion_sizes'] == correct_payload['deletion_sizes'] + assert payload['deletion_n'] == correct_payload['deletion_n'] + assert payload['all_substitution_positions'] == correct_payload['all_substitution_positions'] + assert payload['substitution_positions'] == correct_payload['substitution_positions'] + assert payload['substitution_n'] == correct_payload['substitution_n'] + assert payload['ref_positions'] == correct_payload['ref_positions'] + + # deletion at the end of the sequence, that is outside of the include_indx_set + payload = CRISPRessoCOREResources.find_indels_substitutions( + 'TGCTCGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAGCGCTAGATTTCCCAAGAAGAAAAATGCAAAGAAATTTAAGACTAAGCATTCAGCCACCTGGATCGCTTTTCCGAGCTTCTGGCGGTCTCAAGCACTACCTACGTCAGCACCTGGGACCCCGCCACCGTGCGCCGGGCCTTGCAGGGGCCGCGCT--------------------------------', + '----CGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAGC------------------------------------------------------ACCTGGATCGCTTTTCCGAGCTTCTGGCGGTCTCAAGCACTACCTACGTCAGCACCTGGGACCCCGCCACCGTGCGCCGGGCCTTGCAGTGGGCGCGCTACCTGCGCCACATCCATCGGCGCTTTGGTCGG', + [91, 92], + ) + + correct_payload = { + 'all_insertion_positions': [91, 92], + 'all_insertion_left_positions': [91], + 'insertion_positions': [91, 92], + 'insertion_coordinates': [(91, 92)], + 'insertion_sizes': [54], + 'insertion_n': 54, + 'all_deletion_positions': [191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221], + 'deletion_positions': [], + 'deletion_coordinates': [], + 'deletion_sizes': [], + 'deletion_n': 0.0, + 'all_substitution_positions': [181, 184], + 'substitution_positions': [], + 'substitution_n': 0, + 'ref_positions': [-1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222], + } + assert payload['all_insertion_positions'] == correct_payload['all_insertion_positions'] + assert payload['all_insertion_left_positions'] == correct_payload['all_insertion_left_positions'] + assert payload['insertion_positions'] == correct_payload['insertion_positions'] + assert payload['insertion_coordinates'] == correct_payload['insertion_coordinates'] + assert payload['insertion_sizes'] == correct_payload['insertion_sizes'] + assert payload['insertion_n'] == correct_payload['insertion_n'] + assert payload['all_deletion_positions'] == correct_payload['all_deletion_positions'] + assert payload['deletion_positions'] == correct_payload['deletion_positions'] + assert payload['deletion_sizes'] == correct_payload['deletion_sizes'] + assert payload['deletion_n'] == correct_payload['deletion_n'] + assert payload['all_substitution_positions'] == correct_payload['all_substitution_positions'] + assert payload['substitution_positions'] == correct_payload['substitution_positions'] + assert payload['substitution_n'] == correct_payload['substitution_n'] + assert payload['ref_positions'] == correct_payload['ref_positions'] + + +if __name__ == "__main__": + # execute only if run as a script + test_find_indels_substitutions() From a7cde12d74eaa2b6c0a2107d8e373dcbb62e3308 Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Sat, 22 Jan 2022 21:50:03 -0500 Subject: [PATCH 02/61] Add parameter `--suppress_batch_summary_plots` If many runs are run at the same time, batch summary plots may fail because they are too large for matplotlib. This parameter `--suppress_batch_summary_plots` allows individual runs to be plotted, but suppresses batch summary plots that may otherwise be too big. --- CRISPResso2/CRISPRessoBatchCORE.py | 85 ++++++++++++++++-------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/CRISPResso2/CRISPRessoBatchCORE.py b/CRISPResso2/CRISPRessoBatchCORE.py index 5e625bcf..f2a1c4cc 100644 --- a/CRISPResso2/CRISPRessoBatchCORE.py +++ b/CRISPResso2/CRISPRessoBatchCORE.py @@ -98,6 +98,7 @@ def main(): parser.add_argument('--skip_failed', help='Continue with batch analysis even if one sample fails', action='store_true') parser.add_argument('--min_reads_for_inclusion', help='Minimum number of reads for a batch to be included in the batch summary', type=int, default=0) parser.add_argument('-bo', '--batch_output_folder', help='Directory where batch analysis output will be stored') + parser.add_argument('--suppress_batch_summary_plots', help='Suppress batch summary plots - e.g. if many samples are run at once, the summary plots of all sub-runs may be too large. This parameter suppresses the production of these plots.') parser.add_argument('--crispresso_command', help='CRISPResso command to call', default='CRISPResso') args = parser.parse_args() @@ -511,37 +512,52 @@ def main(): sgRNA_plot_idxs = consensus_sgRNA_plot_idxs[idx] plot_idxs_flat = [0, 1] # guide, nucleotide plot_idxs_flat.extend([plot_idx + 2 for plot_idx in sgRNA_plot_idxs]) + sub_nucleotide_frequency_summary_df = nucleotide_frequency_summary_df.iloc[:, plot_idxs_flat] + sub_nucleotide_frequency_summary_df = pd.concat([sub_nucleotide_frequency_summary_df.iloc[:, 0:2], + sub_nucleotide_frequency_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) + sub_nucleotide_frequency_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_frequency_summary_around_sgRNA_'+sgRNA+'.txt') + sub_nucleotide_frequency_summary_df.to_csv(sub_nucleotide_frequency_summary_filename, sep='\t', index=None) + sub_nucleotide_percentage_summary_df = nucleotide_percentage_summary_df.iloc[:, plot_idxs_flat] + sub_nucleotide_percentage_summary_df = pd.concat([sub_nucleotide_percentage_summary_df.iloc[:, 0:2], + sub_nucleotide_percentage_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) + sub_nucleotide_percentage_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_percentage_summary_around_sgRNA_'+sgRNA+'.txt') + sub_nucleotide_percentage_summary_df.to_csv(sub_nucleotide_percentage_summary_filename, sep='\t', index=None) + sub_modification_percentage_summary_df = modification_percentage_summary_df.iloc[:, plot_idxs_flat] + sub_modification_percentage_summary_df = pd.concat([sub_modification_percentage_summary_df.iloc[:, 0:2], + sub_modification_percentage_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) + sub_modification_percentage_summary_filename = _jp(amplicon_plot_name + 'Modification_percentage_summary_around_sgRNA_'+sgRNA+'.txt') + sub_modification_percentage_summary_df.to_csv(sub_modification_percentage_summary_filename, sep='\t', index=None) + + if not args.suppress_plots and not args.suppress_batch_summary_plots: + # plot for each guide + # show all sgRNA's on the plot + sub_sgRNA_intervals = [] + for sgRNA_interval in consensus_sgRNA_intervals: + newstart = None + newend = None + for idx, i in enumerate(sgRNA_plot_idxs): + if i <= sgRNA_interval[0]: + newstart = idx + if newend is None and i >= sgRNA_interval[1]: + newend = idx + + # if guide doesn't overlap with plot idxs + if newend == 0 or newstart == len(sgRNA_plot_idxs): + continue + # otherwise, correct partial overlaps + elif newstart is None and newend is None: + newstart = 0 + newend = len(include_idxs) - 1 + elif newstart is None: + newstart = 0 + elif newend is None: + newend = len(include_idxs) - 1 + # and add it to the list + sub_sgRNA_intervals.append((newstart, newend)) - #show all sgRNA's on the plot - sub_sgRNA_intervals = [] - for sgRNA_interval in consensus_sgRNA_intervals: - newstart = None - newend = None - for idx, i in enumerate(sgRNA_plot_idxs): - if i <= sgRNA_interval[0]: - newstart = idx - if newend is None and i >= sgRNA_interval[1]: - newend = idx - - #if guide doesn't overlap with plot idxs - if newend == 0 or newstart == len(sgRNA_plot_idxs): - continue - #otherwise, correct partial overlaps - elif newstart == None and newend == None: - newstart = 0 - newend = len(include_idxs) -1 - elif newstart == None: - newstart = 0 - elif newend == None: - newend = len(include_idxs) -1 - #and add it to the list - sub_sgRNA_intervals.append((newstart, newend)) - - if not args.suppress_plots: - #plot for each guide this_window_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt_around_sgRNA_'+sgRNA) CRISPRessoPlot.plot_nucleotide_quilt(sub_nucleotide_percentage_summary_df, sub_modification_percentage_summary_df, this_window_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=sub_sgRNA_intervals, quantification_window_idxs=include_idxs) plot_name = os.path.basename(this_window_nuc_pct_quilt_plot_name) @@ -552,16 +568,6 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base around the guide ' + sgRNA + ' for the amplicon ' + amplicon_name crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))] - sub_nucleotide_frequency_summary_df = pd.concat([sub_nucleotide_frequency_summary_df.iloc[:, 0:2], - sub_nucleotide_frequency_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) - sub_nucleotide_frequency_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_frequency_summary_around_sgRNA_'+sgRNA+'.txt') - sub_nucleotide_frequency_summary_df.to_csv(sub_nucleotide_frequency_summary_filename, sep='\t', index=None) - - sub_nucleotide_percentage_summary_df = pd.concat([sub_nucleotide_percentage_summary_df.iloc[:, 0:2], - sub_nucleotide_percentage_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) - sub_nucleotide_percentage_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_percentage_summary_around_sgRNA_'+sgRNA+'.txt') - sub_nucleotide_percentage_summary_df.to_csv(sub_nucleotide_percentage_summary_filename, sep='\t', index=None) - if args.base_editor_output: this_window_nuc_conv_plot_name = _jp(amplicon_plot_name + 'Nucleotide_conversion_map_around_sgRNA_'+sgRNA) CRISPRessoPlot.plot_conversion_map(sub_nucleotide_percentage_summary_df, this_window_nuc_conv_plot_name, args.conversion_nuc_from, args.conversion_nuc_to, save_png, sgRNA_intervals=sub_sgRNA_intervals, quantification_window_idxs=include_idxs) @@ -574,8 +580,9 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies around sgRNA', os.path.basename(sub_nucleotide_frequency_summary_filename)), ('Nucleotide percentages around sgRNA', os.path.basename(sub_nucleotide_percentage_summary_filename)) ] + # done with per-amplicon plots - if not args.suppress_plots: # plot the whole region + if not args.suppress_plots and not args.suppress_batch_summary_plots: # plot the whole region this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df, modification_percentage_summary_df, this_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=consensus_sgRNA_intervals, quantification_window_idxs=include_idxs) plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) @@ -598,7 +605,7 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))] else: #guides are not the same - if not args.suppress_plots: + if not args.suppress_plots and not args.suppress_batch_summary_plots: this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df, modification_percentage_summary_df, this_nuc_pct_quilt_plot_name, save_png) plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) From c150468642f6142cc3637c6bc1c4a14b17f5cbf4 Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Sat, 22 Jan 2022 21:56:55 -0500 Subject: [PATCH 03/61] Pep formatting cleanup --- CRISPResso2/CRISPRessoBatchCORE.py | 113 ++++++++++++++--------------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/CRISPResso2/CRISPRessoBatchCORE.py b/CRISPResso2/CRISPRessoBatchCORE.py index f2a1c4cc..911a9d9b 100644 --- a/CRISPResso2/CRISPRessoBatchCORE.py +++ b/CRISPResso2/CRISPRessoBatchCORE.py @@ -40,41 +40,41 @@ def propagate_options(cmd, options, params, paramInd): # params - df from excel parser e.g. params['amplicon_name'] = ['name1','name2','name3'] where each item corresponds to a different run in the batch # paramInd - index in dict - this is the run number in the batch - for option in options : + for option in options: if option: if option in params: val = params.loc[paramInd, option] if val is None: pass elif str(val) == "True": - cmd+=' --%s' % option - elif str(val) =="False": + cmd += ' --%s' % option + elif str(val) == "False": pass elif isinstance(val, str): if val != "": if " " in val or "-" in val: - cmd+=' --%s "%s"' % (option, str(val)) # quotes for options with spaces + cmd += ' --%s "%s"' % (option, str(val)) # quotes for options with spaces else: - cmd+=' --%s %s' % (option, str(val)) + cmd += ' --%s %s' % (option, str(val)) elif isinstance(val, bool): if val: - cmd+=' --%s' % option + cmd += ' --%s' % option else: - cmd+=' --%s %s' % (option, str(val)) + cmd += ' --%s %s' % (option, str(val)) # print("cmd is " + str(cmd)) return cmd def check_library(library_name): - try: - return __import__(library_name) - except: - error('You need to install %s module to use CRISPRessoBatch!' % library_name) - sys.exit(1) + try: + return __import__(library_name) + except: + error('You need to install %s module to use CRISPRessoBatch!' % library_name) + sys.exit(1) +pd = check_library('pandas') +np = check_library('numpy') -pd=check_library('pandas') -np=check_library('numpy') def main(): try: @@ -111,7 +111,6 @@ def main(): CRISPRessoShared.check_file(args.batch_settings) - batch_folder_name = os.path.splitext(os.path.basename(args.batch_settings))[0] if args.name and args.name != "": clean_name = CRISPRessoShared.slugify(args.name) @@ -123,13 +122,13 @@ def main(): ) batch_folder_name = clean_name - output_folder_name='CRISPRessoBatch_on_%s' % batch_folder_name - OUTPUT_DIRECTORY=os.path.abspath(output_folder_name) + output_folder_name = 'CRISPRessoBatch_on_%s' % batch_folder_name + OUTPUT_DIRECTORY = os.path.abspath(output_folder_name) if args.batch_output_folder: - OUTPUT_DIRECTORY=os.path.join(os.path.abspath(args.batch_output_folder), output_folder_name) + OUTPUT_DIRECTORY = os.path.join(os.path.abspath(args.batch_output_folder), output_folder_name) - _jp=lambda filename: os.path.join(OUTPUT_DIRECTORY, filename) #handy function to put a file in the output directory + _jp = lambda filename: os.path.join(OUTPUT_DIRECTORY, filename) #handy function to put a file in the output directory try: info('Creating Folder %s' % OUTPUT_DIRECTORY) @@ -137,7 +136,7 @@ def main(): except: warn('Folder %s already exists.' % OUTPUT_DIRECTORY) - log_filename=_jp('CRISPRessoBatch_RUNNING_LOG.txt') + log_filename = _jp('CRISPRessoBatch_RUNNING_LOG.txt') logger.addHandler(logging.FileHandler(log_filename)) with open(log_filename, 'w+') as outfile: @@ -156,7 +155,7 @@ def main(): else: n_processes_for_batch = int(args.n_processes) - #this value will be propagated to sub-commands, so set it as 1 here + # this value will be propagated to sub-commands, so set it as 1 here args.n_processes = 1 crispresso_cmd_to_write = ' '.join(sys.argv) @@ -167,16 +166,16 @@ def main(): if os.sep in cmd_copy[i]: cmd_copy[i] = os.path.basename(cmd_copy[i]) - crispresso_cmd_to_write = ' '.join(cmd_copy) #clean command doesn't show the absolute path to the executable or other files + crispresso_cmd_to_write = ' '.join(cmd_copy) # clean command doesn't show the absolute path to the executable or other files crispresso2_info['running_info']['command_used'] = crispresso_cmd_to_write ##parse excel sheet - batch_params=pd.read_csv(args.batch_settings, comment='#', sep='\t') - #pandas either allows for auto-detect sep or for comment. not both + batch_params = pd.read_csv(args.batch_settings, comment='#', sep='\t') + # pandas either allows for auto-detect sep or for comment. not both # batch_params=pd.read_csv(args.batch_settings,sep=None,engine='python',error_bad_lines=False) batch_params.columns = batch_params.columns.str.strip(' -\xd0') - #rename column "a" to "amplicon_seq", etc + # rename column "a" to "amplicon_seq", etc batch_params.rename(index=str, columns=CRISPRessoShared.get_crispresso_options_lookup(), inplace=True) batch_count = batch_params.shape[0] batch_params.index = range(batch_count) @@ -185,7 +184,7 @@ def main(): raise CRISPRessoShared.BadParameterException("fastq_r1 must be specified in the batch settings file. Current headings are: " + str(batch_params.columns.values)) - #add args from the command line to batch_params_df + # add args from the command line to batch_params_df for arg in vars(args): if arg not in batch_params: batch_params[arg] = getattr(args, arg) @@ -193,8 +192,8 @@ def main(): if (getattr(args, arg) is not None): batch_params[arg].fillna(value=getattr(args, arg), inplace=True) - #assert that all names are unique - #and clean names + # assert that all names are unique + # and clean names for i in range(batch_count): if batch_params.loc[i, 'name'] == '': @@ -204,10 +203,10 @@ def main(): if batch_params.drop_duplicates('name').shape[0] != batch_params.shape[0]: raise CRISPRessoShared.BadParameterException('Batch input names must be unique. The given names are not unique: ' + str(batch_params.loc[:, 'name'])) - #Check files - batch_params["sgRNA_intervals"] = '' #create empty array for sgRNA intervals + # Check files + batch_params["sgRNA_intervals"] = '' # create empty array for sgRNA intervals batch_params["sgRNA_intervals"] = batch_params["sgRNA_intervals"].apply(list) - batch_params["cut_point_include_idx"] = '' #create empty array for cut point intervals for each batch based on sgRNA + batch_params["cut_point_include_idx"] = '' # create empty array for cut point intervals for each batch based on sgRNA batch_params["cut_point_include_idx"] = batch_params["cut_point_include_idx"].apply(list) for idx, row in batch_params.iterrows(): if 'fastq_r1' in row: @@ -233,20 +232,20 @@ def main(): raise CRISPRessoShared.BadParameterException("Amplicon sequence must be given as a command line parameter or be specified in the batch settings file with the heading 'amplicon_seq' (Amplicon seq on row %s '%s' is invalid)"%(int(idx)+1, curr_amplicon_seq_str)) guides_are_in_amplicon = {} #dict of whether a guide is in at least one amplicon sequence - #iterate through amplicons + # iterate through amplicons for curr_amplicon_seq in str(curr_amplicon_seq_str).split(','): - this_include_idxs=[] #mask for bp to include for this amplicon seq, as specified by sgRNA cut points + this_include_idxs=[] # mask for bp to include for this amplicon seq, as specified by sgRNA cut points this_sgRNA_intervals = [] - wrong_nt=CRISPRessoShared.find_wrong_nt(curr_amplicon_seq) + wrong_nt = CRISPRessoShared.find_wrong_nt(curr_amplicon_seq) if wrong_nt: raise CRISPRessoShared.NTException('The amplicon sequence in row %d (%s) contains incorrect characters:%s' % (idx+1, curr_amplicon_seq_str, ' '.join(wrong_nt))) - #iterate through guides + # iterate through guides curr_guide_seq_string = row.guide_seq if curr_guide_seq_string is not None and curr_guide_seq_string != "": guides = str(curr_guide_seq_string).strip().upper().split(',') for curr_guide_seq in guides: - wrong_nt=CRISPRessoShared.find_wrong_nt(curr_guide_seq) + wrong_nt = CRISPRessoShared.find_wrong_nt(curr_guide_seq) if wrong_nt: raise CRISPRessoShared.NTException('The sgRNA sequence in row %d (%s) contains incorrect characters:%s' % (idx+1, curr_guide_seq, ' '.join(wrong_nt))) guide_mismatches = [[]]*len(guides) @@ -290,7 +289,7 @@ def main(): CRISPRessoMultiProcessing.run_crispresso_cmds(crispresso_cmds, n_processes_for_batch, 'batch', args.skip_failed) - run_datas = [] #crispresso2 info from each row + run_datas = [] # crispresso2 info from each row all_amplicons = set() amplicon_names = {} @@ -310,25 +309,25 @@ def main(): for ref_name in run_data['results']['ref_names']: ref_seq = run_data['results']['refs'][ref_name]['sequence'] all_amplicons.add(ref_seq) - #if this amplicon is called something else in another sample, just call it the amplicon + # if this amplicon is called something else in another sample, just call it the amplicon if ref_name in amplicon_names and amplicon_names[ref_seq] != ref_name: amplicon_names[ref_seq] = ref_seq else: amplicon_names[ref_seq] = ref_name if ref_seq not in amplicon_counts: amplicon_counts[ref_seq] = 0 - amplicon_counts[ref_seq]+= 1 + amplicon_counts[ref_seq] += 1 completed_batch_arr.append(batch_name) crispresso2_info['results']['completed_batch_arr'] = completed_batch_arr - #make sure amplicon names aren't super long + # make sure amplicon names aren't super long for amplicon in all_amplicons: if len(amplicon_names[amplicon]) > 21: amplicon_names[amplicon] = amplicon_names[amplicon][0:21] - #make sure no duplicate names (same name for the different amplicons) + # make sure no duplicate names (same name for the different amplicons) seen_names = {} for amplicon in all_amplicons: suffix_counter = 2 @@ -338,7 +337,6 @@ def main(): suffix_counter += 1 seen_names[amplicon_names[amplicon]] = 1 - save_png = True if args.suppress_report: save_png = False @@ -352,9 +350,9 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_labels'] = {} crispresso2_info['results']['general_plots']['summary_plot_datas'] = {} - #report for amplicons + # report for amplicons for amplicon_index, amplicon_seq in enumerate(all_amplicons): - #only perform comparison if amplicon seen in more than one sample + # only perform comparison if amplicon seen in more than one sample if amplicon_counts[amplicon_seq] < 1: continue @@ -502,15 +500,13 @@ def main(): crispresso2_info['results']['modification_frequency_summary_filename'] = os.path.basename(modification_frequency_summary_filename) crispresso2_info['results']['modification_percentage_summary_filename'] = os.path.basename(modification_percentage_summary_filename) - - #if guides are all the same, merge substitutions and perform base editor comparison at guide quantification window + # if guides are all the same, merge substitutions and perform base editor comparison at guide quantification window if guides_all_same and consensus_guides != []: info("All guides are equal. Performing comparison of batches for amplicon '%s'"% amplicon_name) - include_idxs = consensus_include_idxs #include indexes are the same for all guides + include_idxs = consensus_include_idxs # include indexes are the same for all guides for idx, sgRNA in enumerate(consensus_guides): - sgRNA_intervals = consensus_sgRNA_intervals[idx] sgRNA_plot_idxs = consensus_sgRNA_plot_idxs[idx] - plot_idxs_flat = [0, 1] # guide, nucleotide + plot_idxs_flat = [0, 1] # guide, nucleotide plot_idxs_flat.extend([plot_idx + 2 for plot_idx in sgRNA_plot_idxs]) sub_nucleotide_frequency_summary_df = nucleotide_frequency_summary_df.iloc[:, plot_idxs_flat] @@ -582,7 +578,7 @@ def main(): ] # done with per-amplicon plots - if not args.suppress_plots and not args.suppress_batch_summary_plots: # plot the whole region + if not args.suppress_plots and not args.suppress_batch_summary_plots: # plot the whole region this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df, modification_percentage_summary_df, this_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=consensus_sgRNA_intervals, quantification_window_idxs=include_idxs) plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) @@ -604,7 +600,7 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = args.conversion_nuc_from + '->' + args.conversion_nuc_to +' conversion rates for the amplicon ' + amplicon_name crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))] - else: #guides are not the same + else: # guides are not the same if not args.suppress_plots and not args.suppress_batch_summary_plots: this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df, modification_percentage_summary_df, this_nuc_pct_quilt_plot_name, save_png) @@ -620,13 +616,12 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = args.conversion_nuc_from + '->' + args.conversion_nuc_to +' conversion rates for the amplicon ' + amplicon_name crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))] - crispresso2_info['results']['general_plots']['window_nuc_pct_quilt_plot_names'] = window_nuc_pct_quilt_plot_names crispresso2_info['results']['general_plots']['nuc_pct_quilt_plot_names'] = nuc_pct_quilt_plot_names crispresso2_info['results']['general_plots']['window_nuc_conv_plot_names'] = window_nuc_conv_plot_names crispresso2_info['results']['general_plots']['nuc_conv_plot_names'] = nuc_conv_plot_names - #summarize amplicon modifications + # summarize amplicon modifications with open(_jp('CRISPRessoBatch_quantification_of_editing_frequency.txt'), 'w') as outfile: wrote_header = False for idx, row in batch_params.iterrows(): @@ -646,7 +641,7 @@ def main(): outfile.write(batch_name + "\t" + line) - #summarize frameshift and splicing site mods + # summarize frameshift and splicing site mods with open(_jp('CRISPRessoBatch_quantification_of_frameshift_splicing.txt'), 'w') as outfile: outfile.write("\t".join(['Batch','Reference','total_reads','modified_frameshift','modified_non_frameshift','non_modified_non_frameshift','splicing_sites_modified','splice_sites_unmodified'])+"\n") for idx, row in batch_params.iterrows(): @@ -665,7 +660,7 @@ def main(): count_splicing_sites_unmodified = count_total - count_splicing_sites_modified outfile.write("\t".join([str(x) for x in [batch_name,ref_name,count_total,count_modified_frameshift,count_modified_non_frameshift,count_non_modified_non_frameshift,count_splicing_sites_modified,count_splicing_sites_unmodified]])+"\n") - #summarize alignment + # summarize alignment with open(_jp('CRISPRessoBatch_mapping_statistics.txt'), 'w') as outfile: wrote_header = False for idx, row in batch_params.iterrows(): @@ -693,11 +688,13 @@ def main(): crispresso2_info['running_info']['report_location'] = report_name crispresso2_info['running_info']['report_filename'] = os.path.basename(report_name) - end_time = datetime.now() - end_time_string = end_time.strftime('%Y-%m-%d %H:%M:%S') + end_time = datetime.now() + end_time_string = end_time.strftime('%Y-%m-%d %H:%M:%S') running_time = end_time - start_time - running_time_string = str(running_time) + running_time_string = str(running_time) + crispresso2_info['running_info']['start_time'] = start_time + crispresso2_info['running_info']['start_time_string'] = start_time_string crispresso2_info['running_info']['end_time'] = end_time crispresso2_info['running_info']['end_time_string'] = end_time_string crispresso2_info['running_info']['running_time'] = running_time From 55c2e9bb7be00dcbf9bd6eca6eb2a1d6f2bbf6d9 Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Sat, 22 Jan 2022 22:10:22 -0500 Subject: [PATCH 04/61] Add summary nucleotide plots to aggregate --- CRISPResso2/CRISPRessoAggregateCORE.py | 33 ++++++++++++++++++-------- CRISPResso2/CRISPRessoReport.py | 18 +++++++------- CRISPResso2/templates/multiReport.html | 14 ++++++++++- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index 2da96159..cf8c18f1 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -10,7 +10,6 @@ from copy import deepcopy import sys import argparse -import re import numpy as np import pandas as pd import traceback @@ -192,24 +191,32 @@ def main(): crispresso2_folders = crispresso2_folder_infos.keys() crispresso2_folder_names = {} crispresso2_folder_htmls = {}#file_loc->html folder loc + quilt_plots_to_show = {} # name->{'href':path to report, 'img': png} for crispresso2_folder in crispresso2_folders: - crispresso2_folder_names[crispresso2_folder] = CRISPRessoShared.slugify(crispresso2_folder) + this_folder_name = CRISPRessoShared.slugify(crispresso2_folder) + crispresso2_folder_names[crispresso2_folder] = this_folder_name this_sub_html_file = crispresso2_folder+".html" if crispresso2_folder_infos[crispresso2_folder]['running_info']['args'].place_report_in_output_folder: this_sub_html_file = os.path.join(crispresso2_folder, crispresso2_folder_infos[crispresso2_folder]['running_info']['report_filename']) crispresso2_folder_htmls[crispresso2_folder] = os.path.abspath(this_sub_html_file) + run_data = crispresso2_folder_infos[crispresso2_folder] + for ref_name in run_data['results']['ref_names']: + if 'plot_2b_roots' in run_data['results']['refs'][ref_name]: + for plot_root in run_data['results']['refs'][ref_name]['plot_2b_roots']: + quilt_plots_to_show[this_folder_name+" "+ref_name] = {'href': this_sub_html_file, + 'img': os.path.abspath(os.path.join(crispresso2_folder,plot_root+".png"))} + all_amplicons = set() - amplicon_names = {} #sequence -> ref name (to check for amplicons with the same name but different sequences) + amplicon_names = {} # sequence -> ref name (to check for amplicons with the same name but different sequences) amplicon_counts = {} amplicon_sources = {} - completed_batch_arr = [] for crispresso2_folder in crispresso2_folders: run_data = crispresso2_folder_infos[crispresso2_folder] for ref_name in run_data['results']['ref_names']: ref_seq = run_data['results']['refs'][ref_name]['sequence'] all_amplicons.add(ref_seq) - #if this amplicon is called something else in another sample, just call it the amplicon + # if this amplicon is called something else in another sample, just call it the amplicon if ref_name in amplicon_names and amplicon_names[ref_seq] != ref_name: amplicon_names[ref_seq] = ref_seq else: @@ -220,7 +227,7 @@ def main(): amplicon_counts[ref_seq]+= 1 amplicon_sources[ref_seq].append(crispresso2_folder+'(' + ref_name + ')') - #make sure amplicon names aren't super long + # make sure amplicon names aren't super long for amplicon in all_amplicons: if len(amplicon_names[amplicon]) > 21: amplicon_names[amplicon] = amplicon_names[amplicon][0:21] @@ -596,15 +603,21 @@ def main(): report_filename = OUTPUT_DIRECTORY+'.html' if (args.place_report_in_output_folder): report_filename = _jp("CRISPResso2Aggregate_report.html") - CRISPRessoReport.make_aggregate_report(crispresso2_info, args.name, report_filename, OUTPUT_DIRECTORY, _ROOT, crispresso2_folders, crispresso2_folder_htmls) + CRISPRessoReport.make_aggregate_report(crispresso2_info, args.name, + report_filename, OUTPUT_DIRECTORY, + _ROOT, crispresso2_folders, + crispresso2_folder_htmls, + quilt_plots_to_show) crispresso2_info['running_info']['report_location'] = report_filename crispresso2_info['running_info']['report_filename'] = os.path.basename(report_filename) - end_time = datetime.now() - end_time_string = end_time.strftime('%Y-%m-%d %H:%M:%S') + end_time = datetime.now() + end_time_string = end_time.strftime('%Y-%m-%d %H:%M:%S') running_time = end_time - start_time - running_time_string = str(running_time) + running_time_string = str(running_time) + crispresso2_info['running_info']['start_time'] = start_time + crispresso2_info['running_info']['start_time_string'] = start_time_string crispresso2_info['running_info']['end_time'] = end_time crispresso2_info['running_info']['end_time_string'] = end_time_string crispresso2_info['running_info']['running_time'] = running_time diff --git a/CRISPResso2/CRISPRessoReport.py b/CRISPResso2/CRISPRessoReport.py index 028913d1..abf223cb 100644 --- a/CRISPResso2/CRISPRessoReport.py +++ b/CRISPResso2/CRISPRessoReport.py @@ -5,13 +5,10 @@ ''' import os -import sys from jinja2 import Environment, FileSystemLoader -import shutil -import pandas as pd -import re from CRISPResso2 import CRISPRessoShared + def make_report_from_folder(crispresso_report_file, crispresso_folder, _ROOT): """ Makes an html report for a crispresso run @@ -306,7 +303,8 @@ def make_multi_report(run_names,sub_html_files,crispresso_multi_report_file,cris summary_plot_names=[], summary_plot_titles={}, summary_plot_labels={}, - summary_plot_datas={} + summary_plot_datas={}, + compact_plots_to_show={} ): """ Makes an HTML report for a run containing multiple crispresso runs @@ -323,6 +321,7 @@ def make_multi_report(run_names,sub_html_files,crispresso_multi_report_file,cris summary_plot_titles (dict): dict of plot_name->plot_title summary_plot_labels (dict): dict of plot_name->plot_label summary_plot_datas (dict): dict of plot_name->(datafile_description, data_filename) + compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show} """ @@ -342,10 +341,10 @@ def dirname(path): outfile.write(template.render(window_nuc_pct_quilts=window_nuc_pct_quilts, nuc_pct_quilts=nuc_pct_quilts, window_nuc_conv_plots=window_nuc_conv_plots, nuc_conv_plots=nuc_conv_plots, crispresso_data_path=crispresso_data_path, summary_plot_names=summary_plot_names, summary_plot_titles=summary_plot_titles, summary_plot_labels=summary_plot_labels, summary_plot_datas=summary_plot_datas, - run_names=run_names, sub_html_files=sub_html_files, report_name=report_name)) + run_names=run_names, sub_html_files=sub_html_files, report_name=report_name, compact_plots_to_show=compact_plots_to_show)) outfile.close() -def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,crispresso_report_folder,_ROOT,folder_arr,crispresso_html_reports,display_names=None): +def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,crispresso_report_folder,_ROOT,folder_arr,crispresso_html_reports,compact_plots_to_show={},display_names=None): """ Prepares information to make a report of a CRISPRessoAggregate run @@ -357,6 +356,7 @@ def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,cr _ROOT (string): location of crispresso assets (images, templates, etc) folder_arr (arr of strings): paths to the aggregated crispresso folders crispresso_html_reports (dict): folder->html_path; Paths to the aggregated crispresso run html reports + compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show} display_names (dict): folder->display_name; Titles to be shown for crispresso runs (if different from names_arr, e.g. if display_names have spaces or bad chars, they won't be the same as names_arr) Returns: @@ -397,4 +397,6 @@ def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,cr make_multi_report(run_names, sub_html_files, crispresso_report_file, crispresso_report_folder, _ROOT, report_name, window_nuc_pct_quilts=window_nuc_pct_quilts, nuc_pct_quilts=nuc_pct_quilts, - summary_plot_names=summary_plot_names, summary_plot_titles=summary_plot_titles, summary_plot_labels=summary_plot_labels, summary_plot_datas=summary_plot_datas) + summary_plot_names=summary_plot_names, summary_plot_titles=summary_plot_titles, + summary_plot_labels=summary_plot_labels, summary_plot_datas=summary_plot_datas, + compact_plots_to_show=compact_plots_to_show) diff --git a/CRISPResso2/templates/multiReport.html b/CRISPResso2/templates/multiReport.html index 11e620e3..3421021d 100644 --- a/CRISPResso2/templates/multiReport.html +++ b/CRISPResso2/templates/multiReport.html @@ -56,7 +56,7 @@
{{report_name}}
-
+
{% for run_name in run_names %} {{run_name}} {% endfor %} @@ -154,6 +154,18 @@
{{summary_plot_titles[plot_name]}}
{% endfor %} {% endif %} + {% if compact_plots_to_show|length > 0 %} +
+
+
Summary Plots
+
+
+ + {% endfor %} +
+
+ {% endif %} +
From 1316d3067cad8f8e4435f90dea1eb877e7c16c64 Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Sun, 23 Jan 2022 03:26:29 -0500 Subject: [PATCH 05/61] Aggregate plots are paginated --- CRISPResso2/CRISPRessoAggregateCORE.py | 160 +++++++++++++++---------- CRISPResso2/CRISPRessoBatchCORE.py | 2 +- CRISPResso2/CRISPRessoReport.py | 6 + CRISPResso2/templates/multiReport.html | 9 +- 4 files changed, 113 insertions(+), 64 deletions(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index cf8c18f1..32402ae3 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -202,10 +202,10 @@ def main(): run_data = crispresso2_folder_infos[crispresso2_folder] for ref_name in run_data['results']['ref_names']: - if 'plot_2b_roots' in run_data['results']['refs'][ref_name]: - for plot_root in run_data['results']['refs'][ref_name]['plot_2b_roots']: - quilt_plots_to_show[this_folder_name+" "+ref_name] = {'href': this_sub_html_file, - 'img': os.path.abspath(os.path.join(crispresso2_folder,plot_root+".png"))} + if 'plot_2a_root' in run_data['results']['refs'][ref_name]: + plot_root = run_data['results']['refs'][ref_name]['plot_2a_root'] + quilt_plots_to_show[this_folder_name+" "+ref_name] = {'href': os.path.abspath(this_sub_html_file), + 'img': os.path.abspath(os.path.join(crispresso2_folder,plot_root+".png"))} all_amplicons = set() amplicon_names = {} # sequence -> ref name (to check for amplicons with the same name but different sequences) @@ -413,41 +413,55 @@ def main(): info("All guides are equal. Performing comparison of runs for amplicon '%s'"% amplicon_name) include_idxs = consensus_include_idxs #include indexes are the same for all guides for idx, sgRNA in enumerate(consensus_guides): - sgRNA_intervals = consensus_sgRNA_intervals[idx] sgRNA_plot_idxs = consensus_sgRNA_plot_idxs[idx] plot_idxs_flat = [0, 1] # guide, nucleotide plot_idxs_flat.extend([plot_idx + 2 for plot_idx in sgRNA_plot_idxs]) + sub_nucleotide_frequency_summary_df = nucleotide_frequency_summary_df.iloc[:, plot_idxs_flat] + sub_nucleotide_frequency_summary_df = pd.concat([sub_nucleotide_frequency_summary_df.iloc[:, 0:2], + sub_nucleotide_frequency_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) + sub_nucleotide_frequency_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_frequency_summary_around_sgRNA_'+sgRNA+'.txt') + sub_nucleotide_frequency_summary_df.to_csv(sub_nucleotide_frequency_summary_filename, sep='\t', index=None) + sub_nucleotide_percentage_summary_df = nucleotide_percentage_summary_df.iloc[:, plot_idxs_flat] - sub_modification_percentage_summary_df = modification_percentage_summary_df.iloc[:, plot_idxs_flat] + sub_nucleotide_percentage_summary_df = pd.concat([sub_nucleotide_percentage_summary_df.iloc[:, 0:2], + sub_nucleotide_percentage_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) + sub_nucleotide_percentage_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_percentage_summary_around_sgRNA_'+sgRNA+'.txt') + sub_nucleotide_percentage_summary_df.to_csv(sub_nucleotide_percentage_summary_filename, sep='\t', index=None) - #show all sgRNA's on the plot - sub_sgRNA_intervals = [] - for sgRNA_interval in consensus_sgRNA_intervals: - newstart = None - newend = None - for idx, i in enumerate(sgRNA_plot_idxs): - if i <= sgRNA_interval[0]: - newstart = idx - if newend is None and i >= sgRNA_interval[1]: - newend = idx - - #if guide doesn't overlap with plot idxs - if newend == 0 or newstart == len(sgRNA_plot_idxs): - continue - #otherwise, correct partial overlaps - elif newstart == None and newend == None: - newstart = 0 - newend = len(include_idxs) -1 - elif newstart == None: - newstart = 0 - elif newend == None: - newend = len(include_idxs) -1 - #and add it to the list - sub_sgRNA_intervals.append((newstart, newend)) + sub_modification_percentage_summary_df = modification_percentage_summary_df.iloc[:, plot_idxs_flat] + sub_modification_percentage_summary_df = pd.concat([sub_modification_percentage_summary_df.iloc[:, 0:2], + sub_modification_percentage_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) + sub_modification_percentage_summary_filename = _jp(amplicon_plot_name + 'Modification_percentage_summary_around_sgRNA_'+sgRNA+'.txt') + sub_modification_percentage_summary_df.to_csv(sub_modification_percentage_summary_filename, sep='\t', index=None) if not args.suppress_plots: - #plot for each guide + # plot for each guide + # show all sgRNA's on the plot + sub_sgRNA_intervals = [] + for sgRNA_interval in consensus_sgRNA_intervals: + newstart = None + newend = None + for idx, i in enumerate(sgRNA_plot_idxs): + if i <= sgRNA_interval[0]: + newstart = idx + if newend is None and i >= sgRNA_interval[1]: + newend = idx + + #if guide doesn't overlap with plot idxs + if newend == 0 or newstart == len(sgRNA_plot_idxs): + continue + #otherwise, correct partial overlaps + elif newstart == None and newend == None: + newstart = 0 + newend = len(include_idxs) -1 + elif newstart == None: + newstart = 0 + elif newend == None: + newend = len(include_idxs) -1 + #and add it to the list + sub_sgRNA_intervals.append((newstart, newend)) + this_window_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt_around_sgRNA_'+sgRNA) CRISPRessoPlot.plot_nucleotide_quilt(sub_nucleotide_percentage_summary_df, sub_modification_percentage_summary_df, this_window_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=sub_sgRNA_intervals, quantification_window_idxs=include_idxs, group_column='Folder') plot_name = os.path.basename(this_window_nuc_pct_quilt_plot_name) @@ -457,36 +471,62 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = '' crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base around the guide ' + sgRNA + ' for the amplicon ' + amplicon_name crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [(amplicon_name + ' nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), (amplicon_name + ' modification frequencies', os.path.basename(modification_frequency_summary_filename))] + # done with per-sgRNA plots + + this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) + if not args.suppress_plots and this_number_samples < 150: # plot the whole region + this_plot_suffix = "" # in case we have a lot of regions, split them up and add a suffix here + this_plot_suffix_int = 1 + samples_per_plot = 150 # plot 150 samples per plot + this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) + nrow_per_sample_nucs = nucleotide_percentage_summary_df.shape[0] / this_number_samples # calculate number of rows per sample for subsetting the tables + nrow_per_sample_mods = modification_percentage_summary_df.shape[0] / this_number_samples + for sample_start_ind in range(0,this_number_samples,samples_per_plot): + sample_end_ind = min(sample_start_ind + samples_per_plot, this_number_samples) + this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt' + this_plot_suffix) + this_nuc_start_ind = int(sample_start_ind*nrow_per_sample_nucs) + this_nuc_end_ind = int((sample_end_ind+1)*nrow_per_sample_nucs - 1) + this_mod_start_ind = int(sample_start_ind*nrow_per_sample_mods) + this_mod_end_ind = int((sample_end_ind+1)*nrow_per_sample_mods - 1) + CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df.iloc[this_nuc_start_ind:this_nuc_end_ind,:], modification_percentage_summary_df.iloc[this_mod_start_ind:this_mod_end_ind,:], this_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=consensus_sgRNA_intervals, quantification_window_idxs=include_idxs, group_column='Folder') + plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) + nuc_pct_quilt_plot_names.append(plot_name) + crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = 'Amplicon: ' + amplicon_name + this_plot_suffix + if len(amplicon_names) == 1: + crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = '' + crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base for the amplicon ' + amplicon_name + crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [(amplicon_name + ' nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), (amplicon_name + ' modification frequencies', os.path.basename(modification_frequency_summary_filename))] + + this_plot_suffix_int += 1 + this_plot_suffix = "_" + str(this_plot_suffix_int) + + else: # guides are not the same + this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) + if not args.suppress_plots and this_number_samples < 150: + this_plot_suffix = "" # in case we have a lot of regions, split them up and add a suffix here + this_plot_suffix_int = 1 + samples_per_plot = 150 # plot 150 samples per plot + this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) + nrow_per_sample_nucs = nucleotide_percentage_summary_df.shape[0] / this_number_samples # calculate number of rows per sample for subsetting the tables + nrow_per_sample_mods = modification_percentage_summary_df.shape[0] / this_number_samples + for sample_start_ind in range(0,this_number_samples,samples_per_plot): + sample_end_ind = min(sample_start_ind + samples_per_plot, this_number_samples) + this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt' + this_plot_suffix) + this_nuc_start_ind = int(sample_start_ind*nrow_per_sample_nucs) + this_nuc_end_ind = int((sample_end_ind+1)*nrow_per_sample_nucs - 1) + this_mod_start_ind = int(sample_start_ind*nrow_per_sample_mods) + this_mod_end_ind = int((sample_end_ind+1)*nrow_per_sample_mods - 1) + CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df.iloc[this_nuc_start_ind:this_nuc_end_ind,:], modification_percentage_summary_df.iloc[this_mod_start_ind:this_mod_end_ind,:], this_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=consensus_sgRNA_intervals, quantification_window_idxs=consensus_include_idxs, group_column='Folder') + plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) + nuc_pct_quilt_plot_names.append(plot_name) + crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = 'Amplicon: ' + amplicon_name + this_plot_suffix + if len(amplicon_names) == 1: + crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = '' + crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base for the amplicon ' + amplicon_name + crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [(amplicon_name + ' nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), (amplicon_name + ' modification frequencies', os.path.basename(modification_frequency_summary_filename))] - sub_nucleotide_frequency_summary_df = pd.concat([sub_nucleotide_frequency_summary_df.iloc[:, 0:2], - sub_nucleotide_frequency_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) - sub_nucleotide_frequency_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_frequency_summary_around_sgRNA_'+sgRNA+'.txt') - sub_nucleotide_frequency_summary_df.to_csv(sub_nucleotide_frequency_summary_filename, sep='\t', index=None) - - sub_nucleotide_percentage_summary_df = pd.concat([sub_nucleotide_percentage_summary_df.iloc[:, 0:2], - sub_nucleotide_percentage_summary_df.iloc[:, 2:].apply(pd.to_numeric)], axis=1) - sub_nucleotide_percentage_summary_filename = _jp(amplicon_plot_name + 'Nucleotide_percentage_summary_around_sgRNA_'+sgRNA+'.txt') - sub_nucleotide_percentage_summary_df.to_csv(sub_nucleotide_percentage_summary_filename, sep='\t', index=None) - - if not args.suppress_plots: # plot the whole region - this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') - CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df, modification_percentage_summary_df, this_nuc_pct_quilt_plot_name, save_png, sgRNA_intervals=consensus_sgRNA_intervals, quantification_window_idxs=include_idxs, group_column='Folder') - plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) - nuc_pct_quilt_plot_names.append(plot_name) - crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = 'Amplicon: ' + amplicon_name - if len(amplicon_names) == 1: - crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = '' - crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base for the amplicon ' + amplicon_name - crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [(amplicon_name + ' nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), (amplicon_name + ' modification frequencies', os.path.basename(modification_frequency_summary_filename))] - - else: #guides are not the same - if not args.suppress_plots: - this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') - CRISPRessoPlot.plot_nucleotide_quilt(nucleotide_percentage_summary_df, modification_percentage_summary_df, this_nuc_pct_quilt_plot_name, save_png, group_column='Folder') - plot_name = os.path.basename(this_nuc_pct_quilt_plot_name) - nuc_pct_quilt_plot_names.append(plot_name) - crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base for the amplicon ' + amplicon_name - crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [(amplicon_name + ' nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), (amplicon_name + ' modification frequencies', os.path.basename(modification_frequency_summary_filename))] + this_plot_suffix_int += 1 + this_plot_suffix = "_" + str(this_plot_suffix_int) crispresso2_info['results']['general_plots']['window_nuc_pct_quilt_plot_names'] = window_nuc_pct_quilt_plot_names crispresso2_info['results']['general_plots']['nuc_pct_quilt_plot_names'] = nuc_pct_quilt_plot_names diff --git a/CRISPResso2/CRISPRessoBatchCORE.py b/CRISPResso2/CRISPRessoBatchCORE.py index 911a9d9b..e5920211 100644 --- a/CRISPResso2/CRISPRessoBatchCORE.py +++ b/CRISPResso2/CRISPRessoBatchCORE.py @@ -576,7 +576,7 @@ def main(): crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies around sgRNA', os.path.basename(sub_nucleotide_frequency_summary_filename)), ('Nucleotide percentages around sgRNA', os.path.basename(sub_nucleotide_percentage_summary_filename)) ] - # done with per-amplicon plots + # done with per-sgRNA plots if not args.suppress_plots and not args.suppress_batch_summary_plots: # plot the whole region this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt') diff --git a/CRISPResso2/CRISPRessoReport.py b/CRISPResso2/CRISPRessoReport.py index abf223cb..de80069b 100644 --- a/CRISPResso2/CRISPRessoReport.py +++ b/CRISPResso2/CRISPRessoReport.py @@ -394,6 +394,12 @@ def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,cr sub_html_file = os.path.relpath(crispresso_html_reports[folder], crispresso_report_folder) sub_html_files[display_name] = sub_html_file + for compact_plot in compact_plots_to_show: + old_href = compact_plots_to_show[compact_plot]['href'] + compact_plots_to_show[compact_plot]['href'] = os.path.relpath(old_href, crispresso_report_folder) + old_img = compact_plots_to_show[compact_plot]['img'] + compact_plots_to_show[compact_plot]['img'] = os.path.relpath(old_img, crispresso_report_folder) + make_multi_report(run_names, sub_html_files, crispresso_report_file, crispresso_report_folder, _ROOT, report_name, window_nuc_pct_quilts=window_nuc_pct_quilts, nuc_pct_quilts=nuc_pct_quilts, diff --git a/CRISPResso2/templates/multiReport.html b/CRISPResso2/templates/multiReport.html index 3421021d..b1794fcd 100644 --- a/CRISPResso2/templates/multiReport.html +++ b/CRISPResso2/templates/multiReport.html @@ -159,9 +159,12 @@
{{summary_plot_titles[plot_name]}}
Summary Plots
-
- - {% endfor %} +
+
+ {% for compact_plot in compact_plots_to_show %} + + {% endfor %} +
{% endif %} From 2e9b50b72c9962a909ab8b8c4ab491547c1ea989 Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Sun, 23 Jan 2022 03:28:58 -0500 Subject: [PATCH 06/61] Update CRISPRessoAggregateCORE.py Remove max sample limit for plotting --- CRISPResso2/CRISPRessoAggregateCORE.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index 32402ae3..847b491c 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -474,7 +474,7 @@ def main(): # done with per-sgRNA plots this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) - if not args.suppress_plots and this_number_samples < 150: # plot the whole region + if not args.suppress_plots: # and this_number_samples < 500: # plot the whole region this_plot_suffix = "" # in case we have a lot of regions, split them up and add a suffix here this_plot_suffix_int = 1 samples_per_plot = 150 # plot 150 samples per plot @@ -502,7 +502,7 @@ def main(): else: # guides are not the same this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) - if not args.suppress_plots and this_number_samples < 150: + if not args.suppress_plots: # and this_number_samples < 150: this_plot_suffix = "" # in case we have a lot of regions, split them up and add a suffix here this_plot_suffix_int = 1 samples_per_plot = 150 # plot 150 samples per plot From 6d5bc8317500e71fbbb42d3209e6f2f6b3c650e1 Mon Sep 17 00:00:00 2001 From: Kendell Clement Date: Mon, 24 Jan 2022 15:02:07 -0500 Subject: [PATCH 07/61] Add --max_samples_per_summary_plot to CRISPRessoAggregate Parameterize the max number of samples to plot on each page of reports. Additional PDFs will be created with this number of samples on them. --- CRISPResso2/CRISPRessoAggregateCORE.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index 847b491c..5223346c 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -61,6 +61,7 @@ def main(): parser.add_argument('--place_report_in_output_folder', help='If true, report will be written inside the CRISPResso output folder. By default, the report will be written one directory up from the report output.', action='store_true') parser.add_argument('--suppress_report', help='Suppress output report', action='store_true') parser.add_argument('--suppress_plots', help='Suppress output plots', action='store_true') + parser.add_argument('--max_samples_per_summary_plot', type=int, help="Maximum number of samples on each page of the pdf report plots. If this number gets above ~150, they will be too big for matplotlib." default=250) parser.add_argument('--debug', help='Show debug messages', action='store_true') @@ -477,12 +478,11 @@ def main(): if not args.suppress_plots: # and this_number_samples < 500: # plot the whole region this_plot_suffix = "" # in case we have a lot of regions, split them up and add a suffix here this_plot_suffix_int = 1 - samples_per_plot = 150 # plot 150 samples per plot this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) nrow_per_sample_nucs = nucleotide_percentage_summary_df.shape[0] / this_number_samples # calculate number of rows per sample for subsetting the tables nrow_per_sample_mods = modification_percentage_summary_df.shape[0] / this_number_samples - for sample_start_ind in range(0,this_number_samples,samples_per_plot): - sample_end_ind = min(sample_start_ind + samples_per_plot, this_number_samples) + for sample_start_ind in range(0, this_number_samples, args.max_samples_per_summary_plot): + sample_end_ind = min(sample_start_ind + args.max_samples_per_summary_plot, this_number_samples) this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt' + this_plot_suffix) this_nuc_start_ind = int(sample_start_ind*nrow_per_sample_nucs) this_nuc_end_ind = int((sample_end_ind+1)*nrow_per_sample_nucs - 1) @@ -505,12 +505,11 @@ def main(): if not args.suppress_plots: # and this_number_samples < 150: this_plot_suffix = "" # in case we have a lot of regions, split them up and add a suffix here this_plot_suffix_int = 1 - samples_per_plot = 150 # plot 150 samples per plot this_number_samples = len(pd.unique(nucleotide_percentage_summary_df['Folder'])) nrow_per_sample_nucs = nucleotide_percentage_summary_df.shape[0] / this_number_samples # calculate number of rows per sample for subsetting the tables nrow_per_sample_mods = modification_percentage_summary_df.shape[0] / this_number_samples - for sample_start_ind in range(0,this_number_samples,samples_per_plot): - sample_end_ind = min(sample_start_ind + samples_per_plot, this_number_samples) + for sample_start_ind in range(0,this_number_samples,args.max_samples_per_summary_plot): + sample_end_ind = min(sample_start_ind + args.max_samples_per_summary_plot, this_number_samples) this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt' + this_plot_suffix) this_nuc_start_ind = int(sample_start_ind*nrow_per_sample_nucs) this_nuc_end_ind = int((sample_end_ind+1)*nrow_per_sample_nucs - 1) From ef6702763e8a3277561a5432b78a92069e971c3c Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Wed, 26 Jan 2022 15:00:57 -0700 Subject: [PATCH 08/61] Add plotly function to plot an interactive heatmap --- CRISPResso2/CRISPRessoPlot.py | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/CRISPResso2/CRISPRessoPlot.py b/CRISPResso2/CRISPRessoPlot.py index c97593f7..fdb5dfc8 100644 --- a/CRISPResso2/CRISPRessoPlot.py +++ b/CRISPResso2/CRISPRessoPlot.py @@ -13,6 +13,7 @@ import matplotlib.patches as patches import matplotlib.cm as cm import matplotlib.gridspec as gridspec +import plotly.express as px from collections import defaultdict from copy import deepcopy import re @@ -3710,3 +3711,45 @@ def plot_quantification_positions( ) plt.close(fig) + + +def plot_allele_modification_heatmap( + sample_values, sample_sgRNA_intervals, plot_path, title, +): + sample_values.columns = [ + '{0} ({1})'.format(column, position) + for position, column in + enumerate(sample_values.columns, 1) + ] + sample_values.index = [ + '{0} ({1})'.format(folder, folder_index) + for folder_index, folder in + enumerate(sample_values.index, 1) + ] + fig = px.imshow( + sample_values, + labels={ + 'x': 'Position', + 'y': 'Sample', + 'color': '{0} (%)'.format(title), + }, + ) + for sample_id, sgRNA_intervals in zip( + range(sample_values.shape[0]), sample_sgRNA_intervals, + ): + for sgRNA_interval in sgRNA_intervals: + fig.add_shape( + type='rect', + x0=sgRNA_interval[0], + y0=sample_id - 0.5, + x1=sgRNA_interval[1], + y1=sample_id + 0.5, + line={'color': 'Black'}, + ) + + return fig.write_html( + plot_path, + include_plotlyjs='cdn', + full_html=False, + div_id='allele-modification-heatmap-{0}'.format(title.lower()), + ) From 2ffdff7305a4e6336d21077f6003517786d80821 Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Wed, 26 Jan 2022 15:01:37 -0700 Subject: [PATCH 09/61] Fix deprecated numpy type to suppress warning --- CRISPResso2/CRISPRessoAggregateCORE.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index 5223346c..51d075f3 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -344,7 +344,9 @@ def main(): mod_pcts = {} for key in mod_freqs: - mod_pcts[key] = np.array(mod_freqs[key]).astype(np.float)/float(this_amp_total_reads) + mod_pcts[key] = np.array( + mod_freqs[key], + ).astype(float) / float(this_amp_total_reads) amp_found_count += 1 From 06e05db2fdbbca560f079130d545b2008525386d Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Wed, 26 Jan 2022 15:02:22 -0700 Subject: [PATCH 10/61] Add plotting of heatmaps to CRISPRessoAggregateCORE to summarize modification types These heatmaps are interactive (zoomable and panable) and show for each sample the percentage of insertions, substitutions, and deletions. --- CRISPResso2/CRISPRessoAggregateCORE.py | 45 +++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index 51d075f3..bd6d9776 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -36,6 +36,7 @@ _ROOT = os.path.abspath(os.path.dirname(__file__)) + def main(): try: start_time = datetime.now() @@ -61,7 +62,7 @@ def main(): parser.add_argument('--place_report_in_output_folder', help='If true, report will be written inside the CRISPResso output folder. By default, the report will be written one directory up from the report output.', action='store_true') parser.add_argument('--suppress_report', help='Suppress output report', action='store_true') parser.add_argument('--suppress_plots', help='Suppress output plots', action='store_true') - parser.add_argument('--max_samples_per_summary_plot', type=int, help="Maximum number of samples on each page of the pdf report plots. If this number gets above ~150, they will be too big for matplotlib." default=250) + parser.add_argument('--max_samples_per_summary_plot', type=int, help="Maximum number of samples on each page of the pdf report plots. If this number gets above ~150, they will be too big for matplotlib.", default=250) parser.add_argument('--debug', help='Show debug messages', action='store_true') @@ -529,6 +530,48 @@ def main(): this_plot_suffix_int += 1 this_plot_suffix = "_" + str(this_plot_suffix_int) + if not args.suppress_plots: + crispresso2_info['results']['general_plots']['heatmap_plot_names'] = [] + crispresso2_info['results']['general_plots']['heatmap_plot_paths'] = {} + crispresso2_info['results']['general_plots']['heatmap_plot_titles'] = {} + crispresso2_info['results']['general_plots']['heatmap_plot_labels'] = {} + crispresso2_info['results']['general_plots']['heatmap_plot_datas'] = {} + if guides_all_same: + sgRNA_intervals = [consensus_sgRNA_intervals] * modification_frequency_summary_df.shape[0] + else: + sgRNA_intervals = consensus_sgRNA_intervals + for modification_type in ['Insertions', 'Deletions', 'Substitutions']: + modification_df = modification_frequency_summary_df[ + modification_frequency_summary_df['Modification'] == modification_type + ] + modification_df.index = modification_df['Folder'] + modification_df = modification_df.drop( + ['Modification', 'Folder'], axis=1, + ) + plot_name = 'CRISPRessoAggregate_percentage_of_{0}_across_alleles_{1}'.format(modification_type.lower(), amplicon_name) + plot_path = '{0}.html'.format(_jp(plot_name)) + CRISPRessoPlot.plot_allele_modification_heatmap( + modification_df, + sgRNA_intervals, + plot_path, + modification_type, + ) + crispresso2_info['results']['general_plots']['heatmap_plot_names'].append(plot_name) + crispresso2_info['results']['general_plots']['heatmap_plot_paths'][plot_name] = plot_path + crispresso2_info['results']['general_plots']['heatmap_plot_titles'][plot_name] = 'CRISPRessoAggregate {0} Across Alleles for {1}'.format( + modification_type, + amplicon_name, + ) + crispresso2_info['results']['general_plots']['heatmap_plot_labels'][plot_name] = 'Each row is an allele and each column is a position in the amplicon sequence. Each cell shows the percentage of {0} for the allele at that position relative to the amplicon. Guides for each sample are identified by a black rectangle.'.format(modification_type.lower()) + crispresso2_info['results']['general_plots']['heatmap_plot_datas'][plot_name] = [ + ( + 'CRISPRessoAggregate Modification Frequency Summary', + os.path.basename( + modification_frequency_summary_filename, + ), + ), + ] + crispresso2_info['results']['general_plots']['window_nuc_pct_quilt_plot_names'] = window_nuc_pct_quilt_plot_names crispresso2_info['results']['general_plots']['nuc_pct_quilt_plot_names'] = nuc_pct_quilt_plot_names crispresso2_info['results']['general_plots']['window_nuc_conv_plot_names'] = window_nuc_conv_plot_names From bab6e518762d3082742f15b57601e50f4c23e68f Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Wed, 26 Jan 2022 15:05:26 -0700 Subject: [PATCH 11/61] Add the heatmap summaries to the CRISPRessoAggregate report --- CRISPResso2/CRISPRessoReport.py | 174 ++++++++++++++++++------- CRISPResso2/templates/multiReport.html | 17 +++ 2 files changed, 144 insertions(+), 47 deletions(-) diff --git a/CRISPResso2/CRISPRessoReport.py b/CRISPResso2/CRISPRessoReport.py index de80069b..826d7097 100644 --- a/CRISPResso2/CRISPRessoReport.py +++ b/CRISPResso2/CRISPRessoReport.py @@ -295,7 +295,14 @@ def make_multi_report_from_folder(crispresso2_info,names_arr,report_name,crispre make_multi_report(run_names, sub_html_files, crispresso_report_file, folder, _ROOT, report_name, summary_plot_names=summary_plot_names, summary_plot_titles=summary_plot_titles, summary_plot_labels=summary_plot_labels, summary_plot_datas=summary_plot_datas) -def make_multi_report(run_names,sub_html_files,crispresso_multi_report_file,crispresso_folder,_ROOT,report_name, + +def make_multi_report( + run_names, + sub_html_files, + crispresso_multi_report_file, + crispresso_folder, + _ROOT, + report_name, window_nuc_pct_quilts=[], nuc_pct_quilts=[], window_nuc_conv_plots=[], @@ -304,47 +311,86 @@ def make_multi_report(run_names,sub_html_files,crispresso_multi_report_file,cris summary_plot_titles={}, summary_plot_labels={}, summary_plot_datas={}, - compact_plots_to_show={} + compact_plots_to_show={}, + heatmap_plot_names={}, + heatmap_plot_htmls={}, + heatmap_plot_titles={}, + heatmap_plot_labels={}, + heatmap_plot_datas={}, +): + """ + Makes an HTML report for a run containing multiple crispresso runs + + Parameters: + run_names (arr of strings): names of runs + sub_html_files (dict): dict of run_name->file_loc + crispresso_multi_report_file (string): path of file to write to + report_name (string): description of report type to be shown at top of report + crispresso_folder (string): absolute path to the crispresso output + _ROOT (string): absolute path to the crispresso executable + + summary_plot_names (list): list of plot names - keys for following dicts + summary_plot_titles (dict): dict of plot_name->plot_title + summary_plot_labels (dict): dict of plot_name->plot_label + summary_plot_datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] + compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show} + heatmap_plot_names (list): list of plot names for heatmaps, keys for dicts below + heatmap_plot_htmls (dict): dict of plot_name->HTML for the plot + heatmap_plot_titles (dict): dict of plot_name->plot_title + heatmap_plot_labels (dict): dict of plot_name->plot_label + heatmap_plot_datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] + """ + + def dirname(path): + return os.path.basename(os.path.dirname(path)) + j2_env = Environment( + loader=FileSystemLoader(os.path.join(_ROOT, 'templates')), + ) + j2_env.filters['dirname'] = dirname + template = j2_env.get_template('multiReport.html') + + crispresso_data_path = os.path.relpath( + crispresso_folder, os.path.dirname(crispresso_multi_report_file), + ) + if crispresso_data_path == ".": + crispresso_data_path = "" + else: + crispresso_data_path += "/" + + with open(crispresso_multi_report_file, 'w') as outfile: + outfile.write(template.render( + window_nuc_pct_quilts=window_nuc_pct_quilts, + nuc_pct_quilts=nuc_pct_quilts, + window_nuc_conv_plots=window_nuc_conv_plots, + nuc_conv_plots=nuc_conv_plots, + crispresso_data_path=crispresso_data_path, + summary_plot_names=summary_plot_names, + summary_plot_titles=summary_plot_titles, + summary_plot_labels=summary_plot_labels, + summary_plot_datas=summary_plot_datas, + run_names=run_names, + sub_html_files=sub_html_files, + report_name=report_name, + compact_plots_to_show=compact_plots_to_show, + heatmap_plot_names=heatmap_plot_names, + heatmap_plot_htmls=heatmap_plot_htmls, + heatmap_plot_titles=heatmap_plot_titles, + heatmap_plot_labels=heatmap_plot_labels, + heatmap_plot_datas=heatmap_plot_datas, + )) + + +def make_aggregate_report( + crispresso2_info, + report_name, + crispresso_report_file, + crispresso_report_folder, + _ROOT, + folder_arr, + crispresso_html_reports, + compact_plots_to_show={}, + display_names=None, ): - """ - Makes an HTML report for a run containing multiple crispresso runs - - Parameters: - run_names (arr of strings): names of runs - sub_html_files (dict): dict of run_name->file_loc - crispresso_multi_report_file (string): path of file to write to - report_name (string): description of report type to be shown at top of report - crispresso_folder (string): absolute path to the crispresso output - _ROOT (string): absolute path to the crispresso executable - - summary_plot_names (list): list of plot names - keys for following dicts - summary_plot_titles (dict): dict of plot_name->plot_title - summary_plot_labels (dict): dict of plot_name->plot_label - summary_plot_datas (dict): dict of plot_name->(datafile_description, data_filename) - compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show} - - """ - - def dirname(path): - return os.path.basename(os.path.dirname(path)) - j2_env = Environment(loader=FileSystemLoader(os.path.join(_ROOT, 'templates'))) - j2_env.filters['dirname'] = dirname - template = j2_env.get_template('multiReport.html') - - crispresso_data_path = os.path.relpath(crispresso_folder, os.path.dirname(crispresso_multi_report_file)) - if crispresso_data_path == ".": - crispresso_data_path = "" - else: - crispresso_data_path += "/"; - - outfile = open(crispresso_multi_report_file, 'w') - outfile.write(template.render(window_nuc_pct_quilts=window_nuc_pct_quilts, nuc_pct_quilts=nuc_pct_quilts, - window_nuc_conv_plots=window_nuc_conv_plots, nuc_conv_plots=nuc_conv_plots, crispresso_data_path=crispresso_data_path, - summary_plot_names=summary_plot_names, summary_plot_titles=summary_plot_titles, summary_plot_labels=summary_plot_labels, summary_plot_datas=summary_plot_datas, - run_names=run_names, sub_html_files=sub_html_files, report_name=report_name, compact_plots_to_show=compact_plots_to_show)) - outfile.close() - -def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,crispresso_report_folder,_ROOT,folder_arr,crispresso_html_reports,compact_plots_to_show={},display_names=None): """ Prepares information to make a report of a CRISPRessoAggregate run @@ -374,6 +420,21 @@ def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,cr summary_plot_datas = {} if 'summary_plot_datas' in crispresso2_info['results']['general_plots']: summary_plot_datas = crispresso2_info['results']['general_plots']['summary_plot_datas'] + heatmap_plot_names = [] + if 'heatmap_plot_names' in crispresso2_info['results']['general_plots']: + heatmap_plot_names = crispresso2_info['results']['general_plots']['heatmap_plot_names'] + heatmap_plot_paths = {} + if 'heatmap_plot_paths' in crispresso2_info['results']['general_plots']: + heatmap_plot_paths = crispresso2_info['results']['general_plots']['heatmap_plot_paths'] + heatmap_plot_titles = {} + if 'heatmap_plot_titles' in crispresso2_info['results']['general_plots']: + heatmap_plot_titles = crispresso2_info['results']['general_plots']['heatmap_plot_titles'] + heatmap_plot_labels = {} + if 'heatmap_plot_labels' in crispresso2_info['results']['general_plots']: + heatmap_plot_labels = crispresso2_info['results']['general_plots']['heatmap_plot_labels'] + heatmap_plot_datas = {} + if 'heatmap_plot_datas' in crispresso2_info['results']['general_plots']: + heatmap_plot_datas = crispresso2_info['results']['general_plots']['heatmap_plot_datas'] window_nuc_pct_quilts = [] if 'window_nuc_pct_quilt_plot_names' in crispresso2_info['results']['general_plots']: @@ -400,9 +461,28 @@ def make_aggregate_report(crispresso2_info,report_name,crispresso_report_file,cr old_img = compact_plots_to_show[compact_plot]['img'] compact_plots_to_show[compact_plot]['img'] = os.path.relpath(old_img, crispresso_report_folder) - make_multi_report(run_names, sub_html_files, crispresso_report_file, crispresso_report_folder, _ROOT, report_name, - window_nuc_pct_quilts=window_nuc_pct_quilts, - nuc_pct_quilts=nuc_pct_quilts, - summary_plot_names=summary_plot_names, summary_plot_titles=summary_plot_titles, - summary_plot_labels=summary_plot_labels, summary_plot_datas=summary_plot_datas, - compact_plots_to_show=compact_plots_to_show) + heatmap_plot_htmls = {} + for heatmap_plot_name, heatmap_plot_path in heatmap_plot_paths.items(): + with open(heatmap_plot_path) as fh: + heatmap_plot_htmls[heatmap_plot_name] = fh.read() + + make_multi_report( + run_names, + sub_html_files, + crispresso_report_file, + crispresso_report_folder, + _ROOT, + report_name, + window_nuc_pct_quilts=window_nuc_pct_quilts, + nuc_pct_quilts=nuc_pct_quilts, + summary_plot_names=summary_plot_names, + summary_plot_titles=summary_plot_titles, + summary_plot_labels=summary_plot_labels, + summary_plot_datas=summary_plot_datas, + compact_plots_to_show=compact_plots_to_show, + heatmap_plot_names=heatmap_plot_names, + heatmap_plot_htmls=heatmap_plot_htmls, + heatmap_plot_titles=heatmap_plot_titles, + heatmap_plot_labels=heatmap_plot_labels, + heatmap_plot_datas=heatmap_plot_datas, + ) diff --git a/CRISPResso2/templates/multiReport.html b/CRISPResso2/templates/multiReport.html index b1794fcd..742aa983 100644 --- a/CRISPResso2/templates/multiReport.html +++ b/CRISPResso2/templates/multiReport.html @@ -154,6 +154,23 @@
{{summary_plot_titles[plot_name]}}
{% endfor %} {% endif %} + {% if heatmap_plot_names|length > 0 %} + {% for plot_name in heatmap_plot_names %} +
+
+
{{heatmap_plot_titles[plot_name]}}
+
+
+ {{heatmap_plot_htmls[plot_name]}} + + {% for (data_label, data_path) in heatmap_plot_datas[plot_name] %} +

Data: {{data_label}}

+ {% endfor %} +
+
+ {% endfor %} + {% endif %} + {% if compact_plots_to_show|length > 0 %}
From 78293879ca5dcec128665e1b7e1d2e74ec8c5370 Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Fri, 28 Jan 2022 14:24:21 -0700 Subject: [PATCH 12/61] Update Bootstrap to 5.1.3 This is mainly so that we can use the fullscreen modal functionality in this version. --- CRISPResso2/templates/layout.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CRISPResso2/templates/layout.html b/CRISPResso2/templates/layout.html index d7f7643b..341d2d79 100644 --- a/CRISPResso2/templates/layout.html +++ b/CRISPResso2/templates/layout.html @@ -7,12 +7,9 @@ - - + - - --> + {% endif %} {% if compact_plots_to_show|length > 0 %} From ec6e57096c988c331a0aff709cb1920488bd3c09 Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Fri, 18 Mar 2022 14:05:04 -0600 Subject: [PATCH 17/61] Rename and refactor how plot data is passed around I have consolidated how the plot data is passed around, so that now you can pass in only one dict with all of the information instead of 4 or 5 separate parameters. I also renamed the `heatmap_plot_*` to `allele_modification_heatmap_*`. --- CRISPResso2/CRISPRessoAggregateCORE.py | 20 ++-- CRISPResso2/CRISPRessoReport.py | 123 ++++++++++++------------- CRISPResso2/templates/multiReport.html | 14 +-- 3 files changed, 78 insertions(+), 79 deletions(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index bd6d9776..10c10de8 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -531,11 +531,11 @@ def main(): this_plot_suffix = "_" + str(this_plot_suffix_int) if not args.suppress_plots: - crispresso2_info['results']['general_plots']['heatmap_plot_names'] = [] - crispresso2_info['results']['general_plots']['heatmap_plot_paths'] = {} - crispresso2_info['results']['general_plots']['heatmap_plot_titles'] = {} - crispresso2_info['results']['general_plots']['heatmap_plot_labels'] = {} - crispresso2_info['results']['general_plots']['heatmap_plot_datas'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_names'] = [] + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_paths'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_titles'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_labels'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_datas'] = {} if guides_all_same: sgRNA_intervals = [consensus_sgRNA_intervals] * modification_frequency_summary_df.shape[0] else: @@ -556,14 +556,14 @@ def main(): plot_path, modification_type, ) - crispresso2_info['results']['general_plots']['heatmap_plot_names'].append(plot_name) - crispresso2_info['results']['general_plots']['heatmap_plot_paths'][plot_name] = plot_path - crispresso2_info['results']['general_plots']['heatmap_plot_titles'][plot_name] = 'CRISPRessoAggregate {0} Across Alleles for {1}'.format( + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_names'].append(plot_name) + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_paths'][plot_name] = plot_path + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_titles'][plot_name] = 'CRISPRessoAggregate {0} Across Alleles for {1}'.format( modification_type, amplicon_name, ) - crispresso2_info['results']['general_plots']['heatmap_plot_labels'][plot_name] = 'Each row is an allele and each column is a position in the amplicon sequence. Each cell shows the percentage of {0} for the allele at that position relative to the amplicon. Guides for each sample are identified by a black rectangle.'.format(modification_type.lower()) - crispresso2_info['results']['general_plots']['heatmap_plot_datas'][plot_name] = [ + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_labels'][plot_name] = 'Each row is an allele and each column is a position in the amplicon sequence. Each cell shows the percentage of {0} for the allele at that position relative to the amplicon. Guides for each sample are identified by a black rectangle.'.format(modification_type.lower()) + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_datas'][plot_name] = [ ( 'CRISPRessoAggregate Modification Frequency Summary', os.path.basename( diff --git a/CRISPResso2/CRISPRessoReport.py b/CRISPResso2/CRISPRessoReport.py index 826d7097..fc003717 100644 --- a/CRISPResso2/CRISPRessoReport.py +++ b/CRISPResso2/CRISPRessoReport.py @@ -307,16 +307,9 @@ def make_multi_report( nuc_pct_quilts=[], window_nuc_conv_plots=[], nuc_conv_plots=[], - summary_plot_names=[], - summary_plot_titles={}, - summary_plot_labels={}, - summary_plot_datas={}, + summary_plot={}, compact_plots_to_show={}, - heatmap_plot_names={}, - heatmap_plot_htmls={}, - heatmap_plot_titles={}, - heatmap_plot_labels={}, - heatmap_plot_datas={}, + allele_modification_heatmap_plot={}, ): """ Makes an HTML report for a run containing multiple crispresso runs @@ -329,16 +322,18 @@ def make_multi_report( crispresso_folder (string): absolute path to the crispresso output _ROOT (string): absolute path to the crispresso executable - summary_plot_names (list): list of plot names - keys for following dicts - summary_plot_titles (dict): dict of plot_name->plot_title - summary_plot_labels (dict): dict of plot_name->plot_label - summary_plot_datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] + summary_plot (dict): a dict with the following keys: + names (list): list of plot names - keys for following dicts + titles (dict): dict of plot_name->plot_title + labels (dict): dict of plot_name->plot_label + datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show} - heatmap_plot_names (list): list of plot names for heatmaps, keys for dicts below - heatmap_plot_htmls (dict): dict of plot_name->HTML for the plot - heatmap_plot_titles (dict): dict of plot_name->plot_title - heatmap_plot_labels (dict): dict of plot_name->plot_label - heatmap_plot_datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] + allele_modification_heatmap_plot (dict): a dict with the following keys: + names (list): list of plot names for heatmaps, keys for dicts below + htmls (dict): dict of plot_name->HTML for the plot + titles (dict): dict of plot_name->plot_title + labels (dict): dict of plot_name->plot_label + datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] """ def dirname(path): @@ -364,19 +359,19 @@ def dirname(path): window_nuc_conv_plots=window_nuc_conv_plots, nuc_conv_plots=nuc_conv_plots, crispresso_data_path=crispresso_data_path, - summary_plot_names=summary_plot_names, - summary_plot_titles=summary_plot_titles, - summary_plot_labels=summary_plot_labels, - summary_plot_datas=summary_plot_datas, + summary_plot_names=summary_plot['names'], + summary_plot_titles=summary_plot['titles'], + summary_plot_labels=summary_plot['labels'], + summary_plot_datas=summary_plot['datas'], run_names=run_names, sub_html_files=sub_html_files, report_name=report_name, compact_plots_to_show=compact_plots_to_show, - heatmap_plot_names=heatmap_plot_names, - heatmap_plot_htmls=heatmap_plot_htmls, - heatmap_plot_titles=heatmap_plot_titles, - heatmap_plot_labels=heatmap_plot_labels, - heatmap_plot_datas=heatmap_plot_datas, + allele_modification_heatmap_plot_names=allele_modification_heatmap_plot['names'], + allele_modification_heatmap_plot_htmls=allele_modification_heatmap_plot['htmls'], + allele_modification_heatmap_plot_titles=allele_modification_heatmap_plot['titles'], + allele_modification_heatmap_plot_labels=allele_modification_heatmap_plot['labels'], + allele_modification_heatmap_plot_datas=allele_modification_heatmap_plot['datas'], )) @@ -408,33 +403,44 @@ def make_aggregate_report( Returns: Nothin """ - summary_plot_names = [] + summary_plot = {} if 'summary_plot_names' in crispresso2_info['results']['general_plots']: - summary_plot_names = crispresso2_info['results']['general_plots']['summary_plot_names'] - summary_plot_titles = {} + summary_plot['names'] = crispresso2_info['results']['general_plots']['summary_plot_names'] + else: + summary_plot['names'] = [] if 'summary_plot_titles' in crispresso2_info['results']['general_plots']: - summary_plot_titles = crispresso2_info['results']['general_plots']['summary_plot_titles'] - summary_plot_labels = {} + summary_plot['titles'] = crispresso2_info['results']['general_plots']['summary_plot_titles'] + else: + summary_plot['titles'] = {} if 'summary_plot_labels' in crispresso2_info['results']['general_plots']: - summary_plot_labels = crispresso2_info['results']['general_plots']['summary_plot_labels'] - summary_plot_datas = {} + summary_plot['labels'] = crispresso2_info['results']['general_plots']['summary_plot_labels'] + else: + summary_plot['labels'] = {} if 'summary_plot_datas' in crispresso2_info['results']['general_plots']: - summary_plot_datas = crispresso2_info['results']['general_plots']['summary_plot_datas'] - heatmap_plot_names = [] - if 'heatmap_plot_names' in crispresso2_info['results']['general_plots']: - heatmap_plot_names = crispresso2_info['results']['general_plots']['heatmap_plot_names'] - heatmap_plot_paths = {} - if 'heatmap_plot_paths' in crispresso2_info['results']['general_plots']: - heatmap_plot_paths = crispresso2_info['results']['general_plots']['heatmap_plot_paths'] - heatmap_plot_titles = {} - if 'heatmap_plot_titles' in crispresso2_info['results']['general_plots']: - heatmap_plot_titles = crispresso2_info['results']['general_plots']['heatmap_plot_titles'] - heatmap_plot_labels = {} - if 'heatmap_plot_labels' in crispresso2_info['results']['general_plots']: - heatmap_plot_labels = crispresso2_info['results']['general_plots']['heatmap_plot_labels'] - heatmap_plot_datas = {} - if 'heatmap_plot_datas' in crispresso2_info['results']['general_plots']: - heatmap_plot_datas = crispresso2_info['results']['general_plots']['heatmap_plot_datas'] + summary_plot['datas'] = crispresso2_info['results']['general_plots']['summary_plot_datas'] + else: + summary_plot['datas'] = {} + allele_modification_heatmap_plot = {} + if 'allele_modification_heatmap_plot_names' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['names'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_names'] + else: + allele_modification_heatmap_plot['names'] = [] + if 'allele_modification_heatmap_plot_paths' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['paths'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_paths'] + else: + allele_modification_heatmap_plot['paths'] = {} + if 'allele_modification_heatmap_plot_titles' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['titles'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_titles'] + else: + allele_modification_heatmap_plot['titles'] = {} + if 'allele_modification_heatmap_plot_labels' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['labels'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_labels'] + else: + allele_modification_heatmap_plot['labels'] = {} + if 'allele_modification_heatmap_plot_datas' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['datas'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_datas'] + else: + allele_modification_heatmap_plot['datas'] = {} window_nuc_pct_quilts = [] if 'window_nuc_pct_quilt_plot_names' in crispresso2_info['results']['general_plots']: @@ -461,10 +467,10 @@ def make_aggregate_report( old_img = compact_plots_to_show[compact_plot]['img'] compact_plots_to_show[compact_plot]['img'] = os.path.relpath(old_img, crispresso_report_folder) - heatmap_plot_htmls = {} - for heatmap_plot_name, heatmap_plot_path in heatmap_plot_paths.items(): + allele_modification_heatmap_plot['htmls'] = {} + for heatmap_plot_name, heatmap_plot_path in allele_modification_heatmap_plot['paths'].items(): with open(heatmap_plot_path) as fh: - heatmap_plot_htmls[heatmap_plot_name] = fh.read() + allele_modification_heatmap_plot['htmls'][heatmap_plot_name] = fh.read() make_multi_report( run_names, @@ -475,14 +481,7 @@ def make_aggregate_report( report_name, window_nuc_pct_quilts=window_nuc_pct_quilts, nuc_pct_quilts=nuc_pct_quilts, - summary_plot_names=summary_plot_names, - summary_plot_titles=summary_plot_titles, - summary_plot_labels=summary_plot_labels, - summary_plot_datas=summary_plot_datas, + summary_plot=summary_plot, compact_plots_to_show=compact_plots_to_show, - heatmap_plot_names=heatmap_plot_names, - heatmap_plot_htmls=heatmap_plot_htmls, - heatmap_plot_titles=heatmap_plot_titles, - heatmap_plot_labels=heatmap_plot_labels, - heatmap_plot_datas=heatmap_plot_datas, + allele_modification_heatmap_plot=allele_modification_heatmap_plot, ) diff --git a/CRISPResso2/templates/multiReport.html b/CRISPResso2/templates/multiReport.html index f320936f..f614d406 100644 --- a/CRISPResso2/templates/multiReport.html +++ b/CRISPResso2/templates/multiReport.html @@ -154,23 +154,23 @@
{{summary_plot_titles[plot_name]}}
{% endfor %} {% endif %} - {% if heatmap_plot_names|length > 0 %} - {% for plot_name in heatmap_plot_names %} + {% if allele_modification_heatmap_plot_names|length > 0 %} + {% for plot_name in allele_modification_heatmap_plot_names %}
-
{{heatmap_plot_titles[plot_name]}}
+
{{allele_modification_heatmap_plot_titles[plot_name]}}
- {{heatmap_plot_htmls[plot_name]}} - - {% for (data_label, data_path) in heatmap_plot_datas[plot_name] %} + {{allele_modification_heatmap_plot_htmls[plot_name]}} + + {% for (data_label, data_path) in allele_modification_heatmap_plot_datas[plot_name] %}

Data: {{data_label}}

{% endfor %}
{% endfor %} + - - --> + {% endif %} {% if compact_plots_to_show|length > 0 %} From f0d424d1231d9836b8a842938c870fdca98cf714 Mon Sep 17 00:00:00 2001 From: Cole Lyman Date: Fri, 18 Mar 2022 14:05:04 -0600 Subject: [PATCH 38/61] Rename and refactor how plot data is passed around I have consolidated how the plot data is passed around, so that now you can pass in only one dict with all of the information instead of 4 or 5 separate parameters. I also renamed the `heatmap_plot_*` to `allele_modification_heatmap_*`. --- CRISPResso2/CRISPRessoAggregateCORE.py | 20 ++-- CRISPResso2/CRISPRessoReport.py | 123 ++++++++++++------------- CRISPResso2/templates/multiReport.html | 14 +-- 3 files changed, 78 insertions(+), 79 deletions(-) diff --git a/CRISPResso2/CRISPRessoAggregateCORE.py b/CRISPResso2/CRISPRessoAggregateCORE.py index bd6d9776..10c10de8 100644 --- a/CRISPResso2/CRISPRessoAggregateCORE.py +++ b/CRISPResso2/CRISPRessoAggregateCORE.py @@ -531,11 +531,11 @@ def main(): this_plot_suffix = "_" + str(this_plot_suffix_int) if not args.suppress_plots: - crispresso2_info['results']['general_plots']['heatmap_plot_names'] = [] - crispresso2_info['results']['general_plots']['heatmap_plot_paths'] = {} - crispresso2_info['results']['general_plots']['heatmap_plot_titles'] = {} - crispresso2_info['results']['general_plots']['heatmap_plot_labels'] = {} - crispresso2_info['results']['general_plots']['heatmap_plot_datas'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_names'] = [] + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_paths'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_titles'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_labels'] = {} + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_datas'] = {} if guides_all_same: sgRNA_intervals = [consensus_sgRNA_intervals] * modification_frequency_summary_df.shape[0] else: @@ -556,14 +556,14 @@ def main(): plot_path, modification_type, ) - crispresso2_info['results']['general_plots']['heatmap_plot_names'].append(plot_name) - crispresso2_info['results']['general_plots']['heatmap_plot_paths'][plot_name] = plot_path - crispresso2_info['results']['general_plots']['heatmap_plot_titles'][plot_name] = 'CRISPRessoAggregate {0} Across Alleles for {1}'.format( + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_names'].append(plot_name) + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_paths'][plot_name] = plot_path + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_titles'][plot_name] = 'CRISPRessoAggregate {0} Across Alleles for {1}'.format( modification_type, amplicon_name, ) - crispresso2_info['results']['general_plots']['heatmap_plot_labels'][plot_name] = 'Each row is an allele and each column is a position in the amplicon sequence. Each cell shows the percentage of {0} for the allele at that position relative to the amplicon. Guides for each sample are identified by a black rectangle.'.format(modification_type.lower()) - crispresso2_info['results']['general_plots']['heatmap_plot_datas'][plot_name] = [ + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_labels'][plot_name] = 'Each row is an allele and each column is a position in the amplicon sequence. Each cell shows the percentage of {0} for the allele at that position relative to the amplicon. Guides for each sample are identified by a black rectangle.'.format(modification_type.lower()) + crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_datas'][plot_name] = [ ( 'CRISPRessoAggregate Modification Frequency Summary', os.path.basename( diff --git a/CRISPResso2/CRISPRessoReport.py b/CRISPResso2/CRISPRessoReport.py index 826d7097..fc003717 100644 --- a/CRISPResso2/CRISPRessoReport.py +++ b/CRISPResso2/CRISPRessoReport.py @@ -307,16 +307,9 @@ def make_multi_report( nuc_pct_quilts=[], window_nuc_conv_plots=[], nuc_conv_plots=[], - summary_plot_names=[], - summary_plot_titles={}, - summary_plot_labels={}, - summary_plot_datas={}, + summary_plot={}, compact_plots_to_show={}, - heatmap_plot_names={}, - heatmap_plot_htmls={}, - heatmap_plot_titles={}, - heatmap_plot_labels={}, - heatmap_plot_datas={}, + allele_modification_heatmap_plot={}, ): """ Makes an HTML report for a run containing multiple crispresso runs @@ -329,16 +322,18 @@ def make_multi_report( crispresso_folder (string): absolute path to the crispresso output _ROOT (string): absolute path to the crispresso executable - summary_plot_names (list): list of plot names - keys for following dicts - summary_plot_titles (dict): dict of plot_name->plot_title - summary_plot_labels (dict): dict of plot_name->plot_label - summary_plot_datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] + summary_plot (dict): a dict with the following keys: + names (list): list of plot names - keys for following dicts + titles (dict): dict of plot_name->plot_title + labels (dict): dict of plot_name->plot_label + datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show} - heatmap_plot_names (list): list of plot names for heatmaps, keys for dicts below - heatmap_plot_htmls (dict): dict of plot_name->HTML for the plot - heatmap_plot_titles (dict): dict of plot_name->plot_title - heatmap_plot_labels (dict): dict of plot_name->plot_label - heatmap_plot_datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] + allele_modification_heatmap_plot (dict): a dict with the following keys: + names (list): list of plot names for heatmaps, keys for dicts below + htmls (dict): dict of plot_name->HTML for the plot + titles (dict): dict of plot_name->plot_title + labels (dict): dict of plot_name->plot_label + datas (dict): dict of plot_name->[(datafile_description, data_filename), ...] """ def dirname(path): @@ -364,19 +359,19 @@ def dirname(path): window_nuc_conv_plots=window_nuc_conv_plots, nuc_conv_plots=nuc_conv_plots, crispresso_data_path=crispresso_data_path, - summary_plot_names=summary_plot_names, - summary_plot_titles=summary_plot_titles, - summary_plot_labels=summary_plot_labels, - summary_plot_datas=summary_plot_datas, + summary_plot_names=summary_plot['names'], + summary_plot_titles=summary_plot['titles'], + summary_plot_labels=summary_plot['labels'], + summary_plot_datas=summary_plot['datas'], run_names=run_names, sub_html_files=sub_html_files, report_name=report_name, compact_plots_to_show=compact_plots_to_show, - heatmap_plot_names=heatmap_plot_names, - heatmap_plot_htmls=heatmap_plot_htmls, - heatmap_plot_titles=heatmap_plot_titles, - heatmap_plot_labels=heatmap_plot_labels, - heatmap_plot_datas=heatmap_plot_datas, + allele_modification_heatmap_plot_names=allele_modification_heatmap_plot['names'], + allele_modification_heatmap_plot_htmls=allele_modification_heatmap_plot['htmls'], + allele_modification_heatmap_plot_titles=allele_modification_heatmap_plot['titles'], + allele_modification_heatmap_plot_labels=allele_modification_heatmap_plot['labels'], + allele_modification_heatmap_plot_datas=allele_modification_heatmap_plot['datas'], )) @@ -408,33 +403,44 @@ def make_aggregate_report( Returns: Nothin """ - summary_plot_names = [] + summary_plot = {} if 'summary_plot_names' in crispresso2_info['results']['general_plots']: - summary_plot_names = crispresso2_info['results']['general_plots']['summary_plot_names'] - summary_plot_titles = {} + summary_plot['names'] = crispresso2_info['results']['general_plots']['summary_plot_names'] + else: + summary_plot['names'] = [] if 'summary_plot_titles' in crispresso2_info['results']['general_plots']: - summary_plot_titles = crispresso2_info['results']['general_plots']['summary_plot_titles'] - summary_plot_labels = {} + summary_plot['titles'] = crispresso2_info['results']['general_plots']['summary_plot_titles'] + else: + summary_plot['titles'] = {} if 'summary_plot_labels' in crispresso2_info['results']['general_plots']: - summary_plot_labels = crispresso2_info['results']['general_plots']['summary_plot_labels'] - summary_plot_datas = {} + summary_plot['labels'] = crispresso2_info['results']['general_plots']['summary_plot_labels'] + else: + summary_plot['labels'] = {} if 'summary_plot_datas' in crispresso2_info['results']['general_plots']: - summary_plot_datas = crispresso2_info['results']['general_plots']['summary_plot_datas'] - heatmap_plot_names = [] - if 'heatmap_plot_names' in crispresso2_info['results']['general_plots']: - heatmap_plot_names = crispresso2_info['results']['general_plots']['heatmap_plot_names'] - heatmap_plot_paths = {} - if 'heatmap_plot_paths' in crispresso2_info['results']['general_plots']: - heatmap_plot_paths = crispresso2_info['results']['general_plots']['heatmap_plot_paths'] - heatmap_plot_titles = {} - if 'heatmap_plot_titles' in crispresso2_info['results']['general_plots']: - heatmap_plot_titles = crispresso2_info['results']['general_plots']['heatmap_plot_titles'] - heatmap_plot_labels = {} - if 'heatmap_plot_labels' in crispresso2_info['results']['general_plots']: - heatmap_plot_labels = crispresso2_info['results']['general_plots']['heatmap_plot_labels'] - heatmap_plot_datas = {} - if 'heatmap_plot_datas' in crispresso2_info['results']['general_plots']: - heatmap_plot_datas = crispresso2_info['results']['general_plots']['heatmap_plot_datas'] + summary_plot['datas'] = crispresso2_info['results']['general_plots']['summary_plot_datas'] + else: + summary_plot['datas'] = {} + allele_modification_heatmap_plot = {} + if 'allele_modification_heatmap_plot_names' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['names'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_names'] + else: + allele_modification_heatmap_plot['names'] = [] + if 'allele_modification_heatmap_plot_paths' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['paths'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_paths'] + else: + allele_modification_heatmap_plot['paths'] = {} + if 'allele_modification_heatmap_plot_titles' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['titles'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_titles'] + else: + allele_modification_heatmap_plot['titles'] = {} + if 'allele_modification_heatmap_plot_labels' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['labels'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_labels'] + else: + allele_modification_heatmap_plot['labels'] = {} + if 'allele_modification_heatmap_plot_datas' in crispresso2_info['results']['general_plots']: + allele_modification_heatmap_plot['datas'] = crispresso2_info['results']['general_plots']['allele_modification_heatmap_plot_datas'] + else: + allele_modification_heatmap_plot['datas'] = {} window_nuc_pct_quilts = [] if 'window_nuc_pct_quilt_plot_names' in crispresso2_info['results']['general_plots']: @@ -461,10 +467,10 @@ def make_aggregate_report( old_img = compact_plots_to_show[compact_plot]['img'] compact_plots_to_show[compact_plot]['img'] = os.path.relpath(old_img, crispresso_report_folder) - heatmap_plot_htmls = {} - for heatmap_plot_name, heatmap_plot_path in heatmap_plot_paths.items(): + allele_modification_heatmap_plot['htmls'] = {} + for heatmap_plot_name, heatmap_plot_path in allele_modification_heatmap_plot['paths'].items(): with open(heatmap_plot_path) as fh: - heatmap_plot_htmls[heatmap_plot_name] = fh.read() + allele_modification_heatmap_plot['htmls'][heatmap_plot_name] = fh.read() make_multi_report( run_names, @@ -475,14 +481,7 @@ def make_aggregate_report( report_name, window_nuc_pct_quilts=window_nuc_pct_quilts, nuc_pct_quilts=nuc_pct_quilts, - summary_plot_names=summary_plot_names, - summary_plot_titles=summary_plot_titles, - summary_plot_labels=summary_plot_labels, - summary_plot_datas=summary_plot_datas, + summary_plot=summary_plot, compact_plots_to_show=compact_plots_to_show, - heatmap_plot_names=heatmap_plot_names, - heatmap_plot_htmls=heatmap_plot_htmls, - heatmap_plot_titles=heatmap_plot_titles, - heatmap_plot_labels=heatmap_plot_labels, - heatmap_plot_datas=heatmap_plot_datas, + allele_modification_heatmap_plot=allele_modification_heatmap_plot, ) diff --git a/CRISPResso2/templates/multiReport.html b/CRISPResso2/templates/multiReport.html index f320936f..f614d406 100644 --- a/CRISPResso2/templates/multiReport.html +++ b/CRISPResso2/templates/multiReport.html @@ -154,23 +154,23 @@
{{summary_plot_titles[plot_name]}}
{% endfor %} {% endif %} - {% if heatmap_plot_names|length > 0 %} - {% for plot_name in heatmap_plot_names %} + {% if allele_modification_heatmap_plot_names|length > 0 %} + {% for plot_name in allele_modification_heatmap_plot_names %}
-
{{heatmap_plot_titles[plot_name]}}
+
{{allele_modification_heatmap_plot_titles[plot_name]}}
- {{heatmap_plot_htmls[plot_name]}} - - {% for (data_label, data_path) in heatmap_plot_datas[plot_name] %} + {{allele_modification_heatmap_plot_htmls[plot_name]}} + + {% for (data_label, data_path) in allele_modification_heatmap_plot_datas[plot_name] %}

Data: {{data_label}}

{% endfor %}
{% endfor %}