From e560c4296bd8377740f6d8367143f54e71514df6 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Fri, 15 Jan 2010 10:56:51 +0000 Subject: [PATCH] Add a new script to assemble amplicon from solexa pair-end run --- src/obitools/align/__init__.py | 5 +- src/obitools/align/_assemble.c | 743 ++-- src/obitools/align/_assemble.pxd | 10 + src/obitools/align/_assemble.pyx | 52 +- src/obitools/align/_dynamic.c | 1434 +++++--- src/obitools/align/_dynamic.pxd | 21 +- src/obitools/align/_dynamic.pyx | 62 +- src/obitools/align/_lcs.c | 346 +- src/obitools/align/_lcs.pyx | 16 +- src/obitools/align/_nws.c | 386 +- src/obitools/align/_nws.pxd | 3 + src/obitools/align/_nws.pyx | 17 +- src/obitools/align/_qsassemble.c | 2969 ++++++++++++++++ src/obitools/align/_qsassemble.pyx | 83 + src/obitools/align/_qsrassemble.c | 2969 ++++++++++++++++ src/obitools/align/_rassemble.c | 3141 +++++++++++++++++ src/obitools/align/_rassemble.pxd | 10 + src/obitools/align/_rassemble.pyx | 157 + src/obitools/fastq/__init__.py | 209 ++ src/obitools/fastq/_fastq.c | 2915 +++++++++++++++ src/obitools/fastq/_fastq.pyx | 156 + src/obitools/format/genericparser/__init__.py | 24 +- src/obitools/location/__init__.py | 22 + src/obitools/word/_binary.c | 124 +- src/solexaPairEnd.py | 264 ++ 25 files changed, 14802 insertions(+), 1336 deletions(-) create mode 100644 src/obitools/align/_assemble.pxd create mode 100644 src/obitools/align/_qsassemble.c create mode 100644 src/obitools/align/_qsassemble.pyx create mode 100644 src/obitools/align/_qsrassemble.c create mode 100644 src/obitools/align/_rassemble.c create mode 100644 src/obitools/align/_rassemble.pxd create mode 100644 src/obitools/align/_rassemble.pyx create mode 100644 src/obitools/fastq/__init__.py create mode 100644 src/obitools/fastq/_fastq.c create mode 100644 src/obitools/fastq/_fastq.pyx create mode 100644 src/solexaPairEnd.py diff --git a/src/obitools/align/__init__.py b/src/obitools/align/__init__.py index b23c3d3..9beb152 100644 --- a/src/obitools/align/__init__.py +++ b/src/obitools/align/__init__.py @@ -3,4 +3,7 @@ from _nws import NWS from _lcs import LCS from _assemble import DirectAssemble, ReverseAssemble - +from _qsassemble import QSolexaDirectAssemble,QSolexaReverseAssemble +from _rassemble import RightDirectAssemble as RightReverseAssemble +from _qsrassemble import QSolexaRightDirectAssemble,QSolexaRightReverseAssemble + diff --git a/src/obitools/align/_assemble.c b/src/obitools/align/_assemble.c index 84ce3ce..2d1954a 100644 --- a/src/obitools/align/_assemble.c +++ b/src/obitools/align/_assemble.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Mon Dec 7 11:32:52 2009 */ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:10 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -337,6 +337,11 @@ static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ @@ -425,7 +430,36 @@ struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence { struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *seq; }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":47 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":42 + * cdef void freeSequence(alignSequence* seq) + * + * cdef struct alignPath: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignPath { + long length; + long buffsize; + long vStart; + long hStart; + long *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":49 + * long *path + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) * * cdef class DynamicProgramming: # <<<<<<<<<<<<<< @@ -441,6 +475,7 @@ struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming { PyObject *verticalSeq; struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *hSeq; struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *vSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; double _opengap; double _extgap; PyObject *alignment; @@ -462,26 +497,17 @@ struct __pyx_obj_8obitools_5align_4_nws_NWS { double _mismatch; }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":11 - * - * - * cdef class DirectAssemble(NWS): # <<<<<<<<<<<<<< - * - * cdef double ysmax - */ - struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble { struct __pyx_obj_8obitools_5align_4_nws_NWS __pyx_base; double ysmax; int ymax; }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":144 - * +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pxd":9 + * cdef double doAlignment(self) except? 0 * * cdef class ReverseAssemble(DirectAssemble): # <<<<<<<<<<<<<< - * - * property seqB: + * pass */ struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble { @@ -489,7 +515,7 @@ struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble { }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":47 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) * * cdef class DynamicProgramming: # <<<<<<<<<<<<<< @@ -502,7 +528,9 @@ struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming { double (*matchScore)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); double (*doAlignment)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); void (*reset)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); - int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, PyObject *, PyObject *); + int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + int (*_needToCompute)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*backtrack)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); }; static struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming; @@ -526,7 +554,7 @@ static struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *__pyx_vtabptr_8obitoo * * cdef class DirectAssemble(NWS): # <<<<<<<<<<<<<< * - * cdef double ysmax + * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): */ struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble { @@ -535,7 +563,7 @@ struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble { static struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *__pyx_vtabptr_8obitools_5align_9_assemble_DirectAssemble; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":144 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":160 * * * cdef class ReverseAssemble(DirectAssemble): # <<<<<<<<<<<<<< @@ -555,6 +583,9 @@ static void (*__pyx_f_8obitools_5align_8_dynamic_freeMatrix)(struct __pyx_t_8obi static void (*__pyx_f_8obitools_5align_8_dynamic_resetMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(*__pyx_f_8obitools_5align_8_dynamic_allocateSequence)(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args); /*proto*/ static void (*__pyx_f_8obitools_5align_8_dynamic_freeSequence)(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(*__pyx_f_8obitools_5align_8_dynamic_allocatePath)(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_reversePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ static int (*__pyx_f_8obitools_5align_8_dynamic_bitCount)(int); /*proto*/ static int (*__pyx_f_8obitools_5align_8_dynamic_iupacMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ static double (*__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ @@ -574,13 +605,10 @@ static PyObject *__pyx_int_neg_6; static PyObject *__pyx_int_neg_8; static PyObject *__pyx_int_neg_2; static PyObject *__pyx_int_1; -static PyObject *__pyx_int_0; static char __pyx_k___main__[] = "__main__"; static PyObject *__pyx_kp___main__; static char __pyx_k___init__[] = "__init__"; static PyObject *__pyx_kp___init__; -static char __pyx_k_backtrack[] = "backtrack"; -static PyObject *__pyx_kp_backtrack; static char __pyx_k_match[] = "match"; static PyObject *__pyx_kp_match; static char __pyx_k_mismatch[] = "mismatch"; @@ -601,9 +629,9 @@ static char __pyx_k_complement[] = "complement"; static PyObject *__pyx_kp_complement; static PyObject *__pyx_builtin_range; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":15 - * cdef double ysmax - * cdef int ymax +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":13 + * cdef class DirectAssemble(NWS): + * * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): # <<<<<<<<<<<<<< * NWS.__init__(self,match,mismatch,opengap,extgap) * self.ysmax=0 @@ -659,7 +687,7 @@ static int __pyx_pf_8obitools_5align_9_assemble_14DirectAssemble___init__(PyObje } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_match = values[0]; __pyx_v_mismatch = values[1]; @@ -681,22 +709,22 @@ static int __pyx_pf_8obitools_5align_9_assemble_14DirectAssemble___init__(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("obitools.align._assemble.DirectAssemble.__init__"); return -1; __pyx_L4_argument_unpacking_done:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":16 - * cdef int ymax + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":14 + * * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): * NWS.__init__(self,match,mismatch,opengap,extgap) # <<<<<<<<<<<<<< * self.ysmax=0 * self.ymax=0 */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8obitools_5align_4_nws_NWS)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8obitools_5align_4_nws_NWS)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); @@ -713,13 +741,13 @@ static int __pyx_pf_8obitools_5align_9_assemble_14DirectAssemble___init__(PyObje __Pyx_INCREF(__pyx_v_extgap); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_extgap); __Pyx_GIVEREF(__pyx_v_extgap); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":17 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":15 * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): * NWS.__init__(self,match,mismatch,opengap,extgap) * self.ysmax=0 # <<<<<<<<<<<<<< @@ -728,12 +756,12 @@ static int __pyx_pf_8obitools_5align_9_assemble_14DirectAssemble___init__(PyObje */ ((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->ysmax = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":18 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":16 * NWS.__init__(self,match,mismatch,opengap,extgap) * self.ysmax=0 * self.ymax=0 # <<<<<<<<<<<<<< * - * cdef double matchScore(self,int h, int v): + * cdef double doAlignment(self) except? 0: */ ((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->ymax = 0; @@ -750,37 +778,9 @@ static int __pyx_pf_8obitools_5align_9_assemble_14DirectAssemble___init__(PyObje return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":20 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":18 * self.ymax=0 * - * cdef double matchScore(self,int h, int v): # <<<<<<<<<<<<<< - * return iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) - * - */ - -static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_matchScore(struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *__pyx_v_self, int __pyx_v_h, int __pyx_v_v) { - double __pyx_r; - __Pyx_SetupRefcountContext("matchScore"); - - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":21 - * - * cdef double matchScore(self,int h, int v): - * return iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) # <<<<<<<<<<<<<< - * - * cdef double doAlignment(self) except? 0: - */ - __pyx_r = __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch((__pyx_v_self->__pyx_base.__pyx_base.hSeq->sequence[(__pyx_v_h - 1)]), (__pyx_v_self->__pyx_base.__pyx_base.vSeq->sequence[(__pyx_v_v - 1)]), 0); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_FinishRefcountContext(); - return __pyx_r; -} - -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":23 - * return iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) - * * cdef double doAlignment(self) except? 0: # <<<<<<<<<<<<<< * cdef int i # vertical index * cdef int j # horizontal index @@ -790,6 +790,8 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( int __pyx_v_i; int __pyx_v_j; int __pyx_v_idx; + int __pyx_v_idx0; + int __pyx_v_idx1; int __pyx_v_jump; int __pyx_v_delta; double __pyx_v_score; @@ -800,42 +802,59 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; __Pyx_SetupRefcountContext("doAlignment"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":34 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":31 * * * if self.needToCompute: # <<<<<<<<<<<<<< * self.allocate() * self.reset() */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_needToCompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_needToCompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":35 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":32 * * if self.needToCompute: * self.allocate() # <<<<<<<<<<<<<< * self.reset() - * + * self.ysmax=0 */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.allocate(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.allocate(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":36 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":33 * if self.needToCompute: * self.allocate() * self.reset() # <<<<<<<<<<<<<< - * - * for j in range(1,self.hSeq.length+1): + * self.ysmax=0 + * self.ymax=0 */ ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.reset(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":38 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":34 + * self.allocate() * self.reset() + * self.ysmax=0 # <<<<<<<<<<<<<< + * self.ymax=0 + * + */ + __pyx_v_self->ysmax = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":35 + * self.reset() + * self.ysmax=0 + * self.ymax=0 # <<<<<<<<<<<<<< + * + * for j in range(1,self.hSeq.length+1): + */ + __pyx_v_self->ymax = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":37 + * self.ymax=0 * * for j in range(1,self.hSeq.length+1): # <<<<<<<<<<<<<< * idx = self.index(j,0) @@ -844,19 +863,16 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( for (__pyx_t_3 = 1; __pyx_t_3 < (__pyx_v_self->__pyx_base.__pyx_base.hSeq->length + 1); __pyx_t_3+=1) { __pyx_v_j = __pyx_t_3; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":39 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":38 * * for j in range(1,self.hSeq.length+1): * idx = self.index(j,0) # <<<<<<<<<<<<<< * self.matrix.matrix[idx].score = 0 * self.matrix.matrix[idx].path = j */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_int_0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, 0); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":40 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":39 * for j in range(1,self.hSeq.length+1): * idx = self.index(j,0) * self.matrix.matrix[idx].score = 0 # <<<<<<<<<<<<<< @@ -865,7 +881,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":41 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":40 * idx = self.index(j,0) * self.matrix.matrix[idx].score = 0 * self.matrix.matrix[idx].path = j # <<<<<<<<<<<<<< @@ -875,7 +891,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).path = __pyx_v_j; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":43 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":42 * self.matrix.matrix[idx].path = j * * for i in range(1,self.vSeq.length+1): # <<<<<<<<<<<<<< @@ -885,19 +901,16 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( for (__pyx_t_3 = 1; __pyx_t_3 < (__pyx_v_self->__pyx_base.__pyx_base.vSeq->length + 1); __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":44 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":43 * * for i in range(1,self.vSeq.length+1): * idx = self.index(0,i) # <<<<<<<<<<<<<< * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (i-1)) * self.matrix.matrix[idx].path = -i */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_int_0, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), 0, __pyx_v_i); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":45 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":44 * for i in range(1,self.vSeq.length+1): * idx = self.index(0,i) * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (i-1)) # <<<<<<<<<<<<<< @@ -906,29 +919,65 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score = (__pyx_v_self->__pyx_base.__pyx_base._opengap + (__pyx_v_self->__pyx_base.__pyx_base._extgap * (__pyx_v_i - 1))); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":46 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":45 * idx = self.index(0,i) * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (i-1)) * self.matrix.matrix[idx].path = -i # <<<<<<<<<<<<<< * - * for i in range(1,self.vSeq.length+1): + * idx0=self.index(-1,0) */ (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).path = (-__pyx_v_i); } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":48 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":47 * self.matrix.matrix[idx].path = -i * - * for i in range(1,self.vSeq.length+1): # <<<<<<<<<<<<<< - * for j in range(1,self.hSeq.length+1): + * idx0=self.index(-1,0) # <<<<<<<<<<<<<< + * idx1=self.index(0,1) + * for i in range(1,self.vSeq.length+1): + */ + __pyx_v_idx0 = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), -1, 0); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":48 * + * idx0=self.index(-1,0) + * idx1=self.index(0,1) # <<<<<<<<<<<<<< + * for i in range(1,self.vSeq.length+1): + * idx0+=1 + */ + __pyx_v_idx1 = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), 0, 1); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":49 + * idx0=self.index(-1,0) + * idx1=self.index(0,1) + * for i in range(1,self.vSeq.length+1): # <<<<<<<<<<<<<< + * idx0+=1 + * idx1+=1 */ for (__pyx_t_3 = 1; __pyx_t_3 < (__pyx_v_self->__pyx_base.__pyx_base.vSeq->length + 1); __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":49 - * + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":50 + * idx1=self.index(0,1) * for i in range(1,self.vSeq.length+1): + * idx0+=1 # <<<<<<<<<<<<<< + * idx1+=1 + * for j in range(1,self.hSeq.length+1): + */ + __pyx_v_idx0 += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":51 + * for i in range(1,self.vSeq.length+1): + * idx0+=1 + * idx1+=1 # <<<<<<<<<<<<<< + * for j in range(1,self.hSeq.length+1): + * + */ + __pyx_v_idx1 += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":52 + * idx0+=1 + * idx1+=1 * for j in range(1,self.hSeq.length+1): # <<<<<<<<<<<<<< * * # 1 - came from diagonal @@ -936,22 +985,16 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( for (__pyx_t_4 = 1; __pyx_t_4 < (__pyx_v_self->__pyx_base.__pyx_base.hSeq->length + 1); __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":52 - * + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":56 * # 1 - came from diagonal - * idx = self.index(j-1,i-1) # <<<<<<<<<<<<<< + * #idx = self.index(j-1,i-1) + * idx = idx0 # <<<<<<<<<<<<<< * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), * scoremax = self.matrix.matrix[idx].score + \ */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_j - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong((__pyx_v_i - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = __pyx_v_idx0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":55 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":59 * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), * scoremax = self.matrix.matrix[idx].score + \ * self.matchScore(j,i) # <<<<<<<<<<<<<< @@ -960,7 +1003,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_scoremax = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.matchScore(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i)); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":56 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":60 * scoremax = self.matrix.matrix[idx].score + \ * self.matchScore(j,i) * path = 0 # <<<<<<<<<<<<<< @@ -969,23 +1012,17 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_path = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":61 - * + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":66 * # 2 - open horizontal gap - * idx = self.index(j-1,i) # <<<<<<<<<<<<<< + * # idx = self.index(j-1,i) + * idx = idx1 - 1 # <<<<<<<<<<<<<< * score = self.matrix.matrix[idx].score+ \ * self._opengap */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_j - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = (__pyx_v_idx1 - 1); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":63 - * idx = self.index(j-1,i) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":68 + * idx = idx1 - 1 * score = self.matrix.matrix[idx].score+ \ * self._opengap # <<<<<<<<<<<<<< * if score > scoremax : @@ -993,7 +1030,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + __pyx_v_self->__pyx_base.__pyx_base._opengap); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":64 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":69 * score = self.matrix.matrix[idx].score+ \ * self._opengap * if score > scoremax : # <<<<<<<<<<<<<< @@ -1003,7 +1040,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":65 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":70 * self._opengap * if score > scoremax : * scoremax = score # <<<<<<<<<<<<<< @@ -1012,7 +1049,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_scoremax = __pyx_v_score; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":66 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":71 * if score > scoremax : * scoremax = score * path = +1 # <<<<<<<<<<<<<< @@ -1024,23 +1061,17 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( } __pyx_L12:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":69 - * + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":75 * # 3 - open vertical gap - * idx = self.index(j,i-1) # <<<<<<<<<<<<<< + * # idx = self.index(j,i-1) + * idx = idx0 + 1 # <<<<<<<<<<<<<< * score = self.matrix.matrix[idx].score + \ * self._opengap */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong((__pyx_v_i - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = (__pyx_v_idx0 + 1); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":71 - * idx = self.index(j,i-1) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":77 + * idx = idx0 + 1 * score = self.matrix.matrix[idx].score + \ * self._opengap # <<<<<<<<<<<<<< * if score > scoremax : @@ -1048,7 +1079,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + __pyx_v_self->__pyx_base.__pyx_base._opengap); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":72 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":78 * score = self.matrix.matrix[idx].score + \ * self._opengap * if score > scoremax : # <<<<<<<<<<<<<< @@ -1058,7 +1089,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":73 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":79 * self._opengap * if score > scoremax : * scoremax = score # <<<<<<<<<<<<<< @@ -1067,7 +1098,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_scoremax = __pyx_v_score; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":74 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":80 * if score > scoremax : * scoremax = score * path = -1 # <<<<<<<<<<<<<< @@ -1079,7 +1110,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( } __pyx_L13:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":77 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":83 * * # 4 - extend horizontal gap * jump = self.matrix.bestHJump[i] # <<<<<<<<<<<<<< @@ -1088,7 +1119,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_jump = (__pyx_v_self->__pyx_base.__pyx_base.matrix->bestHJump[__pyx_v_i]); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":78 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":84 * # 4 - extend horizontal gap * jump = self.matrix.bestHJump[i] * if jump >= 0: # <<<<<<<<<<<<<< @@ -1098,22 +1129,16 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_jump >= 0); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":79 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":85 * jump = self.matrix.bestHJump[i] * if jump >= 0: * idx = self.index(jump,i) # <<<<<<<<<<<<<< * delta = j-jump * score = self.matrix.matrix[idx].score + \ */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_jump); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_jump, __pyx_v_i); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":80 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":86 * if jump >= 0: * idx = self.index(jump,i) * delta = j-jump # <<<<<<<<<<<<<< @@ -1122,7 +1147,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_delta = (__pyx_v_j - __pyx_v_jump); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":82 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":88 * delta = j-jump * score = self.matrix.matrix[idx].score + \ * self._extgap * delta # <<<<<<<<<<<<<< @@ -1131,7 +1156,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + (__pyx_v_self->__pyx_base.__pyx_base._extgap * __pyx_v_delta)); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":83 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":89 * score = self.matrix.matrix[idx].score + \ * self._extgap * delta * if score > scoremax : # <<<<<<<<<<<<<< @@ -1141,7 +1166,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":84 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":90 * self._extgap * delta * if score > scoremax : * scoremax = score # <<<<<<<<<<<<<< @@ -1150,7 +1175,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_scoremax = __pyx_v_score; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":85 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":91 * if score > scoremax : * scoremax = score * path = delta+1 # <<<<<<<<<<<<<< @@ -1165,7 +1190,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( } __pyx_L14:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":88 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":94 * * # 5 - extend vertical gap * jump = self.matrix.bestVJump[j] # <<<<<<<<<<<<<< @@ -1174,7 +1199,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_jump = (__pyx_v_self->__pyx_base.__pyx_base.matrix->bestVJump[__pyx_v_j]); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":89 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":95 * # 5 - extend vertical gap * jump = self.matrix.bestVJump[j] * if jump >= 0: # <<<<<<<<<<<<<< @@ -1184,22 +1209,16 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_jump >= 0); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":90 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":96 * jump = self.matrix.bestVJump[j] * if jump >= 0: * idx = self.index(j,jump) # <<<<<<<<<<<<<< * delta = i-jump * score = self.matrix.matrix[idx].score + \ */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong(__pyx_v_jump); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_jump); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":91 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":97 * if jump >= 0: * idx = self.index(j,jump) * delta = i-jump # <<<<<<<<<<<<<< @@ -1208,7 +1227,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_delta = (__pyx_v_i - __pyx_v_jump); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":93 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":99 * delta = i-jump * score = self.matrix.matrix[idx].score + \ * self._extgap * delta # <<<<<<<<<<<<<< @@ -1217,7 +1236,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + (__pyx_v_self->__pyx_base.__pyx_base._extgap * __pyx_v_delta)); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":94 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":100 * score = self.matrix.matrix[idx].score + \ * self._extgap * delta * if score > scoremax : # <<<<<<<<<<<<<< @@ -1227,7 +1246,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":95 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":101 * self._extgap * delta * if score > scoremax : * scoremax = score # <<<<<<<<<<<<<< @@ -1236,12 +1255,12 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_scoremax = __pyx_v_score; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":96 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":102 * if score > scoremax : * scoremax = score * path = -delta-1 # <<<<<<<<<<<<<< * - * idx = self.index(j,i) + * # idx = self.index(j,i) */ __pyx_v_path = ((-__pyx_v_delta) - 1); goto __pyx_L17; @@ -1251,32 +1270,26 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( } __pyx_L16:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":98 - * path = -delta-1 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":105 * - * idx = self.index(j,i) # <<<<<<<<<<<<<< + * # idx = self.index(j,i) + * idx = idx1 # <<<<<<<<<<<<<< * self.matrix.matrix[idx].score = scoremax * self.matrix.matrix[idx].path = path */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = __pyx_v_idx1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":99 - * - * idx = self.index(j,i) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":106 + * # idx = self.index(j,i) + * idx = idx1 * self.matrix.matrix[idx].score = scoremax # <<<<<<<<<<<<<< * self.matrix.matrix[idx].path = path * */ (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score = __pyx_v_scoremax; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":100 - * idx = self.index(j,i) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":107 + * idx = idx1 * self.matrix.matrix[idx].score = scoremax * self.matrix.matrix[idx].path = path # <<<<<<<<<<<<<< * @@ -1284,7 +1297,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).path = __pyx_v_path; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":102 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":109 * self.matrix.matrix[idx].path = path * * if path == -1: # <<<<<<<<<<<<<< @@ -1294,7 +1307,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_path == -1); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":103 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":110 * * if path == -1: * self.matrix.bestVJump[j]=i # <<<<<<<<<<<<<< @@ -1305,7 +1318,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( goto __pyx_L18; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":104 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":111 * if path == -1: * self.matrix.bestVJump[j]=i * elif path == +1 : # <<<<<<<<<<<<<< @@ -1315,7 +1328,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( __pyx_t_2 = (__pyx_v_path == 1); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":105 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":112 * self.matrix.bestVJump[j]=i * elif path == +1 : * self.matrix.bestHJump[i]=j # <<<<<<<<<<<<<< @@ -1327,7 +1340,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( } __pyx_L18:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":107 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":114 * self.matrix.bestHJump[i]=j * * if j==self.hSeq.length and scoremax > self.ysmax: # <<<<<<<<<<<<<< @@ -1341,34 +1354,52 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( } if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":108 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":115 * * if j==self.hSeq.length and scoremax > self.ysmax: * self.ysmax=scoremax # <<<<<<<<<<<<<< * self.ymax=i - * + * idx0+=1 */ __pyx_v_self->ysmax = __pyx_v_scoremax; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":109 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":116 * if j==self.hSeq.length and scoremax > self.ysmax: * self.ysmax=scoremax * self.ymax=i # <<<<<<<<<<<<<< - * - * self.sequenceChanged=False + * idx0+=1 + * idx1+=1 */ __pyx_v_self->ymax = __pyx_v_i; goto __pyx_L19; } __pyx_L19:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":117 + * self.ysmax=scoremax + * self.ymax=i + * idx0+=1 # <<<<<<<<<<<<<< + * idx1+=1 + * + */ + __pyx_v_idx0 += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":118 + * self.ymax=i + * idx0+=1 + * idx1+=1 # <<<<<<<<<<<<<< + * + * self.sequenceChanged=False + */ + __pyx_v_idx1 += 1; } } goto __pyx_L3; } __pyx_L3:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":111 - * self.ymax=i + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":120 + * idx1+=1 * * self.sequenceChanged=False # <<<<<<<<<<<<<< * self.scoreChanged=False @@ -1376,7 +1407,7 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_self->__pyx_base.__pyx_base.sequenceChanged = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":112 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":121 * * self.sequenceChanged=False * self.scoreChanged=False # <<<<<<<<<<<<<< @@ -1385,12 +1416,12 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( */ __pyx_v_self->__pyx_base.__pyx_base.scoreChanged = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":114 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":123 * self.scoreChanged=False * * return self.ysmax # <<<<<<<<<<<<<< * - * def backtrack(self): + * cdef void backtrack(self): */ __pyx_r = __pyx_v_self->ysmax; goto __pyx_L0; @@ -1399,7 +1430,6 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("obitools.align._assemble.DirectAssemble.doAlignment"); __pyx_r = 0; __pyx_L0:; @@ -1407,98 +1437,100 @@ static double __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment( return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":116 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":125 * return self.ysmax * - * def backtrack(self): # <<<<<<<<<<<<<< - * cdef list path=[] + * cdef void backtrack(self): # <<<<<<<<<<<<<< + * #cdef list path=[] * cdef int i */ -static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_v_path = 0; +static void __pyx_f_8obitools_5align_9_assemble_14DirectAssemble_backtrack(struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *__pyx_v_self) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_p; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - double __pyx_t_2; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath __pyx_1; + double __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_t_2; int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; __Pyx_SetupRefcountContext("backtrack"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":117 - * - * def backtrack(self): - * cdef list path=[] # <<<<<<<<<<<<<< - * cdef int i - * cdef int j - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_path = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":122 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":131 * cdef int p * * self.doAlignment() # <<<<<<<<<<<<<< * i=self.ymax * j=self.hSeq.length */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_2 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":123 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":132 * * self.doAlignment() * i=self.ymax # <<<<<<<<<<<<<< * j=self.hSeq.length - * + * self.path=allocatePath(i,j+1,self.path) */ - __pyx_v_i = ((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->ymax; + __pyx_v_i = __pyx_v_self->ymax; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":124 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":133 * self.doAlignment() * i=self.ymax * j=self.hSeq.length # <<<<<<<<<<<<<< + * self.path=allocatePath(i,j+1,self.path) + * + */ + __pyx_v_j = __pyx_v_self->__pyx_base.__pyx_base.hSeq->length; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":134 + * i=self.ymax + * j=self.hSeq.length + * self.path=allocatePath(i,j+1,self.path) # <<<<<<<<<<<<<< * * if self.ymax__pyx_base.__pyx_base.hSeq->length; + __pyx_1.__pyx_n = 1; + __pyx_1.path = __pyx_v_self->__pyx_base.__pyx_base.path; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocatePath(__pyx_v_i, (__pyx_v_j + 1), &__pyx_1); + __pyx_v_self->__pyx_base.__pyx_base.path = __pyx_t_2; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":126 - * j=self.hSeq.length + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":136 + * self.path=allocatePath(i,j+1,self.path) * * if self.ymaxymax < ((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.vSeq->length); + __pyx_t_3 = (__pyx_v_self->ymax < __pyx_v_self->__pyx_base.__pyx_base.vSeq->length); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":127 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":137 * * if self.ymax__pyx_base.__pyx_base.path->path[__pyx_v_self->__pyx_base.__pyx_base.path->length]) = (__pyx_v_self->ymax - __pyx_v_self->__pyx_base.__pyx_base.vSeq->length); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":138 + * if self.ymaxymax - ((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.vSeq->length)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_path), __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L5; + __pyx_v_self->__pyx_base.__pyx_base.path->length += 1; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":129 - * path.append(self.ymax-self.vSeq.length) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":140 + * self.path.length+=1 * * while (i or j): # <<<<<<<<<<<<<< * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) + * self.path.path[self.path.length]=p */ while (1) { if (!__pyx_v_i) { @@ -1508,36 +1540,36 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack } if (!__pyx_t_3) break; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":130 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":141 * * while (i or j): * p=self.matrix.matrix[self.index(j,i)].path # <<<<<<<<<<<<<< - * path.append(p) - * if p==0: + * self.path.path[self.path.length]=p + * self.path.length+=1 */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_p = (((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)((struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5)]).path; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_p = (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i)]).path; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":131 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":142 * while (i or j): * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) # <<<<<<<<<<<<<< - * if p==0: - * i-=1 + * self.path.path[self.path.length]=p # <<<<<<<<<<<<<< + * self.path.length+=1 + * #path.append(p) */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_p); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_path), __pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + (__pyx_v_self->__pyx_base.__pyx_base.path->path[__pyx_v_self->__pyx_base.__pyx_base.path->length]) = __pyx_v_p; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":132 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":143 * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) + * self.path.path[self.path.length]=p + * self.path.length+=1 # <<<<<<<<<<<<<< + * #path.append(p) + * if p==0: + */ + __pyx_v_self->__pyx_base.__pyx_base.path->length += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":145 + * self.path.length+=1 + * #path.append(p) * if p==0: # <<<<<<<<<<<<<< * i-=1 * j-=1 @@ -1545,8 +1577,8 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack __pyx_t_3 = (__pyx_v_p == 0); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":133 - * path.append(p) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":146 + * #path.append(p) * if p==0: * i-=1 # <<<<<<<<<<<<<< * j-=1 @@ -1554,7 +1586,7 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack */ __pyx_v_i -= 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":134 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":147 * if p==0: * i-=1 * j-=1 # <<<<<<<<<<<<<< @@ -1562,10 +1594,10 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack * i+=p */ __pyx_v_j -= 1; - goto __pyx_L8; + goto __pyx_L6; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":135 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":148 * i-=1 * j-=1 * elif p < 0: # <<<<<<<<<<<<<< @@ -1575,7 +1607,7 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack __pyx_t_3 = (__pyx_v_p < 0); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":136 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":149 * j-=1 * elif p < 0: * i+=p # <<<<<<<<<<<<<< @@ -1583,69 +1615,48 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack * j-=p */ __pyx_v_i += __pyx_v_p; - goto __pyx_L8; + goto __pyx_L6; } /*else*/ { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":138 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":151 * i+=p * else: * j-=p # <<<<<<<<<<<<<< * - * path.reverse() + * #path.reverse() */ __pyx_v_j -= __pyx_v_p; } - __pyx_L8:; + __pyx_L6:; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":140 - * j-=p - * - * path.reverse() # <<<<<<<<<<<<<< - * return 0,0,path + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":155 + * #path.reverse() + * #reversePath(self.path) + * self.path.hStart=0 # <<<<<<<<<<<<<< + * self.path.vStart=0 + * #return 0,0,path + */ + __pyx_v_self->__pyx_base.__pyx_base.path->hStart = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":156 + * #reversePath(self.path) + * self.path.hStart=0 + * self.path.vStart=0 # <<<<<<<<<<<<<< + * #return 0,0,path * */ - __pyx_t_4 = PyList_Reverse(((PyObject *)__pyx_v_path)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->__pyx_base.__pyx_base.path->vStart = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":141 - * - * path.reverse() - * return 0,0,path # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(((PyObject *)__pyx_v_path)); - PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_path)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_path)); - __pyx_r = ((PyObject *)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("obitools.align._assemble.DirectAssemble.backtrack"); - __pyx_r = NULL; + __Pyx_WriteUnraisable("obitools.align._assemble.DirectAssemble.backtrack"); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_path); - __Pyx_XGIVEREF(__pyx_r); __Pyx_FinishRefcountContext(); - return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":147 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":163 * * property seqB: * def __get__(self): # <<<<<<<<<<<<<< @@ -1659,7 +1670,7 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_15ReverseAssemble_4seqB___ PyObject *__pyx_t_1 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":148 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":164 * property seqB: * def __get__(self): * return self.verticalSeq.wrapped # <<<<<<<<<<<<<< @@ -1667,7 +1678,7 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_15ReverseAssemble_4seqB___ * def __set__(self, seq): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq, __pyx_kp_wrapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq, __pyx_kp_wrapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1685,7 +1696,7 @@ static PyObject *__pyx_pf_8obitools_5align_9_assemble_15ReverseAssemble_4seqB___ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":150 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":166 * return self.verticalSeq.wrapped * * def __set__(self, seq): # <<<<<<<<<<<<<< @@ -1702,7 +1713,7 @@ static int __pyx_pf_8obitools_5align_9_assemble_15ReverseAssemble_4seqB___set__( struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_3; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":151 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":167 * * def __set__(self, seq): * self.sequenceChanged=True # <<<<<<<<<<<<<< @@ -1711,15 +1722,15 @@ static int __pyx_pf_8obitools_5align_9_assemble_15ReverseAssemble_4seqB___set__( */ ((struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":152 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":168 * def __set__(self, seq): * self.sequenceChanged=True * self.verticalSeq=seq.complement() # <<<<<<<<<<<<<< * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_complement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_complement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); @@ -1728,7 +1739,7 @@ static int __pyx_pf_8obitools_5align_9_assemble_15ReverseAssemble_4seqB___set__( ((struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":153 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pyx":169 * self.sequenceChanged=True * self.verticalSeq=seq.complement() * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< @@ -1780,7 +1791,6 @@ static int __pyx_tp_clear_8obitools_5align_9_assemble_DirectAssemble(PyObject *o } static struct PyMethodDef __pyx_methods_8obitools_5align_9_assemble_DirectAssemble[] = { - {__Pyx_NAMESTR("backtrack"), (PyCFunction)__pyx_pf_8obitools_5align_9_assemble_14DirectAssemble_backtrack, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -2132,7 +2142,6 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp_backtrack, __pyx_k_backtrack, sizeof(__pyx_k_backtrack), 1, 1, 1}, {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, {&__pyx_kp_mismatch, __pyx_k_mismatch, sizeof(__pyx_k_mismatch), 1, 1, 1}, {&__pyx_kp_opengap, __pyx_k_opengap, sizeof(__pyx_k_opengap), 1, 1, 1}, @@ -2145,7 +2154,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -2157,7 +2166,6 @@ static int __Pyx_InitGlobals(void) { __pyx_int_neg_8 = PyInt_FromLong(-8); if (unlikely(!__pyx_int_neg_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; @@ -2227,11 +2235,11 @@ PyMODINIT_FUNC PyInit__assemble(void) __pyx_vtabptr_8obitools_5align_9_assemble_DirectAssemble = &__pyx_vtable_8obitools_5align_9_assemble_DirectAssemble; __pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_4_nws_NWS; #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_9_assemble_14DirectAssemble_matchScore; __pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base.__pyx_base.doAlignment = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment; + __pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base.__pyx_base.backtrack = (void (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_9_assemble_14DirectAssemble_backtrack; #else - *(void(**)(void))&__pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_9_assemble_14DirectAssemble_matchScore; *(void(**)(void))&__pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base.__pyx_base.doAlignment = (void(*)(void))__pyx_f_8obitools_5align_9_assemble_14DirectAssemble_doAlignment; + *(void(**)(void))&__pyx_vtable_8obitools_5align_9_assemble_DirectAssemble.__pyx_base.__pyx_base.backtrack = (void(*)(void))__pyx_f_8obitools_5align_9_assemble_14DirectAssemble_backtrack; #endif __pyx_type_8obitools_5align_9_assemble_DirectAssemble.tp_base = __pyx_ptype_8obitools_5align_4_nws_NWS; if (PyType_Ready(&__pyx_type_8obitools_5align_9_assemble_DirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2241,13 +2249,13 @@ PyMODINIT_FUNC PyInit__assemble(void) __pyx_vtabptr_8obitools_5align_9_assemble_ReverseAssemble = &__pyx_vtable_8obitools_5align_9_assemble_ReverseAssemble; __pyx_vtable_8obitools_5align_9_assemble_ReverseAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_9_assemble_DirectAssemble; __pyx_type_8obitools_5align_9_assemble_ReverseAssemble.tp_base = __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble; - if (PyType_Ready(&__pyx_type_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8obitools_5align_9_assemble_ReverseAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ReverseAssemble", (PyObject *)&__pyx_type_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_9_assemble_ReverseAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ReverseAssemble", (PyObject *)&__pyx_type_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8obitools_5align_9_assemble_ReverseAssemble = &__pyx_type_8obitools_5align_9_assemble_ReverseAssemble; /*--- Type import code ---*/ - __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = __Pyx_ImportType("obitools.align._dynamic", "DynamicProgramming", sizeof(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming)); if (unlikely(!__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming->tp_dict, &__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = __Pyx_ImportType("obitools.align._dynamic", "DynamicProgramming", sizeof(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming)); if (unlikely(!__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming->tp_dict, &__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ __pyx_1 = __Pyx_ImportModule("obitools.align._dynamic"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "allocateMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateMatrix, "struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2255,16 +2263,19 @@ PyMODINIT_FUNC PyInit__assemble(void) if (__Pyx_ImportFunction(__pyx_1, "resetMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "allocateSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "freeSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocatePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "reversePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "bitCount", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "iupacMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "iupacPartialMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_1); __pyx_1 = 0; /*--- Execution code ---*/ - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":1 - * from _dynamic cimport * # <<<<<<<<<<<<<< + /* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pxd":1 + * from _nws cimport * # <<<<<<<<<<<<<< * - * cdef class NWS(DynamicProgramming): + * cdef class DirectAssemble(NWS): */ goto __pyx_L0; __pyx_L1_error:; @@ -2764,6 +2775,68 @@ static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { } } +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, diff --git a/src/obitools/align/_assemble.pxd b/src/obitools/align/_assemble.pxd new file mode 100644 index 0000000..2e4359f --- /dev/null +++ b/src/obitools/align/_assemble.pxd @@ -0,0 +1,10 @@ +from _nws cimport * + +cdef class DirectAssemble(NWS): + cdef double ysmax + cdef int ymax + + cdef double doAlignment(self) except? 0 + +cdef class ReverseAssemble(DirectAssemble): + pass \ No newline at end of file diff --git a/src/obitools/align/_assemble.pyx b/src/obitools/align/_assemble.pyx index cbaff43..849cd0a 100644 --- a/src/obitools/align/_assemble.pyx +++ b/src/obitools/align/_assemble.pyx @@ -5,25 +5,22 @@ Created on 6 Nov. 2009 ''' #@PydevCodeAnalysisIgnore -from _nws cimport * +from _assemble cimport * cdef class DirectAssemble(NWS): - cdef double ysmax - cdef int ymax def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): NWS.__init__(self,match,mismatch,opengap,extgap) self.ysmax=0 self.ymax=0 - - cdef double matchScore(self,int h, int v): - return iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) - + cdef double doAlignment(self) except? 0: cdef int i # vertical index cdef int j # horizontal index cdef int idx + cdef int idx0 + cdef int idx1 cdef int jump cdef int delta cdef double score @@ -34,6 +31,8 @@ cdef class DirectAssemble(NWS): if self.needToCompute: self.allocate() self.reset() + self.ysmax=0 + self.ymax=0 for j in range(1,self.hSeq.length+1): idx = self.index(j,0) @@ -45,11 +44,16 @@ cdef class DirectAssemble(NWS): self.matrix.matrix[idx].score = self._opengap + (self._extgap * (i-1)) self.matrix.matrix[idx].path = -i + idx0=self.index(-1,0) + idx1=self.index(0,1) for i in range(1,self.vSeq.length+1): + idx0+=1 + idx1+=1 for j in range(1,self.hSeq.length+1): # 1 - came from diagonal - idx = self.index(j-1,i-1) + #idx = self.index(j-1,i-1) + idx = idx0 # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), scoremax = self.matrix.matrix[idx].score + \ self.matchScore(j,i) @@ -58,7 +62,8 @@ cdef class DirectAssemble(NWS): # print "so=%f sd=%f sm=%f" % (self.matrix.matrix[idx].score,self.matchScore(j,i),scoremax), # 2 - open horizontal gap - idx = self.index(j-1,i) + # idx = self.index(j-1,i) + idx = idx1 - 1 score = self.matrix.matrix[idx].score+ \ self._opengap if score > scoremax : @@ -66,7 +71,8 @@ cdef class DirectAssemble(NWS): path = +1 # 3 - open vertical gap - idx = self.index(j,i-1) + # idx = self.index(j,i-1) + idx = idx0 + 1 score = self.matrix.matrix[idx].score + \ self._opengap if score > scoremax : @@ -95,7 +101,8 @@ cdef class DirectAssemble(NWS): scoremax = score path = -delta-1 - idx = self.index(j,i) + # idx = self.index(j,i) + idx = idx1 self.matrix.matrix[idx].score = scoremax self.matrix.matrix[idx].path = path @@ -107,14 +114,16 @@ cdef class DirectAssemble(NWS): if j==self.hSeq.length and scoremax > self.ysmax: self.ysmax=scoremax self.ymax=i + idx0+=1 + idx1+=1 self.sequenceChanged=False self.scoreChanged=False return self.ysmax - def backtrack(self): - cdef list path=[] + cdef void backtrack(self): + #cdef list path=[] cdef int i cdef int j cdef int p @@ -122,13 +131,17 @@ cdef class DirectAssemble(NWS): self.doAlignment() i=self.ymax j=self.hSeq.length + self.path=allocatePath(i,j+1,self.path) if self.ymaxmalloc(sizeof(AlignMatrix)) # <<<<<<<<<<<<<< * matrix.vsize=0 * matrix.hsize=0 */ - __pyx_t_2 = malloc((sizeof(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = malloc((sizeof(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_matrix = ((struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)__pyx_t_2); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":29 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":30 * if matrix is NULL: * matrix = malloc(sizeof(AlignMatrix)) * matrix.vsize=0 # <<<<<<<<<<<<<< @@ -735,7 +764,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools */ __pyx_v_matrix->vsize = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":30 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":31 * matrix = malloc(sizeof(AlignMatrix)) * matrix.vsize=0 * matrix.hsize=0 # <<<<<<<<<<<<<< @@ -744,7 +773,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools */ __pyx_v_matrix->hsize = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":31 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":32 * matrix.vsize=0 * matrix.hsize=0 * matrix.msize=0 # <<<<<<<<<<<<<< @@ -753,7 +782,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools */ __pyx_v_matrix->msize = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":32 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":33 * matrix.hsize=0 * matrix.msize=0 * matrix.matrix=NULL # <<<<<<<<<<<<<< @@ -762,7 +791,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools */ __pyx_v_matrix->matrix = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":33 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":34 * matrix.msize=0 * matrix.matrix=NULL * matrix.bestVJump=NULL # <<<<<<<<<<<<<< @@ -771,7 +800,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools */ __pyx_v_matrix->bestVJump = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":34 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":35 * matrix.matrix=NULL * matrix.bestVJump=NULL * matrix.bestHJump=NULL # <<<<<<<<<<<<<< @@ -783,7 +812,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools } __pyx_L3:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":36 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":37 * matrix.bestHJump=NULL * * if hsize > matrix.hsize: # <<<<<<<<<<<<<< @@ -793,17 +822,17 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools __pyx_t_1 = (__pyx_v_hsize > __pyx_v_matrix->hsize); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":37 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":38 * * if hsize > matrix.hsize: * matrix.bestVJump = realloc(matrix.bestVJump,hsize * sizeof(int)) # <<<<<<<<<<<<<< * matrix.hsize=hsize * */ - __pyx_t_3 = realloc(__pyx_v_matrix->bestVJump, (__pyx_v_hsize * (sizeof(int)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = realloc(__pyx_v_matrix->bestVJump, (__pyx_v_hsize * (sizeof(int)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_matrix->bestVJump = ((int *)__pyx_t_3); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":38 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":39 * if hsize > matrix.hsize: * matrix.bestVJump = realloc(matrix.bestVJump,hsize * sizeof(int)) * matrix.hsize=hsize # <<<<<<<<<<<<<< @@ -815,7 +844,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools } __pyx_L4:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":40 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":41 * matrix.hsize=hsize * * if vsize > matrix.vsize: # <<<<<<<<<<<<<< @@ -825,17 +854,17 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools __pyx_t_1 = (__pyx_v_vsize > __pyx_v_matrix->vsize); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":41 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":42 * * if vsize > matrix.vsize: * matrix.bestHJump = realloc(matrix.bestHJump,vsize * sizeof(int)) # <<<<<<<<<<<<<< * matrix.vsize=vsize * */ - __pyx_t_3 = realloc(__pyx_v_matrix->bestHJump, (__pyx_v_vsize * (sizeof(int)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = realloc(__pyx_v_matrix->bestHJump, (__pyx_v_vsize * (sizeof(int)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_matrix->bestHJump = ((int *)__pyx_t_3); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":42 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":43 * if vsize > matrix.vsize: * matrix.bestHJump = realloc(matrix.bestHJump,vsize * sizeof(int)) * matrix.vsize=vsize # <<<<<<<<<<<<<< @@ -847,7 +876,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools } __pyx_L5:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":44 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":45 * matrix.vsize=vsize * * if (hsize * vsize) > matrix.msize: # <<<<<<<<<<<<<< @@ -857,7 +886,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools __pyx_t_1 = ((__pyx_v_hsize * __pyx_v_vsize) > __pyx_v_matrix->msize); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":45 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":46 * * if (hsize * vsize) > matrix.msize: * matrix.msize = hsize * vsize # <<<<<<<<<<<<<< @@ -866,20 +895,20 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools */ __pyx_v_matrix->msize = (__pyx_v_hsize * __pyx_v_vsize); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":46 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":47 * if (hsize * vsize) > matrix.msize: * matrix.msize = hsize * vsize * matrix.matrix = realloc(matrix.matrix, matrix.msize * sizeof(AlignCell)) # <<<<<<<<<<<<<< * * return matrix */ - __pyx_t_3 = realloc(__pyx_v_matrix->matrix, (__pyx_v_matrix->msize * (sizeof(struct __pyx_t_8obitools_5align_8_dynamic_AlignCell)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = realloc(__pyx_v_matrix->matrix, (__pyx_v_matrix->msize * (sizeof(struct __pyx_t_8obitools_5align_8_dynamic_AlignCell)))); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_matrix->matrix = ((struct __pyx_t_8obitools_5align_8_dynamic_AlignCell *)__pyx_t_3); goto __pyx_L6; } __pyx_L6:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":48 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":49 * matrix.matrix = realloc(matrix.matrix, matrix.msize * sizeof(AlignCell)) * * return matrix # <<<<<<<<<<<<<< @@ -899,7 +928,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_f_8obitools return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":50 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":51 * return matrix * * cdef void freeMatrix(AlignMatrix* matrix): # <<<<<<<<<<<<<< @@ -911,7 +940,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito int __pyx_t_1; __Pyx_SetupRefcountContext("freeMatrix"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":51 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":52 * * cdef void freeMatrix(AlignMatrix* matrix): * if matrix is not NULL: # <<<<<<<<<<<<<< @@ -921,7 +950,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito __pyx_t_1 = (__pyx_v_matrix != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":52 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":53 * cdef void freeMatrix(AlignMatrix* matrix): * if matrix is not NULL: * if matrix.matrix is not NULL: # <<<<<<<<<<<<<< @@ -931,7 +960,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito __pyx_t_1 = (__pyx_v_matrix->matrix != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":53 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":54 * if matrix is not NULL: * if matrix.matrix is not NULL: * free(matrix.matrix) # <<<<<<<<<<<<<< @@ -943,7 +972,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito } __pyx_L4:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":54 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":55 * if matrix.matrix is not NULL: * free(matrix.matrix) * if matrix.bestVJump is not NULL: # <<<<<<<<<<<<<< @@ -953,7 +982,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito __pyx_t_1 = (__pyx_v_matrix->bestVJump != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":55 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":56 * free(matrix.matrix) * if matrix.bestVJump is not NULL: * free(matrix.bestVJump) # <<<<<<<<<<<<<< @@ -965,7 +994,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito } __pyx_L5:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":56 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":57 * if matrix.bestVJump is not NULL: * free(matrix.bestVJump) * if matrix.bestHJump is not NULL: # <<<<<<<<<<<<<< @@ -975,7 +1004,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito __pyx_t_1 = (__pyx_v_matrix->bestHJump != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":57 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":58 * free(matrix.bestVJump) * if matrix.bestHJump is not NULL: * free(matrix.bestHJump) # <<<<<<<<<<<<<< @@ -987,7 +1016,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito } __pyx_L6:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":58 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":59 * if matrix.bestHJump is not NULL: * free(matrix.bestHJump) * free(matrix) # <<<<<<<<<<<<<< @@ -1002,7 +1031,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeMatrix(struct __pyx_t_8obito __Pyx_FinishRefcountContext(); } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":60 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":61 * free(matrix) * * cdef void resetMatrix(AlignMatrix* matrix): # <<<<<<<<<<<<<< @@ -1014,7 +1043,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit int __pyx_t_1; __Pyx_SetupRefcountContext("resetMatrix"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":61 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":62 * * cdef void resetMatrix(AlignMatrix* matrix): * if matrix is not NULL: # <<<<<<<<<<<<<< @@ -1024,7 +1053,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit __pyx_t_1 = (__pyx_v_matrix != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":62 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":63 * cdef void resetMatrix(AlignMatrix* matrix): * if matrix is not NULL: * if matrix.matrix is not NULL: # <<<<<<<<<<<<<< @@ -1034,7 +1063,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit __pyx_t_1 = (__pyx_v_matrix->matrix != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":63 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":64 * if matrix is not NULL: * if matrix.matrix is not NULL: * bzero(matrix.matrix, matrix.msize * sizeof(AlignCell)) # <<<<<<<<<<<<<< @@ -1046,7 +1075,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit } __pyx_L4:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":64 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":65 * if matrix.matrix is not NULL: * bzero(matrix.matrix, matrix.msize * sizeof(AlignCell)) * if matrix.bestHJump is not NULL: # <<<<<<<<<<<<<< @@ -1056,7 +1085,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit __pyx_t_1 = (__pyx_v_matrix->bestHJump != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":65 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":66 * bzero(matrix.matrix, matrix.msize * sizeof(AlignCell)) * if matrix.bestHJump is not NULL: * memset(matrix.bestHJump,255,matrix.vsize * sizeof(int)) # <<<<<<<<<<<<<< @@ -1068,7 +1097,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit } __pyx_L5:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":66 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":67 * if matrix.bestHJump is not NULL: * memset(matrix.bestHJump,255,matrix.vsize * sizeof(int)) * if matrix.bestVJump is not NULL: # <<<<<<<<<<<<<< @@ -1078,7 +1107,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit __pyx_t_1 = (__pyx_v_matrix->bestVJump != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":67 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":68 * memset(matrix.bestHJump,255,matrix.vsize * sizeof(int)) * if matrix.bestVJump is not NULL: * memset(matrix.bestVJump,255,matrix.hsize * sizeof(int)) # <<<<<<<<<<<<<< @@ -1096,7 +1125,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_resetMatrix(struct __pyx_t_8obit __Pyx_FinishRefcountContext(); } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":70 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":71 * * * cdef alignSequence* allocateSequence(object bioseq, alignSequence* seq=NULL): # <<<<<<<<<<<<<< @@ -1129,7 +1158,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo __pyx_v_strseq = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_quality = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":74 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":75 * cdef int i * * if seq is NULL: # <<<<<<<<<<<<<< @@ -1139,17 +1168,17 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo __pyx_t_1 = (__pyx_v_seq == NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":75 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":76 * * if seq is NULL: * seq = malloc(sizeof(alignSequence)) # <<<<<<<<<<<<<< * seq.length=0 * seq.buffsize=0 */ - __pyx_t_2 = malloc((sizeof(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = malloc((sizeof(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_seq = ((struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)__pyx_t_2); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":76 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":77 * if seq is NULL: * seq = malloc(sizeof(alignSequence)) * seq.length=0 # <<<<<<<<<<<<<< @@ -1158,7 +1187,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo */ __pyx_v_seq->length = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":77 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":78 * seq = malloc(sizeof(alignSequence)) * seq.length=0 * seq.buffsize=0 # <<<<<<<<<<<<<< @@ -1167,7 +1196,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo */ __pyx_v_seq->buffsize = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":78 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":79 * seq.length=0 * seq.buffsize=0 * seq.sequence=NULL # <<<<<<<<<<<<<< @@ -1176,7 +1205,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo */ __pyx_v_seq->sequence = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":79 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":80 * seq.buffsize=0 * seq.sequence=NULL * seq.quality=NULL # <<<<<<<<<<<<<< @@ -1185,7 +1214,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo */ __pyx_v_seq->quality = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":80 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":81 * seq.sequence=NULL * seq.quality=NULL * seq.hasQuality=False # <<<<<<<<<<<<<< @@ -1197,17 +1226,17 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo } __pyx_L3:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":82 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":83 * seq.hasQuality=False * * seq.length=len(bioseq) # <<<<<<<<<<<<<< * if seq.length > seq.buffsize: * seq.sequence = realloc(seq.sequence,sizeof(char)*seq.length) */ - __pyx_t_3 = PyObject_Length(__pyx_v_bioseq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v_bioseq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_seq->length = __pyx_t_3; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":83 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":84 * * seq.length=len(bioseq) * if seq.length > seq.buffsize: # <<<<<<<<<<<<<< @@ -1217,27 +1246,27 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo __pyx_t_1 = (__pyx_v_seq->length > __pyx_v_seq->buffsize); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":84 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":85 * seq.length=len(bioseq) * if seq.length > seq.buffsize: * seq.sequence = realloc(seq.sequence,sizeof(char)*seq.length) # <<<<<<<<<<<<<< * seq.quality = realloc(seq.quality,sizeof(double)*seq.length) * seq.buffsize = seq.length */ - __pyx_t_4 = realloc(__pyx_v_seq->sequence, ((sizeof(char)) * __pyx_v_seq->length)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = realloc(__pyx_v_seq->sequence, ((sizeof(char)) * __pyx_v_seq->length)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_seq->sequence = ((char *)__pyx_t_4); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":85 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":86 * if seq.length > seq.buffsize: * seq.sequence = realloc(seq.sequence,sizeof(char)*seq.length) * seq.quality = realloc(seq.quality,sizeof(double)*seq.length) # <<<<<<<<<<<<<< * seq.buffsize = seq.length * */ - __pyx_t_4 = realloc(__pyx_v_seq->quality, ((sizeof(double)) * __pyx_v_seq->length)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = realloc(__pyx_v_seq->quality, ((sizeof(double)) * __pyx_v_seq->length)); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_seq->quality = ((double *)__pyx_t_4); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":86 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":87 * seq.sequence = realloc(seq.sequence,sizeof(char)*seq.length) * seq.quality = realloc(seq.quality,sizeof(double)*seq.length) * seq.buffsize = seq.length # <<<<<<<<<<<<<< @@ -1249,53 +1278,53 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo } __pyx_L4:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":88 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":89 * seq.buffsize = seq.length * * strseq = str(bioseq).lower() # <<<<<<<<<<<<<< * memcpy(seq.sequence,strseq,seq.length) * */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(__pyx_v_bioseq); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_bioseq); __Pyx_GIVEREF(__pyx_v_bioseq); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_kp_lower); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_kp_lower); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_6)) || (__pyx_t_6) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected str, got %s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyString_CheckExact(__pyx_t_6)) || (__pyx_t_6) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected str, got %s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_strseq)); __pyx_v_strseq = ((PyObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":89 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":90 * * strseq = str(bioseq).lower() * memcpy(seq.sequence,strseq,seq.length) # <<<<<<<<<<<<<< * * if 'quality' in bioseq: */ - __pyx_t_7 = __Pyx_PyBytes_AsString(((PyObject *)__pyx_v_strseq)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyBytes_AsString(((PyObject *)__pyx_v_strseq)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} memcpy(__pyx_v_seq->sequence, ((char *)__pyx_t_7), __pyx_v_seq->length); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":91 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":92 * memcpy(seq.sequence,strseq,seq.length) * * if 'quality' in bioseq: # <<<<<<<<<<<<<< * seq.hasQuality=True * quality=bioseq['quality'] */ - __pyx_t_1 = (PySequence_Contains(__pyx_v_bioseq, __pyx_kp_3)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (PySequence_Contains(__pyx_v_bioseq, __pyx_kp_4)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":92 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":93 * * if 'quality' in bioseq: * seq.hasQuality=True # <<<<<<<<<<<<<< @@ -1304,20 +1333,20 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo */ __pyx_v_seq->hasQuality = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":93 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":94 * if 'quality' in bioseq: * seq.hasQuality=True * quality=bioseq['quality'] # <<<<<<<<<<<<<< * for i in range(0,seq.length): * seq.quality[i]=quality[i] */ - __pyx_1 = PyObject_GetItem(__pyx_v_bioseq, __pyx_kp_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = PyObject_GetItem(__pyx_v_bioseq, __pyx_kp_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); __Pyx_DECREF(__pyx_v_quality); __pyx_v_quality = __pyx_1; __pyx_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":94 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":95 * seq.hasQuality=True * quality=bioseq['quality'] * for i in range(0,seq.length): # <<<<<<<<<<<<<< @@ -1327,16 +1356,16 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_v_seq->length; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":95 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":96 * quality=bioseq['quality'] * for i in range(0,seq.length): * seq.quality[i]=quality[i] # <<<<<<<<<<<<<< * * return seq */ - __pyx_1 = __Pyx_GetItemInt(__pyx_v_quality, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_GetItemInt(__pyx_v_quality, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_1); __pyx_1 = 0; (__pyx_v_seq->quality[__pyx_v_i]) = ((double)__pyx_t_9); } @@ -1344,7 +1373,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo } __pyx_L5:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":97 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":98 * seq.quality[i]=quality[i] * * return seq # <<<<<<<<<<<<<< @@ -1369,7 +1398,7 @@ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_f_8obitoo return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":99 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":100 * return seq * * cdef void freeSequence(alignSequence* seq): # <<<<<<<<<<<<<< @@ -1381,7 +1410,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi int __pyx_t_1; __Pyx_SetupRefcountContext("freeSequence"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":100 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":101 * * cdef void freeSequence(alignSequence* seq): * if seq is not NULL: # <<<<<<<<<<<<<< @@ -1391,7 +1420,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi __pyx_t_1 = (__pyx_v_seq != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":101 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":102 * cdef void freeSequence(alignSequence* seq): * if seq is not NULL: * if seq.sequence is not NULL: # <<<<<<<<<<<<<< @@ -1401,7 +1430,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi __pyx_t_1 = (__pyx_v_seq->sequence != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":102 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":103 * if seq is not NULL: * if seq.sequence is not NULL: * free(seq.sequence) # <<<<<<<<<<<<<< @@ -1413,7 +1442,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi } __pyx_L4:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":103 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":104 * if seq.sequence is not NULL: * free(seq.sequence) * if seq.quality is not NULL: # <<<<<<<<<<<<<< @@ -1423,7 +1452,7 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi __pyx_t_1 = (__pyx_v_seq->quality != NULL); if (__pyx_t_1) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":104 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":105 * free(seq.sequence) * if seq.quality is not NULL: * free(seq.quality) # <<<<<<<<<<<<<< @@ -1435,12 +1464,12 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi } __pyx_L5:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":105 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":106 * if seq.quality is not NULL: * free(seq.quality) * free(seq) # <<<<<<<<<<<<<< * - * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=NULL): */ free(__pyx_v_seq); goto __pyx_L3; @@ -1450,7 +1479,286 @@ static void __pyx_f_8obitools_5align_8_dynamic_freeSequence(struct __pyx_t_8obi __Pyx_FinishRefcountContext(); } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":112 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":108 + * free(seq) + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=NULL): # <<<<<<<<<<<<<< + * cdef long length=l1+l2 + * + */ + +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_f_8obitools_5align_8_dynamic_allocatePath(long __pyx_v_l1, long __pyx_v_l2, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args) { + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_v_path = ((struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)NULL); + long __pyx_v_length; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_r; + int __pyx_t_1; + void *__pyx_t_2; + void *__pyx_t_3; + __Pyx_SetupRefcountContext("allocatePath"); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_path = __pyx_optional_args->path; + } + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":109 + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=NULL): + * cdef long length=l1+l2 # <<<<<<<<<<<<<< + * + * if path is NULL: + */ + __pyx_v_length = (__pyx_v_l1 + __pyx_v_l2); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":111 + * cdef long length=l1+l2 + * + * if path is NULL: # <<<<<<<<<<<<<< + * path = malloc(sizeof(alignPath)) + * path.length=0 + */ + __pyx_t_1 = (__pyx_v_path == NULL); + if (__pyx_t_1) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":112 + * + * if path is NULL: + * path = malloc(sizeof(alignPath)) # <<<<<<<<<<<<<< + * path.length=0 + * path.buffsize=0 + */ + __pyx_t_2 = malloc((sizeof(struct __pyx_t_8obitools_5align_8_dynamic_alignPath))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_path = ((struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)__pyx_t_2); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":113 + * if path is NULL: + * path = malloc(sizeof(alignPath)) + * path.length=0 # <<<<<<<<<<<<<< + * path.buffsize=0 + * path.path=NULL + */ + __pyx_v_path->length = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":114 + * path = malloc(sizeof(alignPath)) + * path.length=0 + * path.buffsize=0 # <<<<<<<<<<<<<< + * path.path=NULL + * + */ + __pyx_v_path->buffsize = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":115 + * path.length=0 + * path.buffsize=0 + * path.path=NULL # <<<<<<<<<<<<<< + * + * if length > path.buffsize: + */ + __pyx_v_path->path = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":117 + * path.path=NULL + * + * if length > path.buffsize: # <<<<<<<<<<<<<< + * path.buffsize=length + * path.path=realloc(path.path,sizeof(long)*length) + */ + __pyx_t_1 = (__pyx_v_length > __pyx_v_path->buffsize); + if (__pyx_t_1) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":118 + * + * if length > path.buffsize: + * path.buffsize=length # <<<<<<<<<<<<<< + * path.path=realloc(path.path,sizeof(long)*length) + * + */ + __pyx_v_path->buffsize = __pyx_v_length; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":119 + * if length > path.buffsize: + * path.buffsize=length + * path.path=realloc(path.path,sizeof(long)*length) # <<<<<<<<<<<<<< + * + * path.length=0 + */ + __pyx_t_3 = realloc(__pyx_v_path->path, ((sizeof(long)) * __pyx_v_length)); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_path->path = ((long *)__pyx_t_3); + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":121 + * path.path=realloc(path.path,sizeof(long)*length) + * + * path.length=0 # <<<<<<<<<<<<<< + * path.vStart=0 + * path.hStart=0 + */ + __pyx_v_path->length = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":122 + * + * path.length=0 + * path.vStart=0 # <<<<<<<<<<<<<< + * path.hStart=0 + * + */ + __pyx_v_path->vStart = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":123 + * path.length=0 + * path.vStart=0 + * path.hStart=0 # <<<<<<<<<<<<<< + * + * return path + */ + __pyx_v_path->hStart = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":125 + * path.hStart=0 + * + * return path # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path): + */ + __pyx_r = __pyx_v_path; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("obitools.align._dynamic.allocatePath"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":127 + * return path + * + * cdef void reversePath(alignPath* path): # <<<<<<<<<<<<<< + * cdef long i + * cdef long j + */ + +static void __pyx_f_8obitools_5align_8_dynamic_reversePath(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_v_path) { + long __pyx_v_i; + long __pyx_v_j; + long __pyx_t_1; + long __pyx_t_2; + long __pyx_t_3; + __Pyx_SetupRefcountContext("reversePath"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":131 + * cdef long j + * + * j=path.length # <<<<<<<<<<<<<< + * for i in range(path.length/2): + * j-=1 + */ + __pyx_v_j = __pyx_v_path->length; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":132 + * + * j=path.length + * for i in range(path.length/2): # <<<<<<<<<<<<<< + * j-=1 + * path.path[i],path.path[j]=path.path[j],path.path[i] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < (__pyx_v_path->length / 2); __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":133 + * j=path.length + * for i in range(path.length/2): + * j-=1 # <<<<<<<<<<<<<< + * path.path[i],path.path[j]=path.path[j],path.path[i] + * + */ + __pyx_v_j -= 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":134 + * for i in range(path.length/2): + * j-=1 + * path.path[i],path.path[j]=path.path[j],path.path[i] # <<<<<<<<<<<<<< + * + * cdef void freePath(alignPath* path): + */ + __pyx_t_2 = (__pyx_v_path->path[__pyx_v_j]); + __pyx_t_3 = (__pyx_v_path->path[__pyx_v_i]); + (__pyx_v_path->path[__pyx_v_i]) = __pyx_t_2; + (__pyx_v_path->path[__pyx_v_j]) = __pyx_t_3; + } + + __Pyx_FinishRefcountContext(); +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":136 + * path.path[i],path.path[j]=path.path[j],path.path[i] + * + * cdef void freePath(alignPath* path): # <<<<<<<<<<<<<< + * if path is not NULL: + * if path.path is not NULL: + */ + +static void __pyx_f_8obitools_5align_8_dynamic_freePath(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_v_path) { + int __pyx_t_1; + __Pyx_SetupRefcountContext("freePath"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":137 + * + * cdef void freePath(alignPath* path): + * if path is not NULL: # <<<<<<<<<<<<<< + * if path.path is not NULL: + * free(path.path) + */ + __pyx_t_1 = (__pyx_v_path != NULL); + if (__pyx_t_1) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":138 + * cdef void freePath(alignPath* path): + * if path is not NULL: + * if path.path is not NULL: # <<<<<<<<<<<<<< + * free(path.path) + * free(path) + */ + __pyx_t_1 = (__pyx_v_path->path != NULL); + if (__pyx_t_1) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":139 + * if path is not NULL: + * if path.path is not NULL: + * free(path.path) # <<<<<<<<<<<<<< + * free(path) + * + */ + free(((void *)__pyx_v_path->path)); + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":140 + * if path.path is not NULL: + * free(path.path) + * free(path) # <<<<<<<<<<<<<< + * + * + */ + free(((void *)__pyx_v_path)); + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_FinishRefcountContext(); +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":146 * cdef int _basecode[26] * * cdef int bitCount(int x): # <<<<<<<<<<<<<< @@ -1464,7 +1772,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_bitCount(int __pyx_v_x) { int __pyx_t_1; __Pyx_SetupRefcountContext("bitCount"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":113 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":147 * * cdef int bitCount(int x): * cdef int i=0 # <<<<<<<<<<<<<< @@ -1473,7 +1781,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_bitCount(int __pyx_v_x) { */ __pyx_v_i = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":114 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":148 * cdef int bitCount(int x): * cdef int i=0 * while(x): # <<<<<<<<<<<<<< @@ -1484,7 +1792,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_bitCount(int __pyx_v_x) { __pyx_t_1 = __pyx_v_x; if (!__pyx_t_1) break; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":115 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":149 * cdef int i=0 * while(x): * i+=1 # <<<<<<<<<<<<<< @@ -1493,7 +1801,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_bitCount(int __pyx_v_x) { */ __pyx_v_i += 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":116 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":150 * while(x): * i+=1 * x&=x-1 # <<<<<<<<<<<<<< @@ -1503,7 +1811,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_bitCount(int __pyx_v_x) { __pyx_v_x &= (__pyx_v_x - 1); } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":117 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":151 * i+=1 * x&=x-1 * return i # <<<<<<<<<<<<<< @@ -1519,7 +1827,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_bitCount(int __pyx_v_x) { return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":119 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":153 * return i * * cpdef bint iupacMatch(unsigned char a, unsigned char b): # <<<<<<<<<<<<<< @@ -1533,7 +1841,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_iupacMatch(unsigned char __pyx_v_ int __pyx_r; __Pyx_SetupRefcountContext("iupacMatch"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":121 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":155 * cpdef bint iupacMatch(unsigned char a, unsigned char b): * cdef bint m * m = _basecode[a - aascii] & _basecode[b - aascii] # <<<<<<<<<<<<<< @@ -1542,7 +1850,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_iupacMatch(unsigned char __pyx_v_ */ __pyx_v_m = ((__pyx_v_8obitools_5align_8_dynamic__basecode[(__pyx_v_a - __pyx_v_8obitools_5align_8_dynamic_aascii)]) & (__pyx_v_8obitools_5align_8_dynamic__basecode[(__pyx_v_b - __pyx_v_8obitools_5align_8_dynamic_aascii)])); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":122 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":156 * cdef bint m * m = _basecode[a - aascii] & _basecode[b - aascii] * return m # <<<<<<<<<<<<<< @@ -1558,7 +1866,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_iupacMatch(unsigned char __pyx_v_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":119 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":153 * return i * * cpdef bint iupacMatch(unsigned char a, unsigned char b): # <<<<<<<<<<<<<< @@ -1593,29 +1901,29 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_iupacMatch(PyObject *__pyx_ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_b); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("iupacMatch", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("iupacMatch", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iupacMatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iupacMatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(values[0]); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(values[1]); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(values[0]); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(values[1]); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { - __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iupacMatch", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("iupacMatch", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("obitools.align._dynamic.iupacMatch"); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_8obitools_5align_8_dynamic_iupacMatch(__pyx_v_a, __pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_8obitools_5align_8_dynamic_iupacMatch(__pyx_v_a, __pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1633,7 +1941,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_iupacMatch(PyObject *__pyx_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":124 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":158 * return m * * cpdef double iupacPartialMatch(unsigned char a, unsigned char b): # <<<<<<<<<<<<<< @@ -1651,7 +1959,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha double __pyx_r; __Pyx_SetupRefcountContext("iupacPartialMatch"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":125 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":159 * * cpdef double iupacPartialMatch(unsigned char a, unsigned char b): * cdef int codeA = _basecode[a - aascii] # <<<<<<<<<<<<<< @@ -1660,7 +1968,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha */ __pyx_v_codeA = (__pyx_v_8obitools_5align_8_dynamic__basecode[(__pyx_v_a - __pyx_v_8obitools_5align_8_dynamic_aascii)]); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":126 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":160 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b): * cdef int codeA = _basecode[a - aascii] * cdef int codeB = _basecode[b - aascii] # <<<<<<<<<<<<<< @@ -1669,7 +1977,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha */ __pyx_v_codeB = (__pyx_v_8obitools_5align_8_dynamic__basecode[(__pyx_v_b - __pyx_v_8obitools_5align_8_dynamic_aascii)]); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":127 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":161 * cdef int codeA = _basecode[a - aascii] * cdef int codeB = _basecode[b - aascii] * cdef int good = bitCount(codeA & codeB) # <<<<<<<<<<<<<< @@ -1678,7 +1986,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha */ __pyx_v_good = __pyx_f_8obitools_5align_8_dynamic_bitCount((__pyx_v_codeA & __pyx_v_codeB)); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":128 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":162 * cdef int codeB = _basecode[b - aascii] * cdef int good = bitCount(codeA & codeB) * cdef int all = bitCount(codeA) * bitCount(codeB) # <<<<<<<<<<<<<< @@ -1687,7 +1995,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha */ __pyx_v_all = (__pyx_f_8obitools_5align_8_dynamic_bitCount(__pyx_v_codeA) * __pyx_f_8obitools_5align_8_dynamic_bitCount(__pyx_v_codeB)); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":129 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":163 * cdef int good = bitCount(codeA & codeB) * cdef int all = bitCount(codeA) * bitCount(codeB) * cdef double partial= good / all # <<<<<<<<<<<<<< @@ -1696,7 +2004,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha */ __pyx_v_partial = (((double)__pyx_v_good) / __pyx_v_all); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":130 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":164 * cdef int all = bitCount(codeA) * bitCount(codeB) * cdef double partial= good / all * return partial # <<<<<<<<<<<<<< @@ -1712,7 +2020,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(unsigned cha return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":124 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":158 * return m * * cpdef double iupacPartialMatch(unsigned char a, unsigned char b): # <<<<<<<<<<<<<< @@ -1747,29 +2055,29 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_iupacPartialMatch(PyObject values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_b); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("iupacPartialMatch", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("iupacPartialMatch", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iupacPartialMatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "iupacPartialMatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(values[0]); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(values[1]); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(values[0]); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(values[1]); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { - __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_a = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_a == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_b = __Pyx_PyInt_AsUnsignedChar(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_b == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("iupacPartialMatch", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("iupacPartialMatch", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("obitools.align._dynamic.iupacPartialMatch"); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(__pyx_v_a, __pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch(__pyx_v_a, __pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1787,7 +2095,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_iupacPartialMatch(PyObject return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":135 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":169 * cdef class DynamicProgramming: * * def __init__(self,opengap,extgap): # <<<<<<<<<<<<<< @@ -1821,11 +2129,11 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_extgap); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_opengap = values[0]; __pyx_v_extgap = values[1]; @@ -1837,13 +2145,13 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("obitools.align._dynamic.DynamicProgramming.__init__"); return -1; __pyx_L4_argument_unpacking_done:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":136 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":170 * * def __init__(self,opengap,extgap): * self.sequenceChanged=True # <<<<<<<<<<<<<< @@ -1852,7 +2160,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->sequenceChanged = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":137 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":171 * def __init__(self,opengap,extgap): * self.sequenceChanged=True * self.scoreChanged=True # <<<<<<<<<<<<<< @@ -1861,7 +2169,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->scoreChanged = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":139 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":173 * self.scoreChanged=True * * self.matrix=NULL # <<<<<<<<<<<<<< @@ -1870,26 +2178,35 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->matrix = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":140 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":174 * * self.matrix=NULL * self.hSeq=NULL # <<<<<<<<<<<<<< * self.vSeq=NULL - * + * self.path=NULL */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->hSeq = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":141 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":175 * self.matrix=NULL * self.hSeq=NULL * self.vSeq=NULL # <<<<<<<<<<<<<< + * self.path=NULL * - * self.horizontalSeq=None */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->vSeq = NULL; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":143 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":176 + * self.hSeq=NULL * self.vSeq=NULL + * self.path=NULL # <<<<<<<<<<<<<< + * + * self.horizontalSeq=None + */ + ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path = NULL; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":178 + * self.path=NULL * * self.horizontalSeq=None # <<<<<<<<<<<<<< * self.verticalSeq=None @@ -1901,7 +2218,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->horizontalSeq); ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->horizontalSeq = Py_None; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":144 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":179 * * self.horizontalSeq=None * self.verticalSeq=None # <<<<<<<<<<<<<< @@ -1914,24 +2231,24 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->verticalSeq); ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->verticalSeq = Py_None; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":146 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":181 * self.verticalSeq=None * * self._opengap=opengap # <<<<<<<<<<<<<< * self._extgap=extgap * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_opengap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_opengap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_opengap = __pyx_t_1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":147 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":182 * * self._opengap=opengap * self._extgap=extgap # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_extgap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_extgap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_extgap = __pyx_t_1; __pyx_r = 0; @@ -1944,7 +2261,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___init__(PyO return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":150 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":185 * * * cdef int allocate(self) except -1: # <<<<<<<<<<<<<< @@ -1961,7 +2278,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *__pyx_t_2; __Pyx_SetupRefcountContext("allocate"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":152 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":187 * cdef int allocate(self) except -1: * * assert self.horizontalSeq is not None,'Sequence A must be set' # <<<<<<<<<<<<<< @@ -1971,12 +2288,12 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str #ifndef PYREX_WITHOUT_ASSERTIONS __pyx_t_1 = (__pyx_v_self->horizontalSeq != Py_None); if (unlikely(!__pyx_t_1)) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_6); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":153 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":188 * * assert self.horizontalSeq is not None,'Sequence A must be set' * assert self.verticalSeq is not None,'Sequence B must be set' # <<<<<<<<<<<<<< @@ -1986,12 +2303,12 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str #ifndef PYREX_WITHOUT_ASSERTIONS __pyx_t_1 = (__pyx_v_self->verticalSeq != Py_None); if (unlikely(!__pyx_t_1)) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_7); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":155 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":190 * assert self.verticalSeq is not None,'Sequence B must be set' * * cdef long lenH=self.hSeq.length # <<<<<<<<<<<<<< @@ -2000,7 +2317,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str */ __pyx_v_lenH = __pyx_v_self->hSeq->length; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":156 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":191 * * cdef long lenH=self.hSeq.length * cdef long lenV=self.vSeq.length # <<<<<<<<<<<<<< @@ -2009,7 +2326,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str */ __pyx_v_lenV = __pyx_v_self->vSeq->length; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":158 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":193 * cdef long lenV=self.vSeq.length * * self.matrix=allocateMatrix(lenH,lenV,self.matrix) # <<<<<<<<<<<<<< @@ -2021,7 +2338,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocateMatrix(__pyx_v_lenH, __pyx_v_lenV, &__pyx_1); __pyx_v_self->matrix = __pyx_t_2; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":159 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":194 * * self.matrix=allocateMatrix(lenH,lenV,self.matrix) * return 0 # <<<<<<<<<<<<<< @@ -2041,7 +2358,7 @@ static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate(str return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":161 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":196 * return 0 * * cdef double matchScore(self,int h, int v): # <<<<<<<<<<<<<< @@ -2058,7 +2375,7 @@ static double __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_matchScor return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":164 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":199 * pass * * cdef double doAlignment(self) except? 0: # <<<<<<<<<<<<<< @@ -2075,7 +2392,55 @@ static double __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_doAlignme return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":168 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":202 + * pass + * + * cdef bint _needToCompute(self): # <<<<<<<<<<<<<< + * return self.scoreChanged or self.sequenceChanged + * + */ + +static int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming__needToCompute(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_v_self) { + int __pyx_r; + int __pyx_t_1; + __Pyx_SetupRefcountContext("_needToCompute"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":203 + * + * cdef bint _needToCompute(self): + * return self.scoreChanged or self.sequenceChanged # <<<<<<<<<<<<<< + * + * cdef void backtrack(self): + */ + if (!__pyx_v_self->scoreChanged) { + __pyx_t_1 = __pyx_v_self->sequenceChanged; + } else { + __pyx_t_1 = __pyx_v_self->scoreChanged; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":205 + * return self.scoreChanged or self.sequenceChanged + * + * cdef void backtrack(self): # <<<<<<<<<<<<<< + * pass + * + */ + +static void __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_backtrack(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_v_self) { + __Pyx_SetupRefcountContext("backtrack"); + + __Pyx_FinishRefcountContext(); +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":209 * * property seqA: * def __get__(self): # <<<<<<<<<<<<<< @@ -2088,7 +2453,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqA_ PyObject *__pyx_r = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":169 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":210 * property seqA: * def __get__(self): * return self.horizontalSeq # <<<<<<<<<<<<<< @@ -2107,7 +2472,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqA_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":171 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":212 * return self.horizontalSeq * * def __set__(self, seq): # <<<<<<<<<<<<<< @@ -2122,7 +2487,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqA___set_ struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_1; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":172 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":213 * * def __set__(self, seq): * self.sequenceChanged=True # <<<<<<<<<<<<<< @@ -2131,7 +2496,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqA___set_ */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->sequenceChanged = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":173 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":214 * def __set__(self, seq): * self.sequenceChanged=True * self.horizontalSeq=seq # <<<<<<<<<<<<<< @@ -2144,7 +2509,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqA___set_ __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->horizontalSeq); ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->horizontalSeq = __pyx_v_seq; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":174 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":215 * self.sequenceChanged=True * self.horizontalSeq=seq * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) # <<<<<<<<<<<<<< @@ -2161,7 +2526,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqA___set_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":177 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":218 * * property seqB: * def __get__(self): # <<<<<<<<<<<<<< @@ -2174,7 +2539,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqB_ PyObject *__pyx_r = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":178 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":219 * property seqB: * def __get__(self): * return self.verticalSeq # <<<<<<<<<<<<<< @@ -2193,7 +2558,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqB_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":180 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":221 * return self.verticalSeq * * def __set__(self, seq): # <<<<<<<<<<<<<< @@ -2208,7 +2573,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqB___set_ struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_1; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":181 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":222 * * def __set__(self, seq): * self.sequenceChanged=True # <<<<<<<<<<<<<< @@ -2217,7 +2582,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqB___set_ */ ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->sequenceChanged = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":182 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":223 * def __set__(self, seq): * self.sequenceChanged=True * self.verticalSeq=seq # <<<<<<<<<<<<<< @@ -2230,7 +2595,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqB___set_ __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->verticalSeq); ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->verticalSeq = __pyx_v_seq; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":183 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":224 * self.sequenceChanged=True * self.verticalSeq=seq * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< @@ -2247,7 +2612,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_4seqB___set_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":186 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":227 * * property opengap: * def __get__(self): # <<<<<<<<<<<<<< @@ -2261,7 +2626,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_7openg PyObject *__pyx_t_1 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":187 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":228 * property opengap: * def __get__(self): * return self._opengap # <<<<<<<<<<<<<< @@ -2269,7 +2634,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_7openg * def __set__(self,opengap): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_opengap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_opengap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2287,7 +2652,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_7openg return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":189 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":230 * return self._opengap * * def __set__(self,opengap): # <<<<<<<<<<<<<< @@ -2301,17 +2666,17 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_7opengap___s double __pyx_t_1; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":190 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":231 * * def __set__(self,opengap): * self._opengap=opengap # <<<<<<<<<<<<<< * self.scoreChanged=True * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_opengap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_opengap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_opengap = __pyx_t_1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":191 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":232 * def __set__(self,opengap): * self._opengap=opengap * self.scoreChanged=True # <<<<<<<<<<<<<< @@ -2330,7 +2695,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_7opengap___s return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":194 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":235 * * property extgap: * def __get__(self): # <<<<<<<<<<<<<< @@ -2344,7 +2709,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_6extga PyObject *__pyx_t_1 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":195 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":236 * property extgap: * def __get__(self): * return self._extgap # <<<<<<<<<<<<<< @@ -2352,7 +2717,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_6extga * def __set__(self,extgap): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_extgap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_extgap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2370,7 +2735,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_6extga return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":197 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":238 * return self._extgap * * def __set__(self,extgap): # <<<<<<<<<<<<<< @@ -2384,17 +2749,17 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_6extgap___se double __pyx_t_1; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":198 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":239 * * def __set__(self,extgap): * self._extgap=extgap # <<<<<<<<<<<<<< * self.scoreChanged=True * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_extgap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_extgap); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->_extgap = __pyx_t_1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":199 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":240 * def __set__(self,extgap): * self._extgap=extgap * self.scoreChanged=True # <<<<<<<<<<<<<< @@ -2413,7 +2778,7 @@ static int __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_6extgap___se return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":202 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":243 * * property needToCompute: * def __get__(self): # <<<<<<<<<<<<<< @@ -2428,7 +2793,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_13need PyObject *__pyx_t_2 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":203 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":244 * property needToCompute: * def __get__(self): * return self.scoreChanged or self.sequenceChanged # <<<<<<<<<<<<<< @@ -2441,7 +2806,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_13need } else { __pyx_t_1 = ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->scoreChanged; } - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2459,7 +2824,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_13need return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":206 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":247 * * property score: * def __get__(self): # <<<<<<<<<<<<<< @@ -2474,7 +2839,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_5score PyObject *__pyx_t_2 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":207 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":248 * property score: * def __get__(self): * return self.doAlignment() # <<<<<<<<<<<<<< @@ -2482,8 +2847,8 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_5score * cdef void reset(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *)((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->__pyx_vtab)->doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *)((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->__pyx_vtab)->doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2501,7 +2866,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_5score return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":209 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":250 * return self.doAlignment() * * cdef void reset(self): # <<<<<<<<<<<<<< @@ -2512,7 +2877,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming_5score static void __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_reset(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_v_self) { __Pyx_SetupRefcountContext("reset"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":210 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":251 * * cdef void reset(self): * self.scoreChanged=True # <<<<<<<<<<<<<< @@ -2521,66 +2886,47 @@ static void __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_reset(struc */ __pyx_v_self->scoreChanged = 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":211 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":252 * cdef void reset(self): * self.scoreChanged=True * resetMatrix(self.matrix) # <<<<<<<<<<<<<< * - * cdef inline int index(self,x,y): + * cdef inline int index(self, int x, int y): */ __pyx_f_8obitools_5align_8_dynamic_resetMatrix(__pyx_v_self->matrix); __Pyx_FinishRefcountContext(); } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":213 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":254 * resetMatrix(self.matrix) * - * cdef inline int index(self,x,y): # <<<<<<<<<<<<<< + * cdef inline int index(self, int x, int y): # <<<<<<<<<<<<<< * return (self.hSeq.length+1) * y + x * */ -static INLINE int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_index(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +static INLINE int __pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_index(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_v_self, int __pyx_v_x, int __pyx_v_y) { int __pyx_r; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; __Pyx_SetupRefcountContext("index"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":214 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":255 * - * cdef inline int index(self,x,y): + * cdef inline int index(self, int x, int y): * return (self.hSeq.length+1) * y + x # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_self->hSeq->length + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; + __pyx_r = (((__pyx_v_self->hSeq->length + 1) * __pyx_v_y) + __pyx_v_x); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("obitools.align._dynamic.DynamicProgramming.index"); __pyx_r = 0; __pyx_L0:; __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":218 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":259 * * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2592,7 +2938,7 @@ static void __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___dealloc__ static void __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___dealloc__(PyObject *__pyx_v_self) { __Pyx_SetupRefcountContext("__dealloc__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":219 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":260 * * def __dealloc__(self): * freeMatrix(self.matrix) # <<<<<<<<<<<<<< @@ -2601,29 +2947,38 @@ static void __pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___dealloc__ */ __pyx_f_8obitools_5align_8_dynamic_freeMatrix(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->matrix); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":220 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":261 * def __dealloc__(self): * freeMatrix(self.matrix) * freeSequence(self.hSeq) # <<<<<<<<<<<<<< * freeSequence(self.vSeq) - * + * freePath(self.path) */ __pyx_f_8obitools_5align_8_dynamic_freeSequence(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->hSeq); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":221 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":262 * freeMatrix(self.matrix) * freeSequence(self.hSeq) * freeSequence(self.vSeq) # <<<<<<<<<<<<<< + * freePath(self.path) + * + */ + __pyx_f_8obitools_5align_8_dynamic_freeSequence(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->vSeq); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":263 + * freeSequence(self.hSeq) + * freeSequence(self.vSeq) + * freePath(self.path) # <<<<<<<<<<<<<< * * def __call__(self): */ - __pyx_f_8obitools_5align_8_dynamic_freeSequence(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->vSeq); + __pyx_f_8obitools_5align_8_dynamic_freePath(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path); __Pyx_FinishRefcountContext(); } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":223 - * freeSequence(self.vSeq) +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":265 + * freePath(self.path) * * def __call__(self): # <<<<<<<<<<<<<< * cdef list hgaps=[] @@ -2634,64 +2989,58 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_hgaps = 0; PyObject *__pyx_v_vgaps = 0; - PyObject *__pyx_v_b; int __pyx_v_hp; int __pyx_v_vp; int __pyx_v_lenh; int __pyx_v_lenv; - int __pyx_v_h; - int __pyx_v_v; int __pyx_v_p; + int __pyx_v_i; PyObject *__pyx_v_ali; double __pyx_v_score; PyObject *__pyx_v_hseq; PyObject *__pyx_v_vseq; PyObject *__pyx_r = NULL; PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; double __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; __Pyx_SetupRefcountContext("__call__"); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL; - __pyx_v_b = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_ali = Py_None; __Pyx_INCREF(Py_None); __pyx_v_hseq = Py_None; __Pyx_INCREF(Py_None); __pyx_v_vseq = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":224 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":266 * * def __call__(self): * cdef list hgaps=[] # <<<<<<<<<<<<<< * cdef list vgaps=[] * cdef list b */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_hgaps = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":225 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":267 * def __call__(self): * cdef list hgaps=[] * cdef list vgaps=[] # <<<<<<<<<<<<<< * cdef list b * cdef int hp=0 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_vgaps = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":227 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":269 * cdef list vgaps=[] * cdef list b * cdef int hp=0 # <<<<<<<<<<<<<< @@ -2700,7 +3049,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_hp = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":228 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":270 * cdef list b * cdef int hp=0 * cdef int vp=0 # <<<<<<<<<<<<<< @@ -2709,7 +3058,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_vp = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":229 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":271 * cdef int hp=0 * cdef int vp=0 * cdef int lenh=0 # <<<<<<<<<<<<<< @@ -2718,112 +3067,66 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_lenh = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":230 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":272 * cdef int vp=0 * cdef int lenh=0 * cdef int lenv=0 # <<<<<<<<<<<<<< * cdef int h,v,p - * cdef object ali + * cdef int i */ __pyx_v_lenv = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":235 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":278 * cdef double score * - * if self.needToCompute: # <<<<<<<<<<<<<< + * if self._needToCompute(): # <<<<<<<<<<<<<< * score = self.doAlignment() - * h,v,b=self.backtrack() + * self.backtrack() */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_needToCompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *)((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->__pyx_vtab)->_needToCompute(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":236 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":279 * - * if self.needToCompute: + * if self._needToCompute(): * score = self.doAlignment() # <<<<<<<<<<<<<< - * h,v,b=self.backtrack() - * for p in b: + * self.backtrack() + * for i in range(self.path.length-1,-1,-1): */ - __pyx_t_3 = ((struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *)((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->__pyx_vtab)->doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_3 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *)((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->__pyx_vtab)->doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_3 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_score = __pyx_t_3; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":237 - * if self.needToCompute: + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":280 + * if self._needToCompute(): * score = self.doAlignment() - * h,v,b=self.backtrack() # <<<<<<<<<<<<<< - * for p in b: + * self.backtrack() # <<<<<<<<<<<<<< + * for i in range(self.path.length-1,-1,-1): + * p=self.path.path[i] + */ + ((struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *)((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->__pyx_vtab)->backtrack(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":281 + * score = self.doAlignment() + * self.backtrack() + * for i in range(self.path.length-1,-1,-1): # <<<<<<<<<<<<<< + * p=self.path.path[i] * if p==0: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_backtrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 3)) { - PyObject* tuple = __pyx_t_4; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_2); - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_2); - if (!(likely(PyList_CheckExact(__pyx_2)) || (__pyx_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_h = __pyx_t_5; - __pyx_v_v = __pyx_t_6; - __Pyx_DECREF(((PyObject *)__pyx_v_b)); - __pyx_v_b = ((PyObject *)__pyx_2); - __pyx_2 = 0; - } else { - __pyx_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (!(likely(PyList_CheckExact(__pyx_2)) || (__pyx_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected list, got %s", Py_TYPE(__pyx_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_v_h = __pyx_t_6; - __pyx_v_v = __pyx_t_5; - __Pyx_DECREF(((PyObject *)__pyx_v_b)); - __pyx_v_b = ((PyObject *)__pyx_2); - __pyx_2 = 0; - } + for (__pyx_t_4 = (((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path->length - 1); __pyx_t_4 > -1; __pyx_t_4-=1) { + __pyx_v_i = __pyx_t_4; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":238 - * score = self.doAlignment() - * h,v,b=self.backtrack() - * for p in b: # <<<<<<<<<<<<<< + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":282 + * self.backtrack() + * for i in range(self.path.length-1,-1,-1): + * p=self.path.path[i] # <<<<<<<<<<<<<< * if p==0: * hp+=1 */ - if (likely(((PyObject *)__pyx_v_b) != Py_None)) { - __pyx_t_7 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_b); __Pyx_INCREF(__pyx_t_4); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - for (;;) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_p = __pyx_t_5; + __pyx_v_p = (((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path->path[__pyx_v_i]); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":239 - * h,v,b=self.backtrack() - * for p in b: + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":283 + * for i in range(self.path.length-1,-1,-1): + * p=self.path.path[i] * if p==0: # <<<<<<<<<<<<<< * hp+=1 * vp+=1 @@ -2831,8 +3134,8 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call __pyx_t_2 = (__pyx_v_p == 0); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":240 - * for p in b: + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":284 + * p=self.path.path[i] * if p==0: * hp+=1 # <<<<<<<<<<<<<< * vp+=1 @@ -2840,7 +3143,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_hp += 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":241 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":285 * if p==0: * hp+=1 * vp+=1 # <<<<<<<<<<<<<< @@ -2849,7 +3152,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_vp += 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":242 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":286 * hp+=1 * vp+=1 * lenh+=1 # <<<<<<<<<<<<<< @@ -2858,7 +3161,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_lenh += 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":243 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":287 * vp+=1 * lenh+=1 * lenv+=1 # <<<<<<<<<<<<<< @@ -2869,7 +3172,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call goto __pyx_L8; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":244 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":288 * lenh+=1 * lenv+=1 * elif p>0: # <<<<<<<<<<<<<< @@ -2879,7 +3182,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call __pyx_t_2 = (__pyx_v_p > 0); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":245 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":289 * lenv+=1 * elif p>0: * hp+=p # <<<<<<<<<<<<<< @@ -2888,7 +3191,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_hp += __pyx_v_p; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":246 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":290 * elif p>0: * hp+=p * lenh+=p # <<<<<<<<<<<<<< @@ -2897,29 +3200,29 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_lenh += __pyx_v_p; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":247 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":291 * hp+=p * lenh+=p * vgaps.append([vp,p]) # <<<<<<<<<<<<<< * vp=0 * else: */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_vp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_vp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyInt_FromLong(__pyx_v_p); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __pyx_t_5 = PyInt_FromLong(__pyx_v_p); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); + PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); __pyx_t_1 = 0; - __pyx_t_8 = 0; - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_vgaps), ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_5 = 0; + __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_vgaps), ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":248 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":292 * lenh+=p * vgaps.append([vp,p]) * vp=0 # <<<<<<<<<<<<<< @@ -2931,7 +3234,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } /*else*/ { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":250 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":294 * vp=0 * else: * vp-=p # <<<<<<<<<<<<<< @@ -2940,7 +3243,7 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_vp -= __pyx_v_p; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":251 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":295 * else: * vp-=p * lenv-=p # <<<<<<<<<<<<<< @@ -2949,29 +3252,29 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call */ __pyx_v_lenv -= __pyx_v_p; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":252 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":296 * vp-=p * lenv-=p * hgaps.append([hp,-p]) # <<<<<<<<<<<<<< * hp=0 * */ - __pyx_t_9 = PyInt_FromLong(__pyx_v_hp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyInt_FromLong((-__pyx_v_p)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_hp); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyInt_FromLong((-__pyx_v_p)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_9 = 0; - __pyx_t_8 = 0; - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_hgaps), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_6 = 0; + __pyx_t_5 = 0; + __pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_hgaps), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":253 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":297 * lenv-=p * hgaps.append([hp,-p]) * hp=0 # <<<<<<<<<<<<<< @@ -2982,92 +3285,91 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } __pyx_L8:; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":255 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":299 * hp=0 * * if hp: # <<<<<<<<<<<<<< * hgaps.append([hp,0]) * if vp: */ - __pyx_t_5 = __pyx_v_hp; - if (__pyx_t_5) { + __pyx_t_4 = __pyx_v_hp; + if (__pyx_t_4) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":256 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":300 * * if hp: * hgaps.append([hp,0]) # <<<<<<<<<<<<<< * if vp: * vgaps.append([vp,0]) */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_hp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = PyInt_FromLong(__pyx_v_hp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); + PyList_SET_ITEM(__pyx_t_5, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_4 = 0; - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_hgaps), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = 0; + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_hgaps), ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; goto __pyx_L9; } __pyx_L9:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":257 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":301 * if hp: * hgaps.append([hp,0]) * if vp: # <<<<<<<<<<<<<< * vgaps.append([vp,0]) * */ - __pyx_t_5 = __pyx_v_vp; - if (__pyx_t_5) { + __pyx_t_4 = __pyx_v_vp; + if (__pyx_t_4) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":258 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":302 * hgaps.append([hp,0]) * if vp: * vgaps.append([vp,0]) # <<<<<<<<<<<<<< * * if lenh < self.hSeq.length: */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_vp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = PyInt_FromLong(__pyx_v_vp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_1 = 0; - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_vgaps), ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_vgaps), ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L10; } __pyx_L10:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":260 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":304 * vgaps.append([vp,0]) * * if lenh < self.hSeq.length: # <<<<<<<<<<<<<< - * hseq=self.horizontalSeq[h:h+lenh] + * hseq=self.horizontalSeq[self.path.hStart:self.path.hStart+lenh] * else: */ __pyx_t_2 = (__pyx_v_lenh < ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->hSeq->length); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":261 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":305 * * if lenh < self.hSeq.length: - * hseq=self.horizontalSeq[h:h+lenh] # <<<<<<<<<<<<<< + * hseq=self.horizontalSeq[self.path.hStart:self.path.hStart+lenh] # <<<<<<<<<<<<<< * else: * hseq=self.horizontalSeq */ - __pyx_1 = PySequence_GetSlice(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->horizontalSeq, __pyx_v_h, (__pyx_v_h + __pyx_v_lenh)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = PySequence_GetSlice(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->horizontalSeq, ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path->hStart, (((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path->hStart + __pyx_v_lenh)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); __Pyx_DECREF(__pyx_v_hseq); __pyx_v_hseq = __pyx_1; @@ -3076,8 +3378,8 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } /*else*/ { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":263 - * hseq=self.horizontalSeq[h:h+lenh] + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":307 + * hseq=self.horizontalSeq[self.path.hStart:self.path.hStart+lenh] * else: * hseq=self.horizontalSeq # <<<<<<<<<<<<<< * @@ -3089,55 +3391,55 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } __pyx_L11:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":265 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":309 * hseq=self.horizontalSeq * * hseq=AlignedSequence(hseq) # <<<<<<<<<<<<<< * hseq.gaps=hgaps * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_AlignedSequence); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_AlignedSequence); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_hseq); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_hseq); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_hseq); __Pyx_GIVEREF(__pyx_v_hseq); - __pyx_t_1 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_hseq); - __pyx_v_hseq = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_hseq = __pyx_t_5; + __pyx_t_5 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":266 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":310 * * hseq=AlignedSequence(hseq) * hseq.gaps=hgaps # <<<<<<<<<<<<<< * * if lenv < self.vSeq.length: */ - if (PyObject_SetAttr(__pyx_v_hseq, __pyx_kp_gaps, ((PyObject *)__pyx_v_hgaps)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_hseq, __pyx_kp_gaps, ((PyObject *)__pyx_v_hgaps)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":268 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":312 * hseq.gaps=hgaps * * if lenv < self.vSeq.length: # <<<<<<<<<<<<<< - * vseq=self.verticalSeq[v:v+lenv] + * vseq=self.verticalSeq[self.path.vStart:self.path.vStart+lenv] * else: */ __pyx_t_2 = (__pyx_v_lenv < ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->vSeq->length); if (__pyx_t_2) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":269 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":313 * * if lenv < self.vSeq.length: - * vseq=self.verticalSeq[v:v+lenv] # <<<<<<<<<<<<<< + * vseq=self.verticalSeq[self.path.vStart:self.path.vStart+lenv] # <<<<<<<<<<<<<< * else: * vseq=self.verticalSeq */ - __pyx_1 = PySequence_GetSlice(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->verticalSeq, __pyx_v_v, (__pyx_v_v + __pyx_v_lenv)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = PySequence_GetSlice(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->verticalSeq, ((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path->vStart, (((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->path->vStart + __pyx_v_lenv)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); __Pyx_DECREF(__pyx_v_vseq); __pyx_v_vseq = __pyx_1; @@ -3146,8 +3448,8 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } /*else*/ { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":271 - * vseq=self.verticalSeq[v:v+lenv] + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":315 + * vseq=self.verticalSeq[self.path.vStart:self.path.vStart+lenv] * else: * vseq=self.verticalSeq # <<<<<<<<<<<<<< * @@ -3159,93 +3461,93 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } __pyx_L12:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":273 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":317 * vseq=self.verticalSeq * * vseq=AlignedSequence(vseq) # <<<<<<<<<<<<<< * vseq.gaps=vgaps * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_AlignedSequence); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_AlignedSequence); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(__pyx_v_vseq); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_vseq); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_vseq); __Pyx_GIVEREF(__pyx_v_vseq); - __pyx_t_4 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_vseq); - __pyx_v_vseq = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_vseq = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":274 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":318 * * vseq=AlignedSequence(vseq) * vseq.gaps=vgaps # <<<<<<<<<<<<<< * * ali=Alignment() */ - if (PyObject_SetAttr(__pyx_v_vseq, __pyx_kp_gaps, ((PyObject *)__pyx_v_vgaps)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_vseq, __pyx_kp_gaps, ((PyObject *)__pyx_v_vgaps)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":276 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":320 * vseq.gaps=vgaps * * ali=Alignment() # <<<<<<<<<<<<<< * ali.append(hseq) * ali.append(vseq) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Alignment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_Alignment); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); - __pyx_t_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_1); __pyx_1 = 0; __Pyx_DECREF(__pyx_v_ali); - __pyx_v_ali = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_ali = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":277 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":321 * * ali=Alignment() * ali.append(hseq) # <<<<<<<<<<<<<< * ali.append(vseq) - * ali.score=score + * */ - __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_ali, __pyx_v_hseq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_ali, __pyx_v_hseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":278 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":322 * ali=Alignment() * ali.append(hseq) * ali.append(vseq) # <<<<<<<<<<<<<< + * * ali.score=score - * self.alignment=ali */ - __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_ali, __pyx_v_vseq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_ali, __pyx_v_vseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":279 - * ali.append(hseq) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":324 * ali.append(vseq) + * * ali.score=score # <<<<<<<<<<<<<< * self.alignment=ali - * + * ali=self.alignment.clone() */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_score); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyObject_SetAttr(__pyx_v_ali, __pyx_kp_score, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_v_ali, __pyx_kp_score, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":280 - * ali.append(vseq) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":325 + * * ali.score=score * self.alignment=ali # <<<<<<<<<<<<<< - * - * return self.alignment.clone() + * ali=self.alignment.clone() + * ali.score=self.alignment.score */ __Pyx_INCREF(__pyx_v_ali); __Pyx_GIVEREF(__pyx_v_ali); @@ -3256,38 +3558,58 @@ static PyObject *__pyx_pf_8obitools_5align_8_dynamic_18DynamicProgramming___call } __pyx_L5:; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":282 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":326 + * ali.score=score * self.alignment=ali + * ali=self.alignment.clone() # <<<<<<<<<<<<<< + * ali.score=self.alignment.score + * return ali + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->alignment, __pyx_kp_clone); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ali); + __pyx_v_ali = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":327 + * self.alignment=ali + * ali=self.alignment.clone() + * ali.score=self.alignment.score # <<<<<<<<<<<<<< + * return ali * - * return self.alignment.clone() # <<<<<<<<<<<<<< + */ + __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->alignment, __pyx_kp_score); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyObject_SetAttr(__pyx_v_ali, __pyx_kp_score, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":328 + * ali=self.alignment.clone() + * ali.score=self.alignment.score + * return ali # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)->alignment, __pyx_kp_clone); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_v_ali); + __pyx_r = __pyx_v_ali; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("obitools.align._dynamic.DynamicProgramming.__call__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_hgaps); __Pyx_XDECREF(__pyx_v_vgaps); - __Pyx_DECREF(__pyx_v_b); __Pyx_DECREF(__pyx_v_ali); __Pyx_DECREF(__pyx_v_hseq); __Pyx_DECREF(__pyx_v_vseq); @@ -3620,27 +3942,27 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 1, 1, 1}, {&__pyx_kp_AlignedSequence, __pyx_k_AlignedSequence, sizeof(__pyx_k_AlignedSequence), 1, 1, 1}, {&__pyx_kp_Alignment, __pyx_k_Alignment, sizeof(__pyx_k_Alignment), 1, 1, 1}, + {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 1, 1, 1}, + {&__pyx_kp_NULL, __pyx_k_NULL, sizeof(__pyx_k_NULL), 1, 1, 1}, {&__pyx_kp_ord, __pyx_k_ord, sizeof(__pyx_k_ord), 1, 1, 1}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0}, + {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0}, {&__pyx_kp___basecode, __pyx_k___basecode, sizeof(__pyx_k___basecode), 1, 1, 1}, {&__pyx_kp_i, __pyx_k_i, sizeof(__pyx_k_i), 1, 1, 1}, {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, {&__pyx_kp_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 1, 1, 1}, - {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0}, {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0}, - {&__pyx_kp_needToCompute, __pyx_k_needToCompute, sizeof(__pyx_k_needToCompute), 1, 1, 1}, - {&__pyx_kp_backtrack, __pyx_k_backtrack, sizeof(__pyx_k_backtrack), 1, 1, 1}, + {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0}, {&__pyx_kp_gaps, __pyx_k_gaps, sizeof(__pyx_k_gaps), 1, 1, 1}, {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, {&__pyx_kp_score, __pyx_k_score, sizeof(__pyx_k_score), 1, 1, 1}, {&__pyx_kp_clone, __pyx_k_clone, sizeof(__pyx_k_clone), 1, 1, 1}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0}, + {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 0}, {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_kp_ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_kp_ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3664,6 +3986,7 @@ static int __Pyx_InitGlobals(void) { __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_26 = PyInt_FromLong(26); if (unlikely(!__pyx_int_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; @@ -3739,6 +4062,9 @@ PyMODINIT_FUNC PyInit__dynamic(void) if (__Pyx_ExportFunction("resetMatrix", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("allocateSequence", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("freeSequence", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("allocatePath", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("reversePath", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("freePath", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("bitCount", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("iupacMatch", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("iupacPartialMatch", (void (*)(void))__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3749,17 +4075,21 @@ PyMODINIT_FUNC PyInit__dynamic(void) __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_matchScore; __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.doAlignment = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_doAlignment; __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.reset = (void (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_reset; - __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.index = (int (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, PyObject *, PyObject *))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_index; + __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.index = (int (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_index; + __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming._needToCompute = (int (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming__needToCompute; + __pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.backtrack = (void (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_backtrack; #else *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.allocate = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_allocate; *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.matchScore = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_matchScore; *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.doAlignment = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_doAlignment; *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.reset = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_reset; *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.index = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_index; + *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming._needToCompute = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming__needToCompute; + *(void(**)(void))&__pyx_vtable_8obitools_5align_8_dynamic_DynamicProgramming.backtrack = (void(*)(void))__pyx_f_8obitools_5align_8_dynamic_18DynamicProgramming_backtrack; #endif - if (PyType_Ready(&__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming.tp_dict, __pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "DynamicProgramming", (PyObject *)&__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming.tp_dict, __pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "DynamicProgramming", (PyObject *)&__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = &__pyx_type_8obitools_5align_8_dynamic_DynamicProgramming; /*--- Type import code ---*/ /*--- Function import code ---*/ @@ -3828,33 +4158,54 @@ PyMODINIT_FUNC PyInit__dynamic(void) __Pyx_DECREF(__pyx_2); __pyx_2 = 0; __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":109 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":21 + * + * from _dynamic cimport * + * from Cython.Shadow import NULL # <<<<<<<<<<<<<< + * + * cdef AlignMatrix* allocateMatrix(int hsize, int vsize,AlignMatrix *matrix=NULL): + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_NULL); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_NULL); + __Pyx_GIVEREF(__pyx_kp_NULL); + __pyx_1 = __Pyx_Import(__pyx_kp_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_NULL, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":143 * * * cdef int aascii = ord(b'a') # <<<<<<<<<<<<<< * cdef int _basecode[26] * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_2); - __Pyx_GIVEREF(__pyx_kp_2); - __pyx_t_2 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_kp_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_3); + __Pyx_GIVEREF(__pyx_kp_3); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_8obitools_5align_8_dynamic_aascii = __pyx_t_3; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":289 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":335 * # initialize iupac carray * * __basecode=[1,14,2,13,0,0,4,11,0,0,12,0,3,15,0,0,0,5,6,8,8,7,9,0,10,0] # <<<<<<<<<<<<<< * for i in range(26): * _basecode[i]=__basecode[i] */ - __pyx_t_2 = PyList_New(26); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(26); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_int_1); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -3934,28 +4285,28 @@ PyMODINIT_FUNC PyInit__dynamic(void) __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_2, 25, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - if (PyObject_SetAttr(__pyx_m, __pyx_kp___basecode, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_kp___basecode, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":290 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":336 * * __basecode=[1,14,2,13,0,0,4,11,0,0,12,0,3,15,0,0,0,5,6,8,8,7,9,0,10,0] * for i in range(26): # <<<<<<<<<<<<<< * _basecode[i]=__basecode[i] * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_int_26); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_26); __Pyx_GIVEREF(__pyx_int_26); - __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3969,34 +4320,34 @@ PyMODINIT_FUNC PyInit__dynamic(void) } else { __pyx_t_1 = PyIter_Next(__pyx_t_2); if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_1); } - if (PyObject_SetAttr(__pyx_m, __pyx_kp_i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_kp_i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":291 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pyx":337 * __basecode=[1,14,2,13,0,0,4,11,0,0,12,0,3,15,0,0,0,5,6,8,8,7,9,0,10,0] * for i in range(26): * _basecode[i]=__basecode[i] # <<<<<<<<<<<<<< * * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp___basecode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp___basecode); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_i); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_i); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_2); - __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_3); __Pyx_DECREF(__pyx_1); __pyx_1 = 0; __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_3); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_3); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_i); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_i); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_1); __pyx_1 = 0; (__pyx_v_8obitools_5align_8_dynamic__basecode[__pyx_t_5]) = __pyx_t_3; } @@ -4237,43 +4588,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { return result; } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); -} - -static INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); -} - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); - } - } - return item; -} - -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} - static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); diff --git a/src/obitools/align/_dynamic.pxd b/src/obitools/align/_dynamic.pxd index ee73b7b..23626c2 100644 --- a/src/obitools/align/_dynamic.pxd +++ b/src/obitools/align/_dynamic.pxd @@ -39,6 +39,20 @@ cdef alignSequence* allocateSequence(object bioseq, alignSequence* seq=?) cdef void freeSequence(alignSequence* seq) +cdef struct alignPath: + long length + long buffsize + long vStart + long hStart + long *path + +cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) + +cdef void reversePath(alignPath* path) + + +cdef void freePath(alignPath* path) + cdef int bitCount(int x) cpdef bint iupacMatch(unsigned char a, unsigned char b) @@ -52,6 +66,7 @@ cdef class DynamicProgramming: cdef alignSequence* hSeq cdef alignSequence* vSeq + cdef alignPath* path cdef double _opengap cdef double _extgap @@ -65,5 +80,7 @@ cdef class DynamicProgramming: cdef double matchScore(self,int h, int v) cdef double doAlignment(self) except? 0 cdef void reset(self) - cdef inline int index(self,x,y) - + cdef inline int index(self, int x, int y) + cdef inline bint _needToCompute(self) + cdef void backtrack(self) + diff --git a/src/obitools/align/_dynamic.pyx b/src/obitools/align/_dynamic.pyx index fde20e6..dd27da7 100644 --- a/src/obitools/align/_dynamic.pyx +++ b/src/obitools/align/_dynamic.pyx @@ -18,6 +18,7 @@ from obitools.alignment import Alignment # from _dynamic cimport * +from Cython.Shadow import NULL cdef AlignMatrix* allocateMatrix(int hsize, int vsize,AlignMatrix *matrix=NULL): @@ -104,7 +105,40 @@ cdef void freeSequence(alignSequence* seq): free(seq.quality) free(seq) +cdef alignPath* allocatePath(long l1,long l2,alignPath* path=NULL): + cdef long length=l1+l2 + if path is NULL: + path = malloc(sizeof(alignPath)) + path.length=0 + path.buffsize=0 + path.path=NULL + + if length > path.buffsize: + path.buffsize=length + path.path=realloc(path.path,sizeof(long)*length) + + path.length=0 + path.vStart=0 + path.hStart=0 + + return path + +cdef void reversePath(alignPath* path): + cdef long i + cdef long j + + j=path.length + for i in range(path.length/2): + j-=1 + path.path[i],path.path[j]=path.path[j],path.path[i] + +cdef void freePath(alignPath* path): + if path is not NULL: + if path.path is not NULL: + free(path.path) + free(path) + cdef int aascii = ord(b'a') cdef int _basecode[26] @@ -139,6 +173,7 @@ cdef class DynamicProgramming: self.matrix=NULL self.hSeq=NULL self.vSeq=NULL + self.path=NULL self.horizontalSeq=None self.verticalSeq=None @@ -164,6 +199,12 @@ cdef class DynamicProgramming: cdef double doAlignment(self) except? 0: pass + cdef bint _needToCompute(self): + return self.scoreChanged or self.sequenceChanged + + cdef void backtrack(self): + pass + property seqA: def __get__(self): return self.horizontalSeq @@ -210,7 +251,7 @@ cdef class DynamicProgramming: self.scoreChanged=True resetMatrix(self.matrix) - cdef inline int index(self,x,y): + cdef inline int index(self, int x, int y): return (self.hSeq.length+1) * y + x @@ -219,6 +260,7 @@ cdef class DynamicProgramming: freeMatrix(self.matrix) freeSequence(self.hSeq) freeSequence(self.vSeq) + freePath(self.path) def __call__(self): cdef list hgaps=[] @@ -229,13 +271,15 @@ cdef class DynamicProgramming: cdef int lenh=0 cdef int lenv=0 cdef int h,v,p + cdef int i cdef object ali cdef double score - if self.needToCompute: + if self._needToCompute(): score = self.doAlignment() - h,v,b=self.backtrack() - for p in b: + self.backtrack() + for i in range(self.path.length-1,-1,-1): + p=self.path.path[i] if p==0: hp+=1 vp+=1 @@ -258,7 +302,7 @@ cdef class DynamicProgramming: vgaps.append([vp,0]) if lenh < self.hSeq.length: - hseq=self.horizontalSeq[h:h+lenh] + hseq=self.horizontalSeq[self.path.hStart:self.path.hStart+lenh] else: hseq=self.horizontalSeq @@ -266,7 +310,7 @@ cdef class DynamicProgramming: hseq.gaps=hgaps if lenv < self.vSeq.length: - vseq=self.verticalSeq[v:v+lenv] + vseq=self.verticalSeq[self.path.vStart:self.path.vStart+lenv] else: vseq=self.verticalSeq @@ -276,10 +320,12 @@ cdef class DynamicProgramming: ali=Alignment() ali.append(hseq) ali.append(vseq) + ali.score=score self.alignment=ali - - return self.alignment.clone() + ali=self.alignment.clone() + ali.score=self.alignment.score + return ali diff --git a/src/obitools/align/_lcs.c b/src/obitools/align/_lcs.c index 6aa6902..94d8b0a 100644 --- a/src/obitools/align/_lcs.c +++ b/src/obitools/align/_lcs.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Sun Nov 8 08:26:04 2009 */ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:11 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -335,6 +335,11 @@ static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ @@ -423,7 +428,36 @@ struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence { struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *seq; }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":47 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":42 + * cdef void freeSequence(alignSequence* seq) + * + * cdef struct alignPath: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignPath { + long length; + long buffsize; + long vStart; + long hStart; + long *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":49 + * long *path + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) * * cdef class DynamicProgramming: # <<<<<<<<<<<<<< @@ -439,6 +473,7 @@ struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming { PyObject *verticalSeq; struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *hSeq; struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *vSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; double _opengap; double _extgap; PyObject *alignment; @@ -459,7 +494,7 @@ struct __pyx_obj_8obitools_5align_4_lcs_LCS { }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":47 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) * * cdef class DynamicProgramming: # <<<<<<<<<<<<<< @@ -472,7 +507,9 @@ struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming { double (*matchScore)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); double (*doAlignment)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); void (*reset)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); - int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, PyObject *, PyObject *); + int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + int (*_needToCompute)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*backtrack)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); }; static struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming; @@ -497,6 +534,9 @@ static void (*__pyx_f_8obitools_5align_8_dynamic_freeMatrix)(struct __pyx_t_8obi static void (*__pyx_f_8obitools_5align_8_dynamic_resetMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(*__pyx_f_8obitools_5align_8_dynamic_allocateSequence)(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args); /*proto*/ static void (*__pyx_f_8obitools_5align_8_dynamic_freeSequence)(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(*__pyx_f_8obitools_5align_8_dynamic_allocatePath)(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_reversePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ static int (*__pyx_f_8obitools_5align_8_dynamic_bitCount)(int); /*proto*/ static int (*__pyx_f_8obitools_5align_8_dynamic_iupacMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ static double (*__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ @@ -513,8 +553,6 @@ static char __pyx_k___main__[] = "__main__"; static PyObject *__pyx_kp___main__; static char __pyx_k___init__[] = "__init__"; static PyObject *__pyx_kp___init__; -static char __pyx_k_backtrack[] = "backtrack"; -static PyObject *__pyx_kp_backtrack; static char __pyx_k_opengap[] = "opengap"; static PyObject *__pyx_kp_opengap; static char __pyx_k_extgap[] = "extgap"; @@ -632,7 +670,6 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; __Pyx_SetupRefcountContext("doAlignment"); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":31 @@ -683,10 +720,7 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * self.matrix.matrix[idx].score = 0 * self.matrix.matrix[idx].path = j */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_int_0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, 0); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":37 * for j in range(1,self.hSeq.length+1): @@ -724,10 +758,7 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * self.matrix.matrix[idx].score = 0 * self.matrix.matrix[idx].path = -i */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_int_0, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), 0, __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":42 * for i in range(1,self.vSeq.length+1): @@ -775,13 +806,7 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), * scoremax = self.matrix.matrix[idx].score + \ */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_j - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong((__pyx_v_i - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), (__pyx_v_j - 1), (__pyx_v_i - 1)); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":52 * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), @@ -808,13 +833,7 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * score = self.matrix.matrix[idx].score * if score > scoremax : */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_j - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), (__pyx_v_j - 1), __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":59 * # 2 - open horizontal gap @@ -896,13 +915,7 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * score = self.matrix.matrix[idx].score * if score > scoremax : */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong((__pyx_v_i - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, (__pyx_v_i - 1)); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":70 * # 3 - open vertical gap @@ -984,13 +997,7 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * self.matrix.matrix[idx].score = scoremax * self.matrix.matrix[idx].path = path */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":80 * @@ -1040,20 +1047,14 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ * return self.matrix.matrix[idx].score * */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.hSeq->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->__pyx_base.vSeq->length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_self->__pyx_base.hSeq->length, __pyx_v_self->__pyx_base.vSeq->length); /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":87 * * idx = self.index(self.hSeq.length,self.vSeq.length) * return self.matrix.matrix[idx].score # <<<<<<<<<<<<<< * - * def backtrack(self): + * cdef void backtrack(self): */ __pyx_r = (__pyx_v_self->__pyx_base.matrix->matrix[__pyx_v_idx]).score; goto __pyx_L0; @@ -1062,7 +1063,6 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("obitools.align._lcs.LCS.doAlignment"); __pyx_r = 0; __pyx_L0:; @@ -1073,37 +1073,21 @@ static double __pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment(struct __pyx_obj_ /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":89 * return self.matrix.matrix[idx].score * - * def backtrack(self): # <<<<<<<<<<<<<< - * cdef list path=[] + * cdef void backtrack(self): # <<<<<<<<<<<<<< + * #cdef list path=[] * cdef int i */ -static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_v_path = 0; +static void __pyx_f_8obitools_5align_4_lcs_3LCS_backtrack(struct __pyx_obj_8obitools_5align_4_lcs_LCS *__pyx_v_self) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_p; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - double __pyx_t_2; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath __pyx_1; + double __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; __Pyx_SetupRefcountContext("backtrack"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":90 - * - * def backtrack(self): - * cdef list path=[] # <<<<<<<<<<<<<< - * cdef int i - * cdef int j - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_path = __pyx_t_1; - __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":95 * cdef int p * @@ -1111,32 +1095,44 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ * i=self.vSeq.length * j=self.hSeq.length */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)((struct __pyx_obj_8obitools_5align_4_lcs_LCS *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_2 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":96 * * self.doAlignment() * i=self.vSeq.length # <<<<<<<<<<<<<< * j=self.hSeq.length - * + * self.path=allocatePath(i,j,self.path) */ - __pyx_v_i = ((struct __pyx_obj_8obitools_5align_4_lcs_LCS *)__pyx_v_self)->__pyx_base.vSeq->length; + __pyx_v_i = __pyx_v_self->__pyx_base.vSeq->length; /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":97 * self.doAlignment() * i=self.vSeq.length * j=self.hSeq.length # <<<<<<<<<<<<<< + * self.path=allocatePath(i,j,self.path) + * + */ + __pyx_v_j = __pyx_v_self->__pyx_base.hSeq->length; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":98 + * i=self.vSeq.length + * j=self.hSeq.length + * self.path=allocatePath(i,j,self.path) # <<<<<<<<<<<<<< * * while (i or j): */ - __pyx_v_j = ((struct __pyx_obj_8obitools_5align_4_lcs_LCS *)__pyx_v_self)->__pyx_base.hSeq->length; + __pyx_1.__pyx_n = 1; + __pyx_1.path = __pyx_v_self->__pyx_base.path; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocatePath(__pyx_v_i, __pyx_v_j, &__pyx_1); + __pyx_v_self->__pyx_base.path = __pyx_t_2; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":99 - * j=self.hSeq.length + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":100 + * self.path=allocatePath(i,j,self.path) * * while (i or j): # <<<<<<<<<<<<<< * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) + * self.path.path[self.path.length]=p */ while (1) { if (!__pyx_v_i) { @@ -1146,36 +1142,36 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ } if (!__pyx_t_3) break; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":100 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":101 * * while (i or j): * p=self.matrix.matrix[self.index(j,i)].path # <<<<<<<<<<<<<< - * path.append(p) - * if p==0: + * self.path.path[self.path.length]=p + * self.path.length+=1 */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_p = (((struct __pyx_obj_8obitools_5align_4_lcs_LCS *)__pyx_v_self)->__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)((struct __pyx_obj_8obitools_5align_4_lcs_LCS *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_4)]).path; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":101 - * while (i or j): - * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) # <<<<<<<<<<<<<< - * if p==0: - * i-=1 - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_p); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_path), __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_p = (__pyx_v_self->__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i)]).path; /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":102 + * while (i or j): * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) + * self.path.path[self.path.length]=p # <<<<<<<<<<<<<< + * self.path.length+=1 + * # path.append(p) + */ + (__pyx_v_self->__pyx_base.path->path[__pyx_v_self->__pyx_base.path->length]) = __pyx_v_p; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":103 + * p=self.matrix.matrix[self.index(j,i)].path + * self.path.path[self.path.length]=p + * self.path.length+=1 # <<<<<<<<<<<<<< + * # path.append(p) + * if p==0: + */ + __pyx_v_self->__pyx_base.path->length += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":105 + * self.path.length+=1 + * # path.append(p) * if p==0: # <<<<<<<<<<<<<< * i-=1 * j-=1 @@ -1183,8 +1179,8 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ __pyx_t_3 = (__pyx_v_p == 0); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":103 - * path.append(p) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":106 + * # path.append(p) * if p==0: * i-=1 # <<<<<<<<<<<<<< * j-=1 @@ -1192,7 +1188,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ */ __pyx_v_i -= 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":104 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":107 * if p==0: * i-=1 * j-=1 # <<<<<<<<<<<<<< @@ -1200,10 +1196,10 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ * i+=p */ __pyx_v_j -= 1; - goto __pyx_L7; + goto __pyx_L5; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":105 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":108 * i-=1 * j-=1 * elif p < 0: # <<<<<<<<<<<<<< @@ -1213,7 +1209,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ __pyx_t_3 = (__pyx_v_p < 0); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":106 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":109 * j-=1 * elif p < 0: * i+=p # <<<<<<<<<<<<<< @@ -1221,66 +1217,45 @@ static PyObject *__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack(PyObject *__pyx_ * j-=p */ __pyx_v_i += __pyx_v_p; - goto __pyx_L7; + goto __pyx_L5; } /*else*/ { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":108 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":111 * i+=p * else: * j-=p # <<<<<<<<<<<<<< * - * path.reverse() + * #path.reverse() */ __pyx_v_j -= __pyx_v_p; } - __pyx_L7:; + __pyx_L5:; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":110 - * j-=p - * - * path.reverse() # <<<<<<<<<<<<<< - * return 0,0,path + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":115 + * #path.reverse() + * #reversePath(self.path) + * self.path.hStart=0 # <<<<<<<<<<<<<< + * self.path.vStart=0 + * #return 0,0,path + */ + __pyx_v_self->__pyx_base.path->hStart = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":116 + * #reversePath(self.path) + * self.path.hStart=0 + * self.path.vStart=0 # <<<<<<<<<<<<<< + * #return 0,0,path * */ - __pyx_t_5 = PyList_Reverse(((PyObject *)__pyx_v_path)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->__pyx_base.path->vStart = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_lcs.pyx":111 - * - * path.reverse() - * return 0,0,path # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(((PyObject *)__pyx_v_path)); - PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_path)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_path)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("obitools.align._lcs.LCS.backtrack"); - __pyx_r = NULL; + __Pyx_WriteUnraisable("obitools.align._lcs.LCS.backtrack"); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_path); - __Pyx_XGIVEREF(__pyx_r); __Pyx_FinishRefcountContext(); - return __pyx_r; } static struct __pyx_vtabstruct_8obitools_5align_4_lcs_LCS __pyx_vtable_8obitools_5align_4_lcs_LCS; @@ -1313,7 +1288,6 @@ static int __pyx_tp_clear_8obitools_5align_4_lcs_LCS(PyObject *o) { } static struct PyMethodDef __pyx_methods_8obitools_5align_4_lcs_LCS[] = { - {__Pyx_NAMESTR("backtrack"), (PyCFunction)__pyx_pf_8obitools_5align_4_lcs_3LCS_backtrack, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -1486,7 +1460,6 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp_backtrack, __pyx_k_backtrack, sizeof(__pyx_k_backtrack), 1, 1, 1}, {&__pyx_kp_opengap, __pyx_k_opengap, sizeof(__pyx_k_opengap), 1, 1, 1}, {&__pyx_kp_extgap, __pyx_k_extgap, sizeof(__pyx_k_extgap), 1, 1, 1}, {&__pyx_kp_needToCompute, __pyx_k_needToCompute, sizeof(__pyx_k_needToCompute), 1, 1, 1}, @@ -1574,9 +1547,11 @@ PyMODINIT_FUNC PyInit__lcs(void) #if PY_MAJOR_VERSION >= 3 __pyx_vtable_8obitools_5align_4_lcs_LCS.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_4_lcs_3LCS_matchScore; __pyx_vtable_8obitools_5align_4_lcs_LCS.__pyx_base.doAlignment = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment; + __pyx_vtable_8obitools_5align_4_lcs_LCS.__pyx_base.backtrack = (void (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_4_lcs_3LCS_backtrack; #else *(void(**)(void))&__pyx_vtable_8obitools_5align_4_lcs_LCS.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_4_lcs_3LCS_matchScore; *(void(**)(void))&__pyx_vtable_8obitools_5align_4_lcs_LCS.__pyx_base.doAlignment = (void(*)(void))__pyx_f_8obitools_5align_4_lcs_3LCS_doAlignment; + *(void(**)(void))&__pyx_vtable_8obitools_5align_4_lcs_LCS.__pyx_base.backtrack = (void(*)(void))__pyx_f_8obitools_5align_4_lcs_3LCS_backtrack; #endif __pyx_type_8obitools_5align_4_lcs_LCS.tp_base = __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming; if (PyType_Ready(&__pyx_type_8obitools_5align_4_lcs_LCS) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1591,6 +1566,9 @@ PyMODINIT_FUNC PyInit__lcs(void) if (__Pyx_ImportFunction(__pyx_1, "resetMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "allocateSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "freeSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocatePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "reversePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "bitCount", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "iupacMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "iupacPartialMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2041,6 +2019,68 @@ static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { } } +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, diff --git a/src/obitools/align/_lcs.pyx b/src/obitools/align/_lcs.pyx index 7281cc8..7de9ae9 100644 --- a/src/obitools/align/_lcs.pyx +++ b/src/obitools/align/_lcs.pyx @@ -86,8 +86,8 @@ cdef class LCS(DynamicProgramming): idx = self.index(self.hSeq.length,self.vSeq.length) return self.matrix.matrix[idx].score - def backtrack(self): - cdef list path=[] + cdef void backtrack(self): + #cdef list path=[] cdef int i cdef int j cdef int p @@ -95,10 +95,13 @@ cdef class LCS(DynamicProgramming): self.doAlignment() i=self.vSeq.length j=self.hSeq.length + self.path=allocatePath(i,j,self.path) while (i or j): p=self.matrix.matrix[self.index(j,i)].path - path.append(p) + self.path.path[self.path.length]=p + self.path.length+=1 +# path.append(p) if p==0: i-=1 j-=1 @@ -107,8 +110,11 @@ cdef class LCS(DynamicProgramming): else: j-=p - path.reverse() - return 0,0,path + #path.reverse() + #reversePath(self.path) + self.path.hStart=0 + self.path.vStart=0 + #return 0,0,path diff --git a/src/obitools/align/_nws.c b/src/obitools/align/_nws.c index bf88ace..7fa0a95 100644 --- a/src/obitools/align/_nws.c +++ b/src/obitools/align/_nws.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Sun Nov 8 08:26:04 2009 */ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:11 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -337,6 +337,11 @@ static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ @@ -425,7 +430,36 @@ struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence { struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *seq; }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":47 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":42 + * cdef void freeSequence(alignSequence* seq) + * + * cdef struct alignPath: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignPath { + long length; + long buffsize; + long vStart; + long hStart; + long *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":49 + * long *path + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) * * cdef class DynamicProgramming: # <<<<<<<<<<<<<< @@ -441,6 +475,7 @@ struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming { PyObject *verticalSeq; struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *hSeq; struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *vSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; double _opengap; double _extgap; PyObject *alignment; @@ -463,7 +498,7 @@ struct __pyx_obj_8obitools_5align_4_nws_NWS { }; -/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":47 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) * * cdef class DynamicProgramming: # <<<<<<<<<<<<<< @@ -476,7 +511,9 @@ struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming { double (*matchScore)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); double (*doAlignment)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); void (*reset)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); - int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, PyObject *, PyObject *); + int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + int (*_needToCompute)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*backtrack)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); }; static struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming; @@ -501,6 +538,9 @@ static void (*__pyx_f_8obitools_5align_8_dynamic_freeMatrix)(struct __pyx_t_8obi static void (*__pyx_f_8obitools_5align_8_dynamic_resetMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(*__pyx_f_8obitools_5align_8_dynamic_allocateSequence)(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args); /*proto*/ static void (*__pyx_f_8obitools_5align_8_dynamic_freeSequence)(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(*__pyx_f_8obitools_5align_8_dynamic_allocatePath)(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_reversePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ static int (*__pyx_f_8obitools_5align_8_dynamic_bitCount)(int); /*proto*/ static int (*__pyx_f_8obitools_5align_8_dynamic_iupacMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ static double (*__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ @@ -516,13 +556,10 @@ static PyObject *__pyx_int_neg_6; static PyObject *__pyx_int_neg_8; static PyObject *__pyx_int_neg_2; static PyObject *__pyx_int_1; -static PyObject *__pyx_int_0; static char __pyx_k___main__[] = "__main__"; static PyObject *__pyx_kp___main__; static char __pyx_k___init__[] = "__init__"; static PyObject *__pyx_kp___init__; -static char __pyx_k_backtrack[] = "backtrack"; -static PyObject *__pyx_kp_backtrack; static char __pyx_k_match[] = "match"; static PyObject *__pyx_kp_match; static char __pyx_k_mismatch[] = "mismatch"; @@ -743,7 +780,6 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; __Pyx_SetupRefcountContext("doAlignment"); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":34 @@ -794,10 +830,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (j-1)) * self.matrix.matrix[idx].path = j */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_int_0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, 0); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":40 * for j in range(1,self.hSeq.length+1): @@ -835,10 +868,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (i-1)) * self.matrix.matrix[idx].path = -i */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_int_0, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), 0, __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":45 * for i in range(1,self.vSeq.length+1): @@ -886,13 +916,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), * scoremax = self.matrix.matrix[idx].score + \ */ - __pyx_t_1 = PyInt_FromLong((__pyx_v_j - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong((__pyx_v_i - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), (__pyx_v_j - 1), (__pyx_v_i - 1)); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":55 * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), @@ -919,13 +943,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * score = self.matrix.matrix[idx].score + \ * self._opengap */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_j - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), (__pyx_v_j - 1), __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":63 * idx = self.index(j-1,i) @@ -974,13 +992,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * score = self.matrix.matrix[idx].score + \ * self._opengap */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong((__pyx_v_i - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, (__pyx_v_i - 1)); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":71 * idx = self.index(j,i-1) @@ -1048,13 +1060,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * delta = j-jump * score = self.matrix.matrix[idx].score + \ */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_jump); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_jump, __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":80 * if jump >= 0: @@ -1134,13 +1140,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * delta = i-jump * score = self.matrix.matrix[idx].score + \ */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong(__pyx_v_jump); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_jump); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":91 * if jump >= 0: @@ -1201,13 +1201,7 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * self.matrix.matrix[idx].score = scoremax * self.matrix.matrix[idx].path = path */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_5, __pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":99 * @@ -1300,20 +1294,14 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ * return self.matrix.matrix[idx].score * */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.hSeq->length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->__pyx_base.vSeq->length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_self->__pyx_base.hSeq->length, __pyx_v_self->__pyx_base.vSeq->length); /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":111 * * idx = self.index(self.hSeq.length,self.vSeq.length) * return self.matrix.matrix[idx].score # <<<<<<<<<<<<<< * - * def backtrack(self): + * cdef void backtrack(self): */ __pyx_r = (__pyx_v_self->__pyx_base.matrix->matrix[__pyx_v_idx]).score; goto __pyx_L0; @@ -1322,7 +1310,6 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("obitools.align._nws.NWS.doAlignment"); __pyx_r = 0; __pyx_L0:; @@ -1333,37 +1320,21 @@ static double __pyx_f_8obitools_5align_4_nws_3NWS_doAlignment(struct __pyx_obj_ /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":113 * return self.matrix.matrix[idx].score * - * def backtrack(self): # <<<<<<<<<<<<<< - * cdef list path=[] + * cdef void backtrack(self): # <<<<<<<<<<<<<< + * #cdef list path=[] * cdef int i */ -static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_v_path = 0; +static void __pyx_f_8obitools_5align_4_nws_3NWS_backtrack(struct __pyx_obj_8obitools_5align_4_nws_NWS *__pyx_v_self) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_p; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - double __pyx_t_2; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath __pyx_1; + double __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; __Pyx_SetupRefcountContext("backtrack"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":114 - * - * def backtrack(self): - * cdef list path=[] # <<<<<<<<<<<<<< - * cdef int i - * cdef int j - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_path = __pyx_t_1; - __pyx_t_1 = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":119 * cdef int p * @@ -1371,32 +1342,44 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ * i=self.vSeq.length * j=self.hSeq.length */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_2 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_1 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":120 * * self.doAlignment() * i=self.vSeq.length # <<<<<<<<<<<<<< * j=self.hSeq.length - * + * self.path=allocatePath(i,j,self.path) */ - __pyx_v_i = ((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->__pyx_base.vSeq->length; + __pyx_v_i = __pyx_v_self->__pyx_base.vSeq->length; /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":121 * self.doAlignment() * i=self.vSeq.length * j=self.hSeq.length # <<<<<<<<<<<<<< + * self.path=allocatePath(i,j,self.path) + * + */ + __pyx_v_j = __pyx_v_self->__pyx_base.hSeq->length; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":122 + * i=self.vSeq.length + * j=self.hSeq.length + * self.path=allocatePath(i,j,self.path) # <<<<<<<<<<<<<< * * while (i or j): */ - __pyx_v_j = ((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->__pyx_base.hSeq->length; + __pyx_1.__pyx_n = 1; + __pyx_1.path = __pyx_v_self->__pyx_base.path; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocatePath(__pyx_v_i, __pyx_v_j, &__pyx_1); + __pyx_v_self->__pyx_base.path = __pyx_t_2; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":123 - * j=self.hSeq.length + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":124 + * self.path=allocatePath(i,j,self.path) * * while (i or j): # <<<<<<<<<<<<<< * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) + * self.path.path[self.path.length]=p */ while (1) { if (!__pyx_v_i) { @@ -1406,36 +1389,36 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ } if (!__pyx_t_3) break; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":124 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":125 * * while (i or j): * p=self.matrix.matrix[self.index(j,i)].path # <<<<<<<<<<<<<< - * path.append(p) - * if p==0: + * self.path.path[self.path.length]=p + * self.path.length+=1 */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_p = (((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_t_1, __pyx_t_4)]).path; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":125 - * while (i or j): - * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) # <<<<<<<<<<<<<< - * if p==0: - * i-=1 - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_p); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_path), __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_p = (__pyx_v_self->__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i)]).path; /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":126 + * while (i or j): * p=self.matrix.matrix[self.index(j,i)].path - * path.append(p) + * self.path.path[self.path.length]=p # <<<<<<<<<<<<<< + * self.path.length+=1 + * #path.append(p) + */ + (__pyx_v_self->__pyx_base.path->path[__pyx_v_self->__pyx_base.path->length]) = __pyx_v_p; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":127 + * p=self.matrix.matrix[self.index(j,i)].path + * self.path.path[self.path.length]=p + * self.path.length+=1 # <<<<<<<<<<<<<< + * #path.append(p) + * if p==0: + */ + __pyx_v_self->__pyx_base.path->length += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":129 + * self.path.length+=1 + * #path.append(p) * if p==0: # <<<<<<<<<<<<<< * i-=1 * j-=1 @@ -1443,8 +1426,8 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ __pyx_t_3 = (__pyx_v_p == 0); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":127 - * path.append(p) + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":130 + * #path.append(p) * if p==0: * i-=1 # <<<<<<<<<<<<<< * j-=1 @@ -1452,7 +1435,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ */ __pyx_v_i -= 1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":128 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":131 * if p==0: * i-=1 * j-=1 # <<<<<<<<<<<<<< @@ -1460,10 +1443,10 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ * i+=p */ __pyx_v_j -= 1; - goto __pyx_L7; + goto __pyx_L5; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":129 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":132 * i-=1 * j-=1 * elif p < 0: # <<<<<<<<<<<<<< @@ -1473,7 +1456,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ __pyx_t_3 = (__pyx_v_p < 0); if (__pyx_t_3) { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":130 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":133 * j-=1 * elif p < 0: * i+=p # <<<<<<<<<<<<<< @@ -1481,69 +1464,48 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack(PyObject *__pyx_ * j-=p */ __pyx_v_i += __pyx_v_p; - goto __pyx_L7; + goto __pyx_L5; } /*else*/ { - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":132 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":135 * i+=p * else: * j-=p # <<<<<<<<<<<<<< * - * path.reverse() + * #path.reverse() */ __pyx_v_j -= __pyx_v_p; } - __pyx_L7:; + __pyx_L5:; } - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":134 - * j-=p - * - * path.reverse() # <<<<<<<<<<<<<< - * return 0,0,path + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":139 + * #path.reverse() + * #reversePath(self.path) + * self.path.hStart=0 # <<<<<<<<<<<<<< + * self.path.vStart=0 * */ - __pyx_t_5 = PyList_Reverse(((PyObject *)__pyx_v_path)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->__pyx_base.path->hStart = 0; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":135 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":140 + * #reversePath(self.path) + * self.path.hStart=0 + * self.path.vStart=0 # <<<<<<<<<<<<<< * - * path.reverse() - * return 0,0,path # <<<<<<<<<<<<<< - * - * property match: + * #return 0,0,path */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(((PyObject *)__pyx_v_path)); - PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_path)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_path)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_v_self->__pyx_base.path->vStart = 0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("obitools.align._nws.NWS.backtrack"); - __pyx_r = NULL; + __Pyx_WriteUnraisable("obitools.align._nws.NWS.backtrack"); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_path); - __Pyx_XGIVEREF(__pyx_r); __Pyx_FinishRefcountContext(); - return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":138 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":145 * * property match: * def __get__(self): # <<<<<<<<<<<<<< @@ -1557,7 +1519,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_5match___get__(PyObject *_ PyObject *__pyx_t_1 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":139 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":146 * property match: * def __get__(self): * return self._match # <<<<<<<<<<<<<< @@ -1565,7 +1527,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_5match___get__(PyObject *_ * def __set__(self,match): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->_match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1583,7 +1545,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_5match___get__(PyObject *_ return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":141 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":148 * return self._match * * def __set__(self,match): # <<<<<<<<<<<<<< @@ -1597,17 +1559,17 @@ static int __pyx_pf_8obitools_5align_4_nws_3NWS_5match___set__(PyObject *__pyx_v double __pyx_t_1; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":142 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":149 * * def __set__(self,match): * self._match=match # <<<<<<<<<<<<<< * self.scoreChanged=True * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_match); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_match); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->_match = __pyx_t_1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":143 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":150 * def __set__(self,match): * self._match=match * self.scoreChanged=True # <<<<<<<<<<<<<< @@ -1626,7 +1588,7 @@ static int __pyx_pf_8obitools_5align_4_nws_3NWS_5match___set__(PyObject *__pyx_v return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":146 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":153 * * property mismatch: * def __get__(self): # <<<<<<<<<<<<<< @@ -1640,7 +1602,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_8mismatch___get__(PyObject PyObject *__pyx_t_1 = NULL; __Pyx_SetupRefcountContext("__get__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":147 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":154 * property mismatch: * def __get__(self): * return self._mismatch # <<<<<<<<<<<<<< @@ -1648,7 +1610,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_8mismatch___get__(PyObject * def __set__(self,mismatch): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->_mismatch); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->_mismatch); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1666,7 +1628,7 @@ static PyObject *__pyx_pf_8obitools_5align_4_nws_3NWS_8mismatch___get__(PyObject return __pyx_r; } -/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":149 +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":156 * return self._mismatch * * def __set__(self,mismatch): # <<<<<<<<<<<<<< @@ -1680,17 +1642,17 @@ static int __pyx_pf_8obitools_5align_4_nws_3NWS_8mismatch___set__(PyObject *__py double __pyx_t_1; __Pyx_SetupRefcountContext("__set__"); - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":150 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":157 * * def __set__(self,mismatch): * self._mismatch=mismatch # <<<<<<<<<<<<<< * self.scoreChanged=True * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_mismatch); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_mismatch); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_8obitools_5align_4_nws_NWS *)__pyx_v_self)->_mismatch = __pyx_t_1; - /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":151 + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pyx":158 * def __set__(self,mismatch): * self._mismatch=mismatch * self.scoreChanged=True # <<<<<<<<<<<<<< @@ -1767,7 +1729,6 @@ static int __pyx_setprop_8obitools_5align_4_nws_3NWS_mismatch(PyObject *o, PyObj } static struct PyMethodDef __pyx_methods_8obitools_5align_4_nws_NWS[] = { - {__Pyx_NAMESTR("backtrack"), (PyCFunction)__pyx_pf_8obitools_5align_4_nws_3NWS_backtrack, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -1946,7 +1907,6 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp_backtrack, __pyx_k_backtrack, sizeof(__pyx_k_backtrack), 1, 1, 1}, {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, {&__pyx_kp_mismatch, __pyx_k_mismatch, sizeof(__pyx_k_mismatch), 1, 1, 1}, {&__pyx_kp_opengap, __pyx_k_opengap, sizeof(__pyx_k_opengap), 1, 1, 1}, @@ -1968,7 +1928,6 @@ static int __Pyx_InitGlobals(void) { __pyx_int_neg_8 = PyInt_FromLong(-8); if (unlikely(!__pyx_int_neg_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; @@ -2040,9 +1999,11 @@ PyMODINIT_FUNC PyInit__nws(void) #if PY_MAJOR_VERSION >= 3 __pyx_vtable_8obitools_5align_4_nws_NWS.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_4_nws_3NWS_matchScore; __pyx_vtable_8obitools_5align_4_nws_NWS.__pyx_base.doAlignment = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_4_nws_3NWS_doAlignment; + __pyx_vtable_8obitools_5align_4_nws_NWS.__pyx_base.backtrack = (void (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_4_nws_3NWS_backtrack; #else *(void(**)(void))&__pyx_vtable_8obitools_5align_4_nws_NWS.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_4_nws_3NWS_matchScore; *(void(**)(void))&__pyx_vtable_8obitools_5align_4_nws_NWS.__pyx_base.doAlignment = (void(*)(void))__pyx_f_8obitools_5align_4_nws_3NWS_doAlignment; + *(void(**)(void))&__pyx_vtable_8obitools_5align_4_nws_NWS.__pyx_base.backtrack = (void(*)(void))__pyx_f_8obitools_5align_4_nws_3NWS_backtrack; #endif __pyx_type_8obitools_5align_4_nws_NWS.tp_base = __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming; if (PyType_Ready(&__pyx_type_8obitools_5align_4_nws_NWS) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2057,6 +2018,9 @@ PyMODINIT_FUNC PyInit__nws(void) if (__Pyx_ImportFunction(__pyx_1, "resetMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "allocateSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "freeSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocatePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "reversePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "bitCount", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "iupacMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_1, "iupacPartialMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2565,6 +2529,68 @@ static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { } } +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, diff --git a/src/obitools/align/_nws.pxd b/src/obitools/align/_nws.pxd index ab45db7..9ed1e7f 100644 --- a/src/obitools/align/_nws.pxd +++ b/src/obitools/align/_nws.pxd @@ -4,4 +4,7 @@ cdef class NWS(DynamicProgramming): cdef double _match cdef double _mismatch + cdef double matchScore(self,int h, int v) + cdef double doAlignment(self) except? 0 + diff --git a/src/obitools/align/_nws.pyx b/src/obitools/align/_nws.pyx index 2ecd247..cfdd5c2 100644 --- a/src/obitools/align/_nws.pyx +++ b/src/obitools/align/_nws.pyx @@ -110,8 +110,8 @@ cdef class NWS(DynamicProgramming): idx = self.index(self.hSeq.length,self.vSeq.length) return self.matrix.matrix[idx].score - def backtrack(self): - cdef list path=[] + cdef void backtrack(self): + #cdef list path=[] cdef int i cdef int j cdef int p @@ -119,10 +119,13 @@ cdef class NWS(DynamicProgramming): self.doAlignment() i=self.vSeq.length j=self.hSeq.length + self.path=allocatePath(i,j,self.path) while (i or j): p=self.matrix.matrix[self.index(j,i)].path - path.append(p) + self.path.path[self.path.length]=p + self.path.length+=1 + #path.append(p) if p==0: i-=1 j-=1 @@ -131,8 +134,12 @@ cdef class NWS(DynamicProgramming): else: j-=p - path.reverse() - return 0,0,path + #path.reverse() + #reversePath(self.path) + self.path.hStart=0 + self.path.vStart=0 + + #return 0,0,path property match: def __get__(self): diff --git a/src/obitools/align/_qsassemble.c b/src/obitools/align/_qsassemble.c new file mode 100644 index 0000000..85263fa --- /dev/null +++ b/src/obitools/align/_qsassemble.c @@ -0,0 +1,2969 @@ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:11 2010 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +#include +#define __PYX_HAVE_API__obitools__align___qsassemble +#include "stdlib.h" +#include "string.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; +static const char **__pyx_f; + +static char __pyx_mdoc[] = "\nCreated on 6 Nov. 2009\n\n@author: coissac\n"; + + +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Type declarations */ + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":11 + * void memcpy(void* s1, void* s2, int n) + * + * cdef struct AlignCell : # <<<<<<<<<<<<<< + * double score + * int path + */ + +struct __pyx_t_8obitools_5align_8_dynamic_AlignCell { + double score; + int path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":15 + * int path + * + * cdef struct AlignMatrix : # <<<<<<<<<<<<<< + * AlignCell* matrix + * int* bestVJump + */ + +struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix { + struct __pyx_t_8obitools_5align_8_dynamic_AlignCell *matrix; + int *bestVJump; + int *bestHJump; + int msize; + int vsize; + int hsize; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":24 + * + * + * cdef AlignMatrix* allocateMatrix(int hsize, int vsize,AlignMatrix *matrix=?) # <<<<<<<<<<<<<< + * + * cdef void freeMatrix(AlignMatrix* matrix) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *matrix; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":31 + * + * + * cdef struct alignSequence: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignSequence { + long length; + long buffsize; + int hasQuality; + char *sequence; + double *quality; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":38 + * double* quality + * + * cdef alignSequence* allocateSequence(object bioseq, alignSequence* seq=?) # <<<<<<<<<<<<<< + * + * cdef void freeSequence(alignSequence* seq) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *seq; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":42 + * cdef void freeSequence(alignSequence* seq) + * + * cdef struct alignPath: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignPath { + long length; + long buffsize; + long vStart; + long hStart; + long *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":49 + * long *path + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 + * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) + * + * cdef class DynamicProgramming: # <<<<<<<<<<<<<< + * cdef AlignMatrix* matrix + * + */ + +struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming { + PyObject_HEAD + struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtab; + struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *matrix; + PyObject *horizontalSeq; + PyObject *verticalSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *hSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *vSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; + double _opengap; + double _extgap; + PyObject *alignment; + int sequenceChanged; + int scoreChanged; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":3 + * from _dynamic cimport * + * + * cdef class NWS(DynamicProgramming): # <<<<<<<<<<<<<< + * cdef double _match + * cdef double _mismatch + */ + +struct __pyx_obj_8obitools_5align_4_nws_NWS { + struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming __pyx_base; + double _match; + double _mismatch; +}; + +struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble { + struct __pyx_obj_8obitools_5align_4_nws_NWS __pyx_base; + double ysmax; + int ymax; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pxd":9 + * cdef double doAlignment(self) except? 0 + * + * cdef class ReverseAssemble(DirectAssemble): # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble { + struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble __pyx_base; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":12 + * + * + * cdef class QSolexaDirectAssemble(DirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double* hError + */ + +struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble { + struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble __pyx_base; + double *hError; + double *vError; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":59 + * + * + * cdef class QSolexaReverseAssemble(QSolexaDirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double matchScore(self,int h, int v): + */ + +struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble { + struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble __pyx_base; +}; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 + * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) + * + * cdef class DynamicProgramming: # <<<<<<<<<<<<<< + * cdef AlignMatrix* matrix + * + */ + +struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming { + int (*allocate)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + double (*matchScore)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + double (*doAlignment)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*reset)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + int (*_needToCompute)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*backtrack)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); +}; +static struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":3 + * from _dynamic cimport * + * + * cdef class NWS(DynamicProgramming): # <<<<<<<<<<<<<< + * cdef double _match + * cdef double _mismatch + */ + +struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS { + struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *__pyx_vtabptr_8obitools_5align_4_nws_NWS; + + +struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble { + struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble *__pyx_vtabptr_8obitools_5align_9_assemble_DirectAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":12 + * + * + * cdef class QSolexaDirectAssemble(DirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double* hError + */ + +struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaDirectAssemble { + struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *__pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":59 + * + * + * cdef class QSolexaReverseAssemble(QSolexaDirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double matchScore(self,int h, int v): + */ + +struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaReverseAssemble { + struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaDirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *__pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaReverseAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_assemble.pxd":9 + * cdef double doAlignment(self) except? 0 + * + * cdef class ReverseAssemble(DirectAssemble): # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_vtabstruct_8obitools_5align_9_assemble_ReverseAssemble { + struct __pyx_vtabstruct_8obitools_5align_9_assemble_DirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_9_assemble_ReverseAssemble *__pyx_vtabptr_8obitools_5align_9_assemble_ReverseAssemble; +/* Module declarations from obitools.align._dynamic */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = 0; +static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(*__pyx_f_8obitools_5align_8_dynamic_allocateMatrix)(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freeMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_resetMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(*__pyx_f_8obitools_5align_8_dynamic_allocateSequence)(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freeSequence)(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(*__pyx_f_8obitools_5align_8_dynamic_allocatePath)(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_reversePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static int (*__pyx_f_8obitools_5align_8_dynamic_bitCount)(int); /*proto*/ +static int (*__pyx_f_8obitools_5align_8_dynamic_iupacMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ +static double (*__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ +/* Module declarations from obitools.align._nws */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_4_nws_NWS = 0; +/* Module declarations from obitools.align._assemble */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_9_assemble_DirectAssemble = 0; +static PyTypeObject *__pyx_ptype_8obitools_5align_9_assemble_ReverseAssemble = 0; +/* Module declarations from obitools.align._qsassemble */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_11_qsassemble_QSolexaDirectAssemble = 0; +static PyTypeObject *__pyx_ptype_8obitools_5align_11_qsassemble_QSolexaReverseAssemble = 0; +#define __Pyx_MODULE_NAME "obitools.align._qsassemble" +int __pyx_module_is_main_obitools__align___qsassemble = 0; + +/* Implementation of obitools.align._qsassemble */ +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_neg_8; +static PyObject *__pyx_int_neg_2; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k___init__[] = "__init__"; +static PyObject *__pyx_kp___init__; +static char __pyx_k_match[] = "match"; +static PyObject *__pyx_kp_match; +static char __pyx_k_opengap[] = "opengap"; +static PyObject *__pyx_kp_opengap; +static char __pyx_k_extgap[] = "extgap"; +static PyObject *__pyx_kp_extgap; +static char __pyx_k_seq[] = "seq"; +static PyObject *__pyx_kp_seq; +static char __pyx_k_8[] = "quality"; +static PyObject *__pyx_kp_8; +static char __pyx_k_quality[] = "quality"; +static PyObject *__pyx_kp_quality; +static char __pyx_k_buffer_info[] = "buffer_info"; +static PyObject *__pyx_kp_buffer_info; +static char __pyx_k_10[] = "quality"; +static PyObject *__pyx_kp_10; +static char __pyx_k_wrapped[] = "wrapped"; +static PyObject *__pyx_kp_wrapped; +static char __pyx_k_12[] = "quality"; +static PyObject *__pyx_kp_12; +static char __pyx_k_complement[] = "complement"; +static PyObject *__pyx_kp_complement; +static PyObject *__pyx_kp_9; +static char __pyx_k_9[] = "You must use sequence with quality indices"; +static PyObject *__pyx_kp_11; +static char __pyx_k_11[] = "You must use sequence with quality indices"; +static PyObject *__pyx_kp_13; +static char __pyx_k_13[] = "You must use sequence with quality indices"; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":17 + * cdef double* vError + * + * def __init__(self,match=4,opengap=-8,extgap=-2): # <<<<<<<<<<<<<< + * mismatch=-float(match)/3.0 + * DirectAssemble.__init__(self,match,mismatch,opengap,extgap) + */ + +static int __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_match = 0; + PyObject *__pyx_v_opengap = 0; + PyObject *__pyx_v_extgap = 0; + PyObject *__pyx_v_mismatch; + int __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_match,&__pyx_kp_opengap,&__pyx_kp_extgap,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[0] = __pyx_int_4; + values[1] = __pyx_int_neg_8; + values[2] = __pyx_int_neg_2; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_match); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_opengap); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extgap); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_match = values[0]; + __pyx_v_opengap = values[1]; + __pyx_v_extgap = values[2]; + } else { + __pyx_v_match = __pyx_int_4; + __pyx_v_opengap = __pyx_int_neg_8; + __pyx_v_extgap = __pyx_int_neg_2; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: __pyx_v_extgap = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_opengap = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_match = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("obitools.align._qsassemble.QSolexaDirectAssemble.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mismatch = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":18 + * + * def __init__(self,match=4,opengap=-8,extgap=-2): + * mismatch=-float(match)/3.0 # <<<<<<<<<<<<<< + * DirectAssemble.__init__(self,match,mismatch,opengap,extgap) + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_match); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_match); + __Pyx_GIVEREF(__pyx_v_match); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyFloat_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_1 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_1, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_mismatch); + __pyx_v_mismatch = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":19 + * def __init__(self,match=4,opengap=-8,extgap=-2): + * mismatch=-float(match)/3.0 + * DirectAssemble.__init__(self,match,mismatch,opengap,extgap) # <<<<<<<<<<<<<< + * + * cdef double matchScore(self,int h, int v): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8obitools_5align_9_assemble_DirectAssemble)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_match); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_match); + __Pyx_GIVEREF(__pyx_v_match); + __Pyx_INCREF(__pyx_v_mismatch); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_mismatch); + __Pyx_GIVEREF(__pyx_v_mismatch); + __Pyx_INCREF(__pyx_v_opengap); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_opengap); + __Pyx_GIVEREF(__pyx_v_opengap); + __Pyx_INCREF(__pyx_v_extgap); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_extgap); + __Pyx_GIVEREF(__pyx_v_extgap); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("obitools.align._qsassemble.QSolexaDirectAssemble.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_mismatch); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":21 + * DirectAssemble.__init__(self,match,mismatch,opengap,extgap) + * + * cdef double matchScore(self,int h, int v): # <<<<<<<<<<<<<< + * cdef double score + * cdef double smatch + */ + +static double __pyx_f_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_matchScore(struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *__pyx_v_self, int __pyx_v_h, int __pyx_v_v) { + double __pyx_v_score; + double __pyx_v_smatch; + double __pyx_v_smismatch; + double __pyx_v_hok; + double __pyx_v_vok; + double __pyx_r; + __Pyx_SetupRefcountContext("matchScore"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":25 + * cdef double smatch + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] # <<<<<<<<<<<<<< + * cdef double vok=1-self.vError[v-1] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + */ + __pyx_v_hok = (1 - (__pyx_v_self->hError[(__pyx_v_h - 1)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":26 + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[v-1] # <<<<<<<<<<<<<< + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + */ + __pyx_v_vok = (1 - (__pyx_v_self->vError[(__pyx_v_v - 1)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":27 + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[v-1] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) # <<<<<<<<<<<<<< + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + */ + __pyx_v_score = __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.hSeq->sequence[(__pyx_v_h - 1)]), (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.vSeq->sequence[(__pyx_v_v - 1)]), 0); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":28 + * cdef double vok=1-self.vError[v-1] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 # <<<<<<<<<<<<<< + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) + */ + __pyx_v_smatch = ((((((((4 * __pyx_v_hok) * __pyx_v_vok) - __pyx_v_hok) - __pyx_v_vok) * (__pyx_v_self->__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base._mismatch)) + __pyx_v_self->__pyx_base.__pyx_base._match) + (2 * __pyx_v_self->__pyx_base.__pyx_base._mismatch)) / 3); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":29 + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 # <<<<<<<<<<<<<< + * return smatch * score + smismatch * (1. - score) + * + */ + __pyx_v_smismatch = ((((((__pyx_v_hok + __pyx_v_vok) - ((4 * __pyx_v_hok) * __pyx_v_vok)) * (__pyx_v_self->__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base._mismatch)) + (2 * __pyx_v_self->__pyx_base.__pyx_base._match)) + (7 * __pyx_v_self->__pyx_base.__pyx_base._mismatch)) / 9); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":30 + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) # <<<<<<<<<<<<<< + * + * property seqA: + */ + __pyx_r = ((__pyx_v_smatch * __pyx_v_score) + (__pyx_v_smismatch * (1.0 - __pyx_v_score))); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":33 + * + * property seqA: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.horizontalSeq + * + */ + +static PyObject *__pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqA___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqA___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":34 + * property seqA: + * def __get__(self): + * return self.horizontalSeq # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq); + __pyx_r = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":36 + * return self.horizontalSeq + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + */ + +static int __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqA___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqA___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + PyObject *__pyx_v_olength; + PyObject *__pyx_v_oaddress; + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + unsigned long __pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":38 + * def __set__(self, seq): + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.horizontalSeq=seq + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_HasAttr(__pyx_v_seq, __pyx_kp_8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":39 + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.horizontalSeq=seq + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + */ + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":40 + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True + * self.horizontalSeq=seq # <<<<<<<<<<<<<< + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + * (oaddress,olength)=seq.quality.buffer_info() + */ + __Pyx_INCREF(__pyx_v_seq); + __Pyx_GIVEREF(__pyx_v_seq); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq); + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq = __pyx_v_seq; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":41 + * self.sequenceChanged=True + * self.horizontalSeq=seq + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) # <<<<<<<<<<<<<< + * (oaddress,olength)=seq.quality.buffer_info() + * self.hError=oaddress + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.hSeq; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.hSeq = __pyx_t_2; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":42 + * self.horizontalSeq=seq + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + * (oaddress,olength)=seq.quality.buffer_info() # <<<<<<<<<<<<<< + * self.hError=oaddress + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_quality); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":43 + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + * (oaddress,olength)=seq.quality.buffer_info() + * self.hError=oaddress # <<<<<<<<<<<<<< + * + * property seqB: + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->hError = ((double *)((unsigned long)__pyx_t_5)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("obitools.align._qsassemble.QSolexaDirectAssemble.seqA.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":46 + * + * property seqB: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.verticalSeq + * + */ + +static PyObject *__pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqB___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqB___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":47 + * property seqB: + * def __get__(self): + * return self.verticalSeq # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __pyx_r = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":49 + * return self.verticalSeq + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + */ + +static int __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + PyObject *__pyx_v_olength; + PyObject *__pyx_v_oaddress; + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + unsigned long __pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":51 + * def __set__(self, seq): + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.verticalSeq=seq + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_HasAttr(__pyx_v_seq, __pyx_kp_10); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_11); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":52 + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.verticalSeq=seq + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + */ + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":53 + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True + * self.verticalSeq=seq # <<<<<<<<<<<<<< + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + */ + __Pyx_INCREF(__pyx_v_seq); + __Pyx_GIVEREF(__pyx_v_seq); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq = __pyx_v_seq; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":54 + * self.sequenceChanged=True + * self.verticalSeq=seq + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.vSeq; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.vSeq = __pyx_t_2; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":55 + * self.verticalSeq=seq + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() # <<<<<<<<<<<<<< + * self.vError=oaddress + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_quality); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":56 + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)__pyx_v_self)->vError = ((double *)((unsigned long)__pyx_t_5)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("obitools.align._qsassemble.QSolexaDirectAssemble.seqB.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":61 + * cdef class QSolexaReverseAssemble(QSolexaDirectAssemble): + * + * cdef double matchScore(self,int h, int v): # <<<<<<<<<<<<<< + * cdef double score + * cdef double smatch + */ + +static double __pyx_f_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_matchScore(struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *__pyx_v_self, int __pyx_v_h, int __pyx_v_v) { + double __pyx_v_score; + double __pyx_v_smatch; + double __pyx_v_smismatch; + double __pyx_v_hok; + double __pyx_v_vok; + double __pyx_r; + __Pyx_SetupRefcountContext("matchScore"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":65 + * cdef double smatch + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] # <<<<<<<<<<<<<< + * cdef double vok=1-self.vError[self.vSeq.length - v] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + */ + __pyx_v_hok = (1 - (__pyx_v_self->__pyx_base.hError[(__pyx_v_h - 1)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":66 + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[self.vSeq.length - v] # <<<<<<<<<<<<<< + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + */ + __pyx_v_vok = (1 - (__pyx_v_self->__pyx_base.vError[(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq->length - __pyx_v_v)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":67 + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[self.vSeq.length - v] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) # <<<<<<<<<<<<<< + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + */ + __pyx_v_score = __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.hSeq->sequence[(__pyx_v_h - 1)]), (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq->sequence[(__pyx_v_v - 1)]), 0); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":68 + * cdef double vok=1-self.vError[self.vSeq.length - v] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 # <<<<<<<<<<<<<< + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) + */ + __pyx_v_smatch = ((((((((4 * __pyx_v_hok) * __pyx_v_vok) - __pyx_v_hok) - __pyx_v_vok) * (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) + __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match) + (2 * __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) / 3); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":69 + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 # <<<<<<<<<<<<<< + * return smatch * score + smismatch * (1. - score) + * + */ + __pyx_v_smismatch = ((((((__pyx_v_hok + __pyx_v_vok) - ((4 * __pyx_v_hok) * __pyx_v_vok)) * (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) + (2 * __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match)) + (7 * __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) / 9); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":70 + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) # <<<<<<<<<<<<<< + * + * property seqB: + */ + __pyx_r = ((__pyx_v_smatch * __pyx_v_score) + (__pyx_v_smismatch * (1.0 - __pyx_v_score))); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":73 + * + * property seqB: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.verticalSeq.wrapped + * + */ + +static PyObject *__pyx_pf_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_4seqB___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_4seqB___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":74 + * property seqB: + * def __get__(self): + * return self.verticalSeq.wrapped # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq, __pyx_kp_wrapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.align._qsassemble.QSolexaReverseAssemble.seqB.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":76 + * return self.verticalSeq.wrapped + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + */ + +static int __pyx_pf_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + PyObject *__pyx_v_olength; + PyObject *__pyx_v_oaddress; + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_4; + unsigned long __pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":78 + * def __set__(self, seq): + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_HasAttr(__pyx_v_seq, __pyx_kp_12); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_13); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":79 + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + */ + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":80 + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() # <<<<<<<<<<<<<< + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_complement); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq); + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":81 + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq; + __pyx_t_4 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":82 + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() # <<<<<<<<<<<<<< + * self.vError=oaddress + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_quality); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsassemble.pyx":83 + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)__pyx_v_self)->__pyx_base.vError = ((double *)((unsigned long)__pyx_t_5)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("obitools.align._qsassemble.QSolexaReverseAssemble.seqB.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaDirectAssemble __pyx_vtable_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + +static PyObject *__pyx_tp_new_8obitools_5align_11_qsassemble_QSolexaDirectAssemble(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *p; + PyObject *o = __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming*)__pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + return o; +} + +static void __pyx_tp_dealloc_8obitools_5align_11_qsassemble_QSolexaDirectAssemble(PyObject *o) { + __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_dealloc(o); +} + +static int __pyx_tp_traverse_8obitools_5align_11_qsassemble_QSolexaDirectAssemble(PyObject *o, visitproc v, void *a) { + int e; + if (__pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_traverse) { + e = __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_traverse(o, v, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_8obitools_5align_11_qsassemble_QSolexaDirectAssemble(PyObject *o) { + if (__pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_clear) { + __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_clear(o); + } + return 0; +} + +static PyObject *__pyx_getprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqA(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqA___get__(o); +} + +static int __pyx_setprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqA(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqA___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqB(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqB___get__(o); +} + +static int __pyx_setprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqB(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_4seqB___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_8obitools_5align_11_qsassemble_QSolexaDirectAssemble[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_8obitools_5align_11_qsassemble_QSolexaDirectAssemble[] = { + {(char *)"seqA", __pyx_getprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqA, __pyx_setprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqA, 0, 0}, + {(char *)"seqB", __pyx_getprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqB, __pyx_setprop_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_seqB, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_QSolexaDirectAssemble = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_QSolexaDirectAssemble = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_QSolexaDirectAssemble = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_QSolexaDirectAssemble = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_8obitools_5align_11_qsassemble_QSolexaDirectAssemble = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("obitools.align._qsassemble.QSolexaDirectAssemble"), /*tp_name*/ + sizeof(struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaDirectAssemble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_QSolexaDirectAssemble, /*tp_as_number*/ + &__pyx_tp_as_sequence_QSolexaDirectAssemble, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_QSolexaDirectAssemble, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_QSolexaDirectAssemble, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_traverse*/ + __pyx_tp_clear_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; +static struct __pyx_vtabstruct_8obitools_5align_11_qsassemble_QSolexaReverseAssemble __pyx_vtable_8obitools_5align_11_qsassemble_QSolexaReverseAssemble; + +static PyObject *__pyx_tp_new_8obitools_5align_11_qsassemble_QSolexaReverseAssemble(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *p; + PyObject *o = __pyx_tp_new_8obitools_5align_11_qsassemble_QSolexaDirectAssemble(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming*)__pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaReverseAssemble; + return o; +} + +static PyObject *__pyx_getprop_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_seqB(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_4seqB___get__(o); +} + +static int __pyx_setprop_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_seqB(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_4seqB___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_8obitools_5align_11_qsassemble_QSolexaReverseAssemble[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_8obitools_5align_11_qsassemble_QSolexaReverseAssemble[] = { + {(char *)"seqB", __pyx_getprop_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_seqB, __pyx_setprop_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_seqB, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_QSolexaReverseAssemble = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_QSolexaReverseAssemble = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_QSolexaReverseAssemble = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_QSolexaReverseAssemble = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_8obitools_5align_11_qsassemble_QSolexaReverseAssemble = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("obitools.align._qsassemble.QSolexaReverseAssemble"), /*tp_name*/ + sizeof(struct __pyx_obj_8obitools_5align_11_qsassemble_QSolexaReverseAssemble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_QSolexaReverseAssemble, /*tp_as_number*/ + &__pyx_tp_as_sequence_QSolexaReverseAssemble, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_QSolexaReverseAssemble, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_QSolexaReverseAssemble, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_traverse*/ + __pyx_tp_clear_8obitools_5align_11_qsassemble_QSolexaDirectAssemble, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8obitools_5align_11_qsassemble_QSolexaReverseAssemble, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_8obitools_5align_11_qsassemble_QSolexaReverseAssemble, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8obitools_5align_11_qsassemble_QSolexaReverseAssemble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static struct PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_qsassemble"), + __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, + {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, + {&__pyx_kp_opengap, __pyx_k_opengap, sizeof(__pyx_k_opengap), 1, 1, 1}, + {&__pyx_kp_extgap, __pyx_k_extgap, sizeof(__pyx_k_extgap), 1, 1, 1}, + {&__pyx_kp_seq, __pyx_k_seq, sizeof(__pyx_k_seq), 1, 1, 1}, + {&__pyx_kp_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0}, + {&__pyx_kp_quality, __pyx_k_quality, sizeof(__pyx_k_quality), 1, 1, 1}, + {&__pyx_kp_buffer_info, __pyx_k_buffer_info, sizeof(__pyx_k_buffer_info), 1, 1, 1}, + {&__pyx_kp_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0}, + {&__pyx_kp_wrapped, __pyx_k_wrapped, sizeof(__pyx_k_wrapped), 1, 1, 1}, + {&__pyx_kp_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0}, + {&__pyx_kp_complement, __pyx_k_complement, sizeof(__pyx_k_complement), 1, 1, 1}, + {&__pyx_kp_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 0}, + {&__pyx_kp_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 0}, + {&__pyx_kp_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 0}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_8 = PyInt_FromLong(-8); if (unlikely(!__pyx_int_neg_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_qsassemble(void); /*proto*/ +PyMODINIT_FUNC init_qsassemble(void) +#else +PyMODINIT_FUNC PyInit__qsassemble(void); /*proto*/ +PyMODINIT_FUNC PyInit__qsassemble(void) +#endif +{ + PyObject *__pyx_1 = 0; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit__qsassemble(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_qsassemble"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__pyx_module_is_main_obitools__align___qsassemble) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble = __Pyx_ImportType("obitools.align._assemble", "DirectAssemble", sizeof(struct __pyx_obj_8obitools_5align_9_assemble_DirectAssemble)); if (unlikely(!__pyx_ptype_8obitools_5align_9_assemble_DirectAssemble)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_9_assemble_DirectAssemble->tp_dict, &__pyx_vtabptr_8obitools_5align_9_assemble_DirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaDirectAssemble = &__pyx_vtable_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + __pyx_vtable_8obitools_5align_11_qsassemble_QSolexaDirectAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_9_assemble_DirectAssemble; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_8obitools_5align_11_qsassemble_QSolexaDirectAssemble.__pyx_base.__pyx_base.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_matchScore; + #else + *(void(**)(void))&__pyx_vtable_8obitools_5align_11_qsassemble_QSolexaDirectAssemble.__pyx_base.__pyx_base.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_11_qsassemble_21QSolexaDirectAssemble_matchScore; + #endif + __pyx_type_8obitools_5align_11_qsassemble_QSolexaDirectAssemble.tp_base = __pyx_ptype_8obitools_5align_9_assemble_DirectAssemble; + if (PyType_Ready(&__pyx_type_8obitools_5align_11_qsassemble_QSolexaDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_11_qsassemble_QSolexaDirectAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "QSolexaDirectAssemble", (PyObject *)&__pyx_type_8obitools_5align_11_qsassemble_QSolexaDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_11_qsassemble_QSolexaDirectAssemble = &__pyx_type_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + __pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaReverseAssemble = &__pyx_vtable_8obitools_5align_11_qsassemble_QSolexaReverseAssemble; + __pyx_vtable_8obitools_5align_11_qsassemble_QSolexaReverseAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_8obitools_5align_11_qsassemble_QSolexaReverseAssemble.__pyx_base.__pyx_base.__pyx_base.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_matchScore; + #else + *(void(**)(void))&__pyx_vtable_8obitools_5align_11_qsassemble_QSolexaReverseAssemble.__pyx_base.__pyx_base.__pyx_base.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_11_qsassemble_22QSolexaReverseAssemble_matchScore; + #endif + __pyx_type_8obitools_5align_11_qsassemble_QSolexaReverseAssemble.tp_base = __pyx_ptype_8obitools_5align_11_qsassemble_QSolexaDirectAssemble; + if (PyType_Ready(&__pyx_type_8obitools_5align_11_qsassemble_QSolexaReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_11_qsassemble_QSolexaReverseAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_11_qsassemble_QSolexaReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "QSolexaReverseAssemble", (PyObject *)&__pyx_type_8obitools_5align_11_qsassemble_QSolexaReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_11_qsassemble_QSolexaReverseAssemble = &__pyx_type_8obitools_5align_11_qsassemble_QSolexaReverseAssemble; + /*--- Type import code ---*/ + __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = __Pyx_ImportType("obitools.align._dynamic", "DynamicProgramming", sizeof(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming)); if (unlikely(!__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming->tp_dict, &__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_4_nws_NWS = __Pyx_ImportType("obitools.align._nws", "NWS", sizeof(struct __pyx_obj_8obitools_5align_4_nws_NWS)); if (unlikely(!__pyx_ptype_8obitools_5align_4_nws_NWS)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_4_nws_NWS->tp_dict, &__pyx_vtabptr_8obitools_5align_4_nws_NWS) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_9_assemble_ReverseAssemble = __Pyx_ImportType("obitools.align._assemble", "ReverseAssemble", sizeof(struct __pyx_obj_8obitools_5align_9_assemble_ReverseAssemble)); if (unlikely(!__pyx_ptype_8obitools_5align_9_assemble_ReverseAssemble)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_9_assemble_ReverseAssemble->tp_dict, &__pyx_vtabptr_8obitools_5align_9_assemble_ReverseAssemble) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + __pyx_1 = __Pyx_ImportModule("obitools.align._dynamic"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocateMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateMatrix, "struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freeMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "resetMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocateSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freeSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocatePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "reversePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "bitCount", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "iupacMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "iupacPartialMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + /*--- Execution code ---*/ + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":1 + * from _dynamic cimport * # <<<<<<<<<<<<<< + * + * cdef class NWS(DynamicProgramming): + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + if (__pyx_m) { + __Pyx_AddTraceback("init obitools.align._qsassemble"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init obitools.align._qsassemble"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "_qsassemble.pyx", + "_dynamic.pxd", + "_nws.pxd", + "_assemble.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((char)-1) > ((char)0) && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((short)-1) > ((short)0) && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((int)-1) > ((int)0) && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) { + int result; + PyObject *pycobj; + + pycobj = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!pycobj) + goto bad; + *(void **)vtabptr = PyCObject_AsVoidPtr(pycobj); + if (!*(void **)vtabptr) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + PyObject *pycobj = 0; + int result; + + pycobj = PyCObject_FromVoidPtr(vtable, 0); + if (!pycobj) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + const char *desc; + const char *s1, *s2; + union { + void (*fp)(void); + void *p; + } tmp; + + d = PyObject_GetAttrString(module, api); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj); + *f = tmp.fp; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode && (!t->is_identifier)) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/src/obitools/align/_qsassemble.pyx b/src/obitools/align/_qsassemble.pyx new file mode 100644 index 0000000..9accbbb --- /dev/null +++ b/src/obitools/align/_qsassemble.pyx @@ -0,0 +1,83 @@ +#@PydevCodeAnalysisIgnore +''' +Created on 6 Nov. 2009 + +@author: coissac +''' + +from _dynamic cimport * +from _assemble cimport DirectAssemble + + +cdef class QSolexaDirectAssemble(DirectAssemble): + + cdef double* hError + cdef double* vError + + def __init__(self,match=4,opengap=-8,extgap=-2): + mismatch=-float(match)/3.0 + DirectAssemble.__init__(self,match,mismatch,opengap,extgap) + + cdef double matchScore(self,int h, int v): + cdef double score + cdef double smatch + cdef double smismatch + cdef double hok=1-self.hError[h-1] + cdef double vok=1-self.vError[v-1] + score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + return smatch * score + smismatch * (1. - score) + + property seqA: + def __get__(self): + return self.horizontalSeq + + def __set__(self, seq): + cdef object oaddresse,olength + assert hasattr(seq, "quality"),"You must use sequence with quality indices" + self.sequenceChanged=True + self.horizontalSeq=seq + self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + (oaddress,olength)=seq.quality.buffer_info() + self.hError=oaddress + + property seqB: + def __get__(self): + return self.verticalSeq + + def __set__(self, seq): + cdef object oaddresse,olength + assert hasattr(seq, "quality"),"You must use sequence with quality indices" + self.sequenceChanged=True + self.verticalSeq=seq + self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + (oaddress,olength)=seq.quality.buffer_info() + self.vError=oaddress + + +cdef class QSolexaReverseAssemble(QSolexaDirectAssemble): + + cdef double matchScore(self,int h, int v): + cdef double score + cdef double smatch + cdef double smismatch + cdef double hok=1-self.hError[h-1] + cdef double vok=1-self.vError[self.vSeq.length - v] + score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + return smatch * score + smismatch * (1. - score) + + property seqB: + def __get__(self): + return self.verticalSeq.wrapped + + def __set__(self, seq): + cdef object oaddresse,olength + assert hasattr(seq, "quality"),"You must use sequence with quality indices" + self.sequenceChanged=True + self.verticalSeq=seq.complement() + self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + (oaddress,olength)=seq.quality.buffer_info() + self.vError=oaddress diff --git a/src/obitools/align/_qsrassemble.c b/src/obitools/align/_qsrassemble.c new file mode 100644 index 0000000..e7d8a27 --- /dev/null +++ b/src/obitools/align/_qsrassemble.c @@ -0,0 +1,2969 @@ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:11 2010 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +#include +#define __PYX_HAVE_API__obitools__align___qsrassemble +#include "stdlib.h" +#include "string.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; +static const char **__pyx_f; + +static char __pyx_mdoc[] = "\nCreated on 6 Nov. 2009\n\n@author: coissac\n"; + + +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Type declarations */ + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":11 + * void memcpy(void* s1, void* s2, int n) + * + * cdef struct AlignCell : # <<<<<<<<<<<<<< + * double score + * int path + */ + +struct __pyx_t_8obitools_5align_8_dynamic_AlignCell { + double score; + int path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":15 + * int path + * + * cdef struct AlignMatrix : # <<<<<<<<<<<<<< + * AlignCell* matrix + * int* bestVJump + */ + +struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix { + struct __pyx_t_8obitools_5align_8_dynamic_AlignCell *matrix; + int *bestVJump; + int *bestHJump; + int msize; + int vsize; + int hsize; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":24 + * + * + * cdef AlignMatrix* allocateMatrix(int hsize, int vsize,AlignMatrix *matrix=?) # <<<<<<<<<<<<<< + * + * cdef void freeMatrix(AlignMatrix* matrix) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *matrix; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":31 + * + * + * cdef struct alignSequence: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignSequence { + long length; + long buffsize; + int hasQuality; + char *sequence; + double *quality; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":38 + * double* quality + * + * cdef alignSequence* allocateSequence(object bioseq, alignSequence* seq=?) # <<<<<<<<<<<<<< + * + * cdef void freeSequence(alignSequence* seq) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *seq; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":42 + * cdef void freeSequence(alignSequence* seq) + * + * cdef struct alignPath: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignPath { + long length; + long buffsize; + long vStart; + long hStart; + long *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":49 + * long *path + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 + * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) + * + * cdef class DynamicProgramming: # <<<<<<<<<<<<<< + * cdef AlignMatrix* matrix + * + */ + +struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming { + PyObject_HEAD + struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtab; + struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *matrix; + PyObject *horizontalSeq; + PyObject *verticalSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *hSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *vSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; + double _opengap; + double _extgap; + PyObject *alignment; + int sequenceChanged; + int scoreChanged; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":3 + * from _dynamic cimport * + * + * cdef class NWS(DynamicProgramming): # <<<<<<<<<<<<<< + * cdef double _match + * cdef double _mismatch + */ + +struct __pyx_obj_8obitools_5align_4_nws_NWS { + struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming __pyx_base; + double _match; + double _mismatch; +}; + +struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble { + struct __pyx_obj_8obitools_5align_4_nws_NWS __pyx_base; + double xsmax; + int xmax; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pxd":9 + * cdef double doAlignment(self) except? 0 + * + * cdef class RightReverseAssemble(RightDirectAssemble): # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble { + struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_base; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":12 + * + * + * cdef class QSolexaRightDirectAssemble(RightDirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double* hError + */ + +struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble { + struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_base; + double *hError; + double *vError; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":59 + * + * + * cdef class QSolexaRightReverseAssemble(QSolexaRightDirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double matchScore(self,int h, int v): + */ + +struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble { + struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble __pyx_base; +}; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 + * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) + * + * cdef class DynamicProgramming: # <<<<<<<<<<<<<< + * cdef AlignMatrix* matrix + * + */ + +struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming { + int (*allocate)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + double (*matchScore)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + double (*doAlignment)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*reset)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + int (*_needToCompute)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*backtrack)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); +}; +static struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":3 + * from _dynamic cimport * + * + * cdef class NWS(DynamicProgramming): # <<<<<<<<<<<<<< + * cdef double _match + * cdef double _mismatch + */ + +struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS { + struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *__pyx_vtabptr_8obitools_5align_4_nws_NWS; + + +struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble { + struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *__pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":12 + * + * + * cdef class QSolexaRightDirectAssemble(RightDirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double* hError + */ + +struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble { + struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *__pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":59 + * + * + * cdef class QSolexaRightReverseAssemble(QSolexaRightDirectAssemble): # <<<<<<<<<<<<<< + * + * cdef double matchScore(self,int h, int v): + */ + +struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble { + struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *__pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pxd":9 + * cdef double doAlignment(self) except? 0 + * + * cdef class RightReverseAssemble(RightDirectAssemble): # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightReverseAssemble { + struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightReverseAssemble *__pyx_vtabptr_8obitools_5align_10_rassemble_RightReverseAssemble; +/* Module declarations from obitools.align._dynamic */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = 0; +static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(*__pyx_f_8obitools_5align_8_dynamic_allocateMatrix)(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freeMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_resetMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(*__pyx_f_8obitools_5align_8_dynamic_allocateSequence)(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freeSequence)(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(*__pyx_f_8obitools_5align_8_dynamic_allocatePath)(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_reversePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static int (*__pyx_f_8obitools_5align_8_dynamic_bitCount)(int); /*proto*/ +static int (*__pyx_f_8obitools_5align_8_dynamic_iupacMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ +static double (*__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ +/* Module declarations from obitools.align._nws */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_4_nws_NWS = 0; +/* Module declarations from obitools.align._rassemble */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble = 0; +static PyTypeObject *__pyx_ptype_8obitools_5align_10_rassemble_RightReverseAssemble = 0; +/* Module declarations from obitools.align._qsrassemble */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble = 0; +static PyTypeObject *__pyx_ptype_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble = 0; +#define __Pyx_MODULE_NAME "obitools.align._qsrassemble" +int __pyx_module_is_main_obitools__align___qsrassemble = 0; + +/* Implementation of obitools.align._qsrassemble */ +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_neg_8; +static PyObject *__pyx_int_neg_2; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k___init__[] = "__init__"; +static PyObject *__pyx_kp___init__; +static char __pyx_k_match[] = "match"; +static PyObject *__pyx_kp_match; +static char __pyx_k_opengap[] = "opengap"; +static PyObject *__pyx_kp_opengap; +static char __pyx_k_extgap[] = "extgap"; +static PyObject *__pyx_kp_extgap; +static char __pyx_k_seq[] = "seq"; +static PyObject *__pyx_kp_seq; +static char __pyx_k_14[] = "quality"; +static PyObject *__pyx_kp_14; +static char __pyx_k_quality[] = "quality"; +static PyObject *__pyx_kp_quality; +static char __pyx_k_buffer_info[] = "buffer_info"; +static PyObject *__pyx_kp_buffer_info; +static char __pyx_k_16[] = "quality"; +static PyObject *__pyx_kp_16; +static char __pyx_k_wrapped[] = "wrapped"; +static PyObject *__pyx_kp_wrapped; +static char __pyx_k_18[] = "quality"; +static PyObject *__pyx_kp_18; +static char __pyx_k_complement[] = "complement"; +static PyObject *__pyx_kp_complement; +static PyObject *__pyx_kp_15; +static char __pyx_k_15[] = "You must use sequence with quality indices"; +static PyObject *__pyx_kp_17; +static char __pyx_k_17[] = "You must use sequence with quality indices"; +static PyObject *__pyx_kp_19; +static char __pyx_k_19[] = "You must use sequence with quality indices"; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":17 + * cdef double* vError + * + * def __init__(self,match=4,opengap=-8,extgap=-2): # <<<<<<<<<<<<<< + * mismatch=-float(match)/3.0 + * RightDirectAssemble.__init__(self,match,mismatch,opengap,extgap) + */ + +static int __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_match = 0; + PyObject *__pyx_v_opengap = 0; + PyObject *__pyx_v_extgap = 0; + PyObject *__pyx_v_mismatch; + int __pyx_r; + PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_match,&__pyx_kp_opengap,&__pyx_kp_extgap,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[0] = __pyx_int_4; + values[1] = __pyx_int_neg_8; + values[2] = __pyx_int_neg_2; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_match); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_opengap); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extgap); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_match = values[0]; + __pyx_v_opengap = values[1]; + __pyx_v_extgap = values[2]; + } else { + __pyx_v_match = __pyx_int_4; + __pyx_v_opengap = __pyx_int_neg_8; + __pyx_v_extgap = __pyx_int_neg_2; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: __pyx_v_extgap = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_opengap = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_match = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("obitools.align._qsrassemble.QSolexaRightDirectAssemble.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mismatch = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":18 + * + * def __init__(self,match=4,opengap=-8,extgap=-2): + * mismatch=-float(match)/3.0 # <<<<<<<<<<<<<< + * RightDirectAssemble.__init__(self,match,mismatch,opengap,extgap) + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_match); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_match); + __Pyx_GIVEREF(__pyx_v_match); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyFloat_Type)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_1 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_1, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_mismatch); + __pyx_v_mismatch = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":19 + * def __init__(self,match=4,opengap=-8,extgap=-2): + * mismatch=-float(match)/3.0 + * RightDirectAssemble.__init__(self,match,mismatch,opengap,extgap) # <<<<<<<<<<<<<< + * + * cdef double matchScore(self,int h, int v): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_match); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_match); + __Pyx_GIVEREF(__pyx_v_match); + __Pyx_INCREF(__pyx_v_mismatch); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_mismatch); + __Pyx_GIVEREF(__pyx_v_mismatch); + __Pyx_INCREF(__pyx_v_opengap); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_opengap); + __Pyx_GIVEREF(__pyx_v_opengap); + __Pyx_INCREF(__pyx_v_extgap); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_extgap); + __Pyx_GIVEREF(__pyx_v_extgap); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("obitools.align._qsrassemble.QSolexaRightDirectAssemble.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_mismatch); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":21 + * RightDirectAssemble.__init__(self,match,mismatch,opengap,extgap) + * + * cdef double matchScore(self,int h, int v): # <<<<<<<<<<<<<< + * cdef double score + * cdef double smatch + */ + +static double __pyx_f_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_matchScore(struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *__pyx_v_self, int __pyx_v_h, int __pyx_v_v) { + double __pyx_v_score; + double __pyx_v_smatch; + double __pyx_v_smismatch; + double __pyx_v_hok; + double __pyx_v_vok; + double __pyx_r; + __Pyx_SetupRefcountContext("matchScore"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":25 + * cdef double smatch + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] # <<<<<<<<<<<<<< + * cdef double vok=1-self.vError[v-1] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + */ + __pyx_v_hok = (1 - (__pyx_v_self->hError[(__pyx_v_h - 1)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":26 + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[v-1] # <<<<<<<<<<<<<< + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + */ + __pyx_v_vok = (1 - (__pyx_v_self->vError[(__pyx_v_v - 1)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":27 + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[v-1] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) # <<<<<<<<<<<<<< + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + */ + __pyx_v_score = __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.hSeq->sequence[(__pyx_v_h - 1)]), (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.vSeq->sequence[(__pyx_v_v - 1)]), 0); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":28 + * cdef double vok=1-self.vError[v-1] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 # <<<<<<<<<<<<<< + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) + */ + __pyx_v_smatch = ((((((((4 * __pyx_v_hok) * __pyx_v_vok) - __pyx_v_hok) - __pyx_v_vok) * (__pyx_v_self->__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base._mismatch)) + __pyx_v_self->__pyx_base.__pyx_base._match) + (2 * __pyx_v_self->__pyx_base.__pyx_base._mismatch)) / 3); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":29 + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 # <<<<<<<<<<<<<< + * return smatch * score + smismatch * (1. - score) + * + */ + __pyx_v_smismatch = ((((((__pyx_v_hok + __pyx_v_vok) - ((4 * __pyx_v_hok) * __pyx_v_vok)) * (__pyx_v_self->__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base._mismatch)) + (2 * __pyx_v_self->__pyx_base.__pyx_base._match)) + (7 * __pyx_v_self->__pyx_base.__pyx_base._mismatch)) / 9); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":30 + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) # <<<<<<<<<<<<<< + * + * property seqA: + */ + __pyx_r = ((__pyx_v_smatch * __pyx_v_score) + (__pyx_v_smismatch * (1.0 - __pyx_v_score))); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":33 + * + * property seqA: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.horizontalSeq + * + */ + +static PyObject *__pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqA___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqA___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":34 + * property seqA: + * def __get__(self): + * return self.horizontalSeq # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq); + __pyx_r = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":36 + * return self.horizontalSeq + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + */ + +static int __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqA___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqA___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + PyObject *__pyx_v_olength; + PyObject *__pyx_v_oaddress; + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + unsigned long __pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":38 + * def __set__(self, seq): + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.horizontalSeq=seq + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_HasAttr(__pyx_v_seq, __pyx_kp_14); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_15); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":39 + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.horizontalSeq=seq + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + */ + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":40 + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True + * self.horizontalSeq=seq # <<<<<<<<<<<<<< + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + * (oaddress,olength)=seq.quality.buffer_info() + */ + __Pyx_INCREF(__pyx_v_seq); + __Pyx_GIVEREF(__pyx_v_seq); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq); + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq = __pyx_v_seq; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":41 + * self.sequenceChanged=True + * self.horizontalSeq=seq + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) # <<<<<<<<<<<<<< + * (oaddress,olength)=seq.quality.buffer_info() + * self.hError=oaddress + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.hSeq; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.horizontalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.hSeq = __pyx_t_2; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":42 + * self.horizontalSeq=seq + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + * (oaddress,olength)=seq.quality.buffer_info() # <<<<<<<<<<<<<< + * self.hError=oaddress + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_quality); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":43 + * self.hSeq=allocateSequence(self.horizontalSeq,self.hSeq) + * (oaddress,olength)=seq.quality.buffer_info() + * self.hError=oaddress # <<<<<<<<<<<<<< + * + * property seqB: + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->hError = ((double *)((unsigned long)__pyx_t_5)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("obitools.align._qsrassemble.QSolexaRightDirectAssemble.seqA.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":46 + * + * property seqB: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.verticalSeq + * + */ + +static PyObject *__pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqB___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqB___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":47 + * property seqB: + * def __get__(self): + * return self.verticalSeq # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __pyx_r = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":49 + * return self.verticalSeq + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + */ + +static int __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + PyObject *__pyx_v_olength; + PyObject *__pyx_v_oaddress; + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + unsigned long __pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":51 + * def __set__(self, seq): + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.verticalSeq=seq + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_HasAttr(__pyx_v_seq, __pyx_kp_16); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_17); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":52 + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.verticalSeq=seq + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + */ + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":53 + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True + * self.verticalSeq=seq # <<<<<<<<<<<<<< + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + */ + __Pyx_INCREF(__pyx_v_seq); + __Pyx_GIVEREF(__pyx_v_seq); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq = __pyx_v_seq; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":54 + * self.sequenceChanged=True + * self.verticalSeq=seq + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.vSeq; + __pyx_t_2 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.vSeq = __pyx_t_2; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":55 + * self.verticalSeq=seq + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() # <<<<<<<<<<<<<< + * self.vError=oaddress + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_quality); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":56 + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)__pyx_v_self)->vError = ((double *)((unsigned long)__pyx_t_5)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("obitools.align._qsrassemble.QSolexaRightDirectAssemble.seqB.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":61 + * cdef class QSolexaRightReverseAssemble(QSolexaRightDirectAssemble): + * + * cdef double matchScore(self,int h, int v): # <<<<<<<<<<<<<< + * cdef double score + * cdef double smatch + */ + +static double __pyx_f_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_matchScore(struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *__pyx_v_self, int __pyx_v_h, int __pyx_v_v) { + double __pyx_v_score; + double __pyx_v_smatch; + double __pyx_v_smismatch; + double __pyx_v_hok; + double __pyx_v_vok; + double __pyx_r; + __Pyx_SetupRefcountContext("matchScore"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":65 + * cdef double smatch + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] # <<<<<<<<<<<<<< + * cdef double vok=1-self.vError[self.vSeq.length - v] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + */ + __pyx_v_hok = (1 - (__pyx_v_self->__pyx_base.hError[(__pyx_v_h - 1)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":66 + * cdef double smismatch + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[self.vSeq.length - v] # <<<<<<<<<<<<<< + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + */ + __pyx_v_vok = (1 - (__pyx_v_self->__pyx_base.vError[(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq->length - __pyx_v_v)])); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":67 + * cdef double hok=1-self.hError[h-1] + * cdef double vok=1-self.vError[self.vSeq.length - v] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) # <<<<<<<<<<<<<< + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + */ + __pyx_v_score = __pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch((__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.hSeq->sequence[(__pyx_v_h - 1)]), (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq->sequence[(__pyx_v_v - 1)]), 0); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":68 + * cdef double vok=1-self.vError[self.vSeq.length - v] + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 # <<<<<<<<<<<<<< + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) + */ + __pyx_v_smatch = ((((((((4 * __pyx_v_hok) * __pyx_v_vok) - __pyx_v_hok) - __pyx_v_vok) * (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) + __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match) + (2 * __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) / 3); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":69 + * score=iupacPartialMatch(self.hSeq.sequence[h-1],self.vSeq.sequence[v-1]) + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 # <<<<<<<<<<<<<< + * return smatch * score + smismatch * (1. - score) + * + */ + __pyx_v_smismatch = ((((((__pyx_v_hok + __pyx_v_vok) - ((4 * __pyx_v_hok) * __pyx_v_vok)) * (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match - __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) + (2 * __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._match)) + (7 * __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._mismatch)) / 9); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":70 + * smatch=((4*hok*vok-hok-vok)*(self._match-self._mismatch)+self._match+2*self._mismatch)/3 + * smismatch=((hok+vok-4*hok*vok)*(self._match-self._mismatch)+2*self._match+7*self._mismatch)/9 + * return smatch * score + smismatch * (1. - score) # <<<<<<<<<<<<<< + * + * property seqB: + */ + __pyx_r = ((__pyx_v_smatch * __pyx_v_score) + (__pyx_v_smismatch * (1.0 - __pyx_v_score))); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":73 + * + * property seqB: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.verticalSeq.wrapped + * + */ + +static PyObject *__pyx_pf_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_4seqB___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_4seqB___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":74 + * property seqB: + * def __get__(self): + * return self.verticalSeq.wrapped # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq, __pyx_kp_wrapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.align._qsrassemble.QSolexaRightReverseAssemble.seqB.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":76 + * return self.verticalSeq.wrapped + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + */ + +static int __pyx_pf_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + PyObject *__pyx_v_olength; + PyObject *__pyx_v_oaddress; + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_4 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_4; + unsigned long __pyx_t_5; + __Pyx_SetupRefcountContext("__set__"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":78 + * def __set__(self, seq): + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() + */ + #ifndef PYREX_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_HasAttr(__pyx_v_seq, __pyx_kp_18); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_19); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":79 + * cdef object oaddresse,olength + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + */ + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":80 + * assert hasattr(seq, "quality"),"You must use sequence with quality indices" + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() # <<<<<<<<<<<<<< + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_complement); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq); + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":81 + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq; + __pyx_t_4 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.verticalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.vSeq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":82 + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() # <<<<<<<<<<<<<< + * self.vError=oaddress + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_quality); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); + __pyx_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } else { + __pyx_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_4); + if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_3; + __pyx_3 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_4; + __pyx_4 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_qsrassemble.pyx":83 + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + * (oaddress,olength)=seq.quality.buffer_info() + * self.vError=oaddress # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)__pyx_v_self)->__pyx_base.vError = ((double *)((unsigned long)__pyx_t_5)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("obitools.align._qsrassemble.QSolexaRightReverseAssemble.seqB.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble __pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + +static PyObject *__pyx_tp_new_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *p; + PyObject *o = __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming*)__pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + return o; +} + +static void __pyx_tp_dealloc_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble(PyObject *o) { + __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_dealloc(o); +} + +static int __pyx_tp_traverse_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble(PyObject *o, visitproc v, void *a) { + int e; + if (__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_traverse) { + e = __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_traverse(o, v, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble(PyObject *o) { + if (__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_clear) { + __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_clear(o); + } + return 0; +} + +static PyObject *__pyx_getprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqA(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqA___get__(o); +} + +static int __pyx_setprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqA(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqA___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqB(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqB___get__(o); +} + +static int __pyx_setprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqB(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_4seqB___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble[] = { + {(char *)"seqA", __pyx_getprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqA, __pyx_setprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqA, 0, 0}, + {(char *)"seqB", __pyx_getprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqB, __pyx_setprop_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_seqB, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_QSolexaRightDirectAssemble = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_QSolexaRightDirectAssemble = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_QSolexaRightDirectAssemble = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_QSolexaRightDirectAssemble = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("obitools.align._qsrassemble.QSolexaRightDirectAssemble"), /*tp_name*/ + sizeof(struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_QSolexaRightDirectAssemble, /*tp_as_number*/ + &__pyx_tp_as_sequence_QSolexaRightDirectAssemble, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_QSolexaRightDirectAssemble, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_QSolexaRightDirectAssemble, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_traverse*/ + __pyx_tp_clear_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; +static struct __pyx_vtabstruct_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble __pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble; + +static PyObject *__pyx_tp_new_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *p; + PyObject *o = __pyx_tp_new_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming*)__pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble; + return o; +} + +static PyObject *__pyx_getprop_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_seqB(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_4seqB___get__(o); +} + +static int __pyx_setprop_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_seqB(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_4seqB___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble[] = { + {(char *)"seqB", __pyx_getprop_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_seqB, __pyx_setprop_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_seqB, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_QSolexaRightReverseAssemble = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_QSolexaRightReverseAssemble = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_QSolexaRightReverseAssemble = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_QSolexaRightReverseAssemble = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("obitools.align._qsrassemble.QSolexaRightReverseAssemble"), /*tp_name*/ + sizeof(struct __pyx_obj_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_QSolexaRightReverseAssemble, /*tp_as_number*/ + &__pyx_tp_as_sequence_QSolexaRightReverseAssemble, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_QSolexaRightReverseAssemble, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_QSolexaRightReverseAssemble, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_traverse*/ + __pyx_tp_clear_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static struct PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_qsrassemble"), + __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, + {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, + {&__pyx_kp_opengap, __pyx_k_opengap, sizeof(__pyx_k_opengap), 1, 1, 1}, + {&__pyx_kp_extgap, __pyx_k_extgap, sizeof(__pyx_k_extgap), 1, 1, 1}, + {&__pyx_kp_seq, __pyx_k_seq, sizeof(__pyx_k_seq), 1, 1, 1}, + {&__pyx_kp_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0}, + {&__pyx_kp_quality, __pyx_k_quality, sizeof(__pyx_k_quality), 1, 1, 1}, + {&__pyx_kp_buffer_info, __pyx_k_buffer_info, sizeof(__pyx_k_buffer_info), 1, 1, 1}, + {&__pyx_kp_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0}, + {&__pyx_kp_wrapped, __pyx_k_wrapped, sizeof(__pyx_k_wrapped), 1, 1, 1}, + {&__pyx_kp_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0}, + {&__pyx_kp_complement, __pyx_k_complement, sizeof(__pyx_k_complement), 1, 1, 1}, + {&__pyx_kp_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 0}, + {&__pyx_kp_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 0}, + {&__pyx_kp_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 0}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_8 = PyInt_FromLong(-8); if (unlikely(!__pyx_int_neg_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_qsrassemble(void); /*proto*/ +PyMODINIT_FUNC init_qsrassemble(void) +#else +PyMODINIT_FUNC PyInit__qsrassemble(void); /*proto*/ +PyMODINIT_FUNC PyInit__qsrassemble(void) +#endif +{ + PyObject *__pyx_1 = 0; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit__qsrassemble(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_qsrassemble"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__pyx_module_is_main_obitools__align___qsrassemble) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble = __Pyx_ImportType("obitools.align._rassemble", "RightDirectAssemble", sizeof(struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble)); if (unlikely(!__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble->tp_dict, &__pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble = &__pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + __pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble.__pyx_base.__pyx_base.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_matchScore; + #else + *(void(**)(void))&__pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble.__pyx_base.__pyx_base.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_12_qsrassemble_26QSolexaRightDirectAssemble_matchScore; + #endif + __pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble.tp_base = __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble; + if (PyType_Ready(&__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "QSolexaRightDirectAssemble", (PyObject *)&__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble = &__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + __pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble = &__pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble; + __pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble.__pyx_base.__pyx_base.__pyx_base.__pyx_base.matchScore = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int))__pyx_f_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_matchScore; + #else + *(void(**)(void))&__pyx_vtable_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble.__pyx_base.__pyx_base.__pyx_base.__pyx_base.matchScore = (void(*)(void))__pyx_f_8obitools_5align_12_qsrassemble_27QSolexaRightReverseAssemble_matchScore; + #endif + __pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble.tp_base = __pyx_ptype_8obitools_5align_12_qsrassemble_QSolexaRightDirectAssemble; + if (PyType_Ready(&__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "QSolexaRightReverseAssemble", (PyObject *)&__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble = &__pyx_type_8obitools_5align_12_qsrassemble_QSolexaRightReverseAssemble; + /*--- Type import code ---*/ + __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = __Pyx_ImportType("obitools.align._dynamic", "DynamicProgramming", sizeof(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming)); if (unlikely(!__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming->tp_dict, &__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_4_nws_NWS = __Pyx_ImportType("obitools.align._nws", "NWS", sizeof(struct __pyx_obj_8obitools_5align_4_nws_NWS)); if (unlikely(!__pyx_ptype_8obitools_5align_4_nws_NWS)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_4_nws_NWS->tp_dict, &__pyx_vtabptr_8obitools_5align_4_nws_NWS) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_10_rassemble_RightReverseAssemble = __Pyx_ImportType("obitools.align._rassemble", "RightReverseAssemble", sizeof(struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble)); if (unlikely(!__pyx_ptype_8obitools_5align_10_rassemble_RightReverseAssemble)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_10_rassemble_RightReverseAssemble->tp_dict, &__pyx_vtabptr_8obitools_5align_10_rassemble_RightReverseAssemble) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + __pyx_1 = __Pyx_ImportModule("obitools.align._dynamic"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocateMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateMatrix, "struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freeMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "resetMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocateSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freeSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocatePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "reversePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "bitCount", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "iupacMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "iupacPartialMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + /*--- Execution code ---*/ + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":1 + * from _dynamic cimport * # <<<<<<<<<<<<<< + * + * cdef class NWS(DynamicProgramming): + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + if (__pyx_m) { + __Pyx_AddTraceback("init obitools.align._qsrassemble"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init obitools.align._qsrassemble"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "_qsrassemble.pyx", + "_dynamic.pxd", + "_nws.pxd", + "_rassemble.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((char)-1) > ((char)0) && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((short)-1) > ((short)0) && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((int)-1) > ((int)0) && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) { + int result; + PyObject *pycobj; + + pycobj = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!pycobj) + goto bad; + *(void **)vtabptr = PyCObject_AsVoidPtr(pycobj); + if (!*(void **)vtabptr) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + PyObject *pycobj = 0; + int result; + + pycobj = PyCObject_FromVoidPtr(vtable, 0); + if (!pycobj) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + const char *desc; + const char *s1, *s2; + union { + void (*fp)(void); + void *p; + } tmp; + + d = PyObject_GetAttrString(module, api); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj); + *f = tmp.fp; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode && (!t->is_identifier)) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/src/obitools/align/_rassemble.c b/src/obitools/align/_rassemble.c new file mode 100644 index 0000000..d05e9f3 --- /dev/null +++ b/src/obitools/align/_rassemble.c @@ -0,0 +1,3141 @@ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:11 2010 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +#include +#define __PYX_HAVE_API__obitools__align___rassemble +#include "stdlib.h" +#include "string.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; +static const char **__pyx_f; + +static char __pyx_mdoc[] = "\nCreated on 6 Nov. 2009\n\n@author: coissac\n"; + + +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Type declarations */ + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":11 + * void memcpy(void* s1, void* s2, int n) + * + * cdef struct AlignCell : # <<<<<<<<<<<<<< + * double score + * int path + */ + +struct __pyx_t_8obitools_5align_8_dynamic_AlignCell { + double score; + int path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":15 + * int path + * + * cdef struct AlignMatrix : # <<<<<<<<<<<<<< + * AlignCell* matrix + * int* bestVJump + */ + +struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix { + struct __pyx_t_8obitools_5align_8_dynamic_AlignCell *matrix; + int *bestVJump; + int *bestHJump; + int msize; + int vsize; + int hsize; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":24 + * + * + * cdef AlignMatrix* allocateMatrix(int hsize, int vsize,AlignMatrix *matrix=?) # <<<<<<<<<<<<<< + * + * cdef void freeMatrix(AlignMatrix* matrix) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *matrix; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":31 + * + * + * cdef struct alignSequence: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignSequence { + long length; + long buffsize; + int hasQuality; + char *sequence; + double *quality; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":38 + * double* quality + * + * cdef alignSequence* allocateSequence(object bioseq, alignSequence* seq=?) # <<<<<<<<<<<<<< + * + * cdef void freeSequence(alignSequence* seq) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *seq; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":42 + * cdef void freeSequence(alignSequence* seq) + * + * cdef struct alignPath: # <<<<<<<<<<<<<< + * long length + * long buffsize + */ + +struct __pyx_t_8obitools_5align_8_dynamic_alignPath { + long length; + long buffsize; + long vStart; + long hStart; + long *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":49 + * long *path + * + * cdef alignPath* allocatePath(long l1,long l2,alignPath* path=?) # <<<<<<<<<<<<<< + * + * cdef void reversePath(alignPath* path) + */ + +struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath { + int __pyx_n; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 + * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) + * + * cdef class DynamicProgramming: # <<<<<<<<<<<<<< + * cdef AlignMatrix* matrix + * + */ + +struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming { + PyObject_HEAD + struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtab; + struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *matrix; + PyObject *horizontalSeq; + PyObject *verticalSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *hSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *vSeq; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *path; + double _opengap; + double _extgap; + PyObject *alignment; + int sequenceChanged; + int scoreChanged; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":3 + * from _dynamic cimport * + * + * cdef class NWS(DynamicProgramming): # <<<<<<<<<<<<<< + * cdef double _match + * cdef double _mismatch + */ + +struct __pyx_obj_8obitools_5align_4_nws_NWS { + struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming __pyx_base; + double _match; + double _mismatch; +}; + +struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble { + struct __pyx_obj_8obitools_5align_4_nws_NWS __pyx_base; + double xsmax; + int xmax; +}; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pxd":9 + * cdef double doAlignment(self) except? 0 + * + * cdef class RightReverseAssemble(RightDirectAssemble): # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble { + struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_base; +}; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_dynamic.pxd":61 + * cpdef double iupacPartialMatch(unsigned char a, unsigned char b) + * + * cdef class DynamicProgramming: # <<<<<<<<<<<<<< + * cdef AlignMatrix* matrix + * + */ + +struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming { + int (*allocate)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + double (*matchScore)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + double (*doAlignment)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*reset)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + int (*index)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *, int, int); + int (*_needToCompute)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); + void (*backtrack)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *); +}; +static struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming *__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":3 + * from _dynamic cimport * + * + * cdef class NWS(DynamicProgramming): # <<<<<<<<<<<<<< + * cdef double _match + * cdef double _mismatch + */ + +struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS { + struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS *__pyx_vtabptr_8obitools_5align_4_nws_NWS; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":11 + * + * + * cdef class RightDirectAssemble(NWS): # <<<<<<<<<<<<<< + * + * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): + */ + +struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble { + struct __pyx_vtabstruct_8obitools_5align_4_nws_NWS __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *__pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble; + + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":148 + * + * + * cdef class RightReverseAssemble(RightDirectAssemble): # <<<<<<<<<<<<<< + * + * property seqB: + */ + +struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightReverseAssemble { + struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_base; +}; +static struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightReverseAssemble *__pyx_vtabptr_8obitools_5align_10_rassemble_RightReverseAssemble; +/* Module declarations from obitools.align._dynamic */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = 0; +static struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(*__pyx_f_8obitools_5align_8_dynamic_allocateMatrix)(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freeMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_resetMatrix)(struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(*__pyx_f_8obitools_5align_8_dynamic_allocateSequence)(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freeSequence)(struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *); /*proto*/ +static struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(*__pyx_f_8obitools_5align_8_dynamic_allocatePath)(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_reversePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static void (*__pyx_f_8obitools_5align_8_dynamic_freePath)(struct __pyx_t_8obitools_5align_8_dynamic_alignPath *); /*proto*/ +static int (*__pyx_f_8obitools_5align_8_dynamic_bitCount)(int); /*proto*/ +static int (*__pyx_f_8obitools_5align_8_dynamic_iupacMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ +static double (*__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch)(unsigned char, unsigned char, int __pyx_skip_dispatch); /*proto*/ +/* Module declarations from obitools.align._nws */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_4_nws_NWS = 0; +/* Module declarations from obitools.align._rassemble */ + +static PyTypeObject *__pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble = 0; +static PyTypeObject *__pyx_ptype_8obitools_5align_10_rassemble_RightReverseAssemble = 0; +#define __Pyx_MODULE_NAME "obitools.align._rassemble" +int __pyx_module_is_main_obitools__align___rassemble = 0; + +/* Implementation of obitools.align._rassemble */ +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_neg_6; +static PyObject *__pyx_int_neg_8; +static PyObject *__pyx_int_neg_2; +static PyObject *__pyx_int_1; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k___init__[] = "__init__"; +static PyObject *__pyx_kp___init__; +static char __pyx_k_match[] = "match"; +static PyObject *__pyx_kp_match; +static char __pyx_k_mismatch[] = "mismatch"; +static PyObject *__pyx_kp_mismatch; +static char __pyx_k_opengap[] = "opengap"; +static PyObject *__pyx_kp_opengap; +static char __pyx_k_extgap[] = "extgap"; +static PyObject *__pyx_kp_extgap; +static char __pyx_k_seq[] = "seq"; +static PyObject *__pyx_kp_seq; +static char __pyx_k_needToCompute[] = "needToCompute"; +static PyObject *__pyx_kp_needToCompute; +static char __pyx_k_range[] = "range"; +static PyObject *__pyx_kp_range; +static char __pyx_k_wrapped[] = "wrapped"; +static PyObject *__pyx_kp_wrapped; +static char __pyx_k_complement[] = "complement"; +static PyObject *__pyx_kp_complement; +static PyObject *__pyx_builtin_range; + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":13 + * cdef class RightDirectAssemble(NWS): + * + * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): # <<<<<<<<<<<<<< + * NWS.__init__(self,match,mismatch,opengap,extgap) + * self.xsmax=0 + */ + +static int __pyx_pf_8obitools_5align_10_rassemble_19RightDirectAssemble___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_8obitools_5align_10_rassemble_19RightDirectAssemble___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_match = 0; + PyObject *__pyx_v_mismatch = 0; + PyObject *__pyx_v_opengap = 0; + PyObject *__pyx_v_extgap = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_match,&__pyx_kp_mismatch,&__pyx_kp_opengap,&__pyx_kp_extgap,0}; + __Pyx_SetupRefcountContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[0] = __pyx_int_4; + values[1] = __pyx_int_neg_6; + values[2] = __pyx_int_neg_8; + values[3] = __pyx_int_neg_2; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_match); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_mismatch); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_opengap); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_extgap); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_match = values[0]; + __pyx_v_mismatch = values[1]; + __pyx_v_opengap = values[2]; + __pyx_v_extgap = values[3]; + } else { + __pyx_v_match = __pyx_int_4; + __pyx_v_mismatch = __pyx_int_neg_6; + __pyx_v_opengap = __pyx_int_neg_8; + __pyx_v_extgap = __pyx_int_neg_2; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_extgap = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_opengap = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_mismatch = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_match = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("obitools.align._rassemble.RightDirectAssemble.__init__"); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":14 + * + * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): + * NWS.__init__(self,match,mismatch,opengap,extgap) # <<<<<<<<<<<<<< + * self.xsmax=0 + * self.xmax=0 + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_8obitools_5align_4_nws_NWS)), __pyx_kp___init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_match); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_match); + __Pyx_GIVEREF(__pyx_v_match); + __Pyx_INCREF(__pyx_v_mismatch); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_mismatch); + __Pyx_GIVEREF(__pyx_v_mismatch); + __Pyx_INCREF(__pyx_v_opengap); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_opengap); + __Pyx_GIVEREF(__pyx_v_opengap); + __Pyx_INCREF(__pyx_v_extgap); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_extgap); + __Pyx_GIVEREF(__pyx_v_extgap); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":15 + * def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): + * NWS.__init__(self,match,mismatch,opengap,extgap) + * self.xsmax=0 # <<<<<<<<<<<<<< + * self.xmax=0 + * + */ + ((struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self)->xsmax = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":16 + * NWS.__init__(self,match,mismatch,opengap,extgap) + * self.xsmax=0 + * self.xmax=0 # <<<<<<<<<<<<<< + * + * cdef double doAlignment(self) except? 0: + */ + ((struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self)->xmax = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("obitools.align._rassemble.RightDirectAssemble.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":18 + * self.xmax=0 + * + * cdef double doAlignment(self) except? 0: # <<<<<<<<<<<<<< + * cdef int i # vertical index + * cdef int j # horizontal index + */ + +static double __pyx_f_8obitools_5align_10_rassemble_19RightDirectAssemble_doAlignment(struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble *__pyx_v_self) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_idx; + int __pyx_v_jump; + int __pyx_v_delta; + double __pyx_v_score; + double __pyx_v_scoremax; + int __pyx_v_path; + double __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("doAlignment"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":29 + * + * + * if self.needToCompute: # <<<<<<<<<<<<<< + * self.allocate() + * self.reset() + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_needToCompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":30 + * + * if self.needToCompute: + * self.allocate() # <<<<<<<<<<<<<< + * self.reset() + * self.xsmax=0 + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.allocate(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":31 + * if self.needToCompute: + * self.allocate() + * self.reset() # <<<<<<<<<<<<<< + * self.xsmax=0 + * self.xmax=0 + */ + ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.reset(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":32 + * self.allocate() + * self.reset() + * self.xsmax=0 # <<<<<<<<<<<<<< + * self.xmax=0 + * + */ + __pyx_v_self->xsmax = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":33 + * self.reset() + * self.xsmax=0 + * self.xmax=0 # <<<<<<<<<<<<<< + * + * for j in range(1,self.hSeq.length+1): + */ + __pyx_v_self->xmax = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":35 + * self.xmax=0 + * + * for j in range(1,self.hSeq.length+1): # <<<<<<<<<<<<<< + * idx = self.index(j,0) + * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (j-1)) + */ + for (__pyx_t_3 = 1; __pyx_t_3 < (__pyx_v_self->__pyx_base.__pyx_base.hSeq->length + 1); __pyx_t_3+=1) { + __pyx_v_j = __pyx_t_3; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":36 + * + * for j in range(1,self.hSeq.length+1): + * idx = self.index(j,0) # <<<<<<<<<<<<<< + * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (j-1)) + * self.matrix.matrix[idx].path = j + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, 0); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":37 + * for j in range(1,self.hSeq.length+1): + * idx = self.index(j,0) + * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (j-1)) # <<<<<<<<<<<<<< + * self.matrix.matrix[idx].path = j + * + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score = (__pyx_v_self->__pyx_base.__pyx_base._opengap + (__pyx_v_self->__pyx_base.__pyx_base._extgap * (__pyx_v_j - 1))); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":38 + * idx = self.index(j,0) + * self.matrix.matrix[idx].score = self._opengap + (self._extgap * (j-1)) + * self.matrix.matrix[idx].path = j # <<<<<<<<<<<<<< + * + * for i in range(1,self.vSeq.length+1): + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).path = __pyx_v_j; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":40 + * self.matrix.matrix[idx].path = j + * + * for i in range(1,self.vSeq.length+1): # <<<<<<<<<<<<<< + * idx = self.index(0,i) + * self.matrix.matrix[idx].score = 0 + */ + for (__pyx_t_3 = 1; __pyx_t_3 < (__pyx_v_self->__pyx_base.__pyx_base.vSeq->length + 1); __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":41 + * + * for i in range(1,self.vSeq.length+1): + * idx = self.index(0,i) # <<<<<<<<<<<<<< + * self.matrix.matrix[idx].score = 0 + * self.matrix.matrix[idx].path = -i + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), 0, __pyx_v_i); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":42 + * for i in range(1,self.vSeq.length+1): + * idx = self.index(0,i) + * self.matrix.matrix[idx].score = 0 # <<<<<<<<<<<<<< + * self.matrix.matrix[idx].path = -i + * + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":43 + * idx = self.index(0,i) + * self.matrix.matrix[idx].score = 0 + * self.matrix.matrix[idx].path = -i # <<<<<<<<<<<<<< + * + * for i in range(1,self.vSeq.length+1): + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).path = (-__pyx_v_i); + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":45 + * self.matrix.matrix[idx].path = -i + * + * for i in range(1,self.vSeq.length+1): # <<<<<<<<<<<<<< + * for j in range(1,self.hSeq.length+1): + * + */ + for (__pyx_t_3 = 1; __pyx_t_3 < (__pyx_v_self->__pyx_base.__pyx_base.vSeq->length + 1); __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":46 + * + * for i in range(1,self.vSeq.length+1): + * for j in range(1,self.hSeq.length+1): # <<<<<<<<<<<<<< + * + * # 1 - came from diagonal + */ + for (__pyx_t_4 = 1; __pyx_t_4 < (__pyx_v_self->__pyx_base.__pyx_base.hSeq->length + 1); __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":49 + * + * # 1 - came from diagonal + * idx = self.index(j-1,i-1) # <<<<<<<<<<<<<< + * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), + * scoremax = self.matrix.matrix[idx].score + \ + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), (__pyx_v_j - 1), (__pyx_v_i - 1)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":52 + * # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), + * scoremax = self.matrix.matrix[idx].score + \ + * self.matchScore(j,i) # <<<<<<<<<<<<<< + * path = 0 + * + */ + __pyx_v_scoremax = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.matchScore(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":53 + * scoremax = self.matrix.matrix[idx].score + \ + * self.matchScore(j,i) + * path = 0 # <<<<<<<<<<<<<< + * + * # print "so=%f sd=%f sm=%f" % (self.matrix.matrix[idx].score,self.matchScore(j,i),scoremax), + */ + __pyx_v_path = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":58 + * + * # 2 - open horizontal gap + * idx = self.index(j-1,i) # <<<<<<<<<<<<<< + * score = self.matrix.matrix[idx].score+ \ + * self._opengap + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), (__pyx_v_j - 1), __pyx_v_i); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":60 + * idx = self.index(j-1,i) + * score = self.matrix.matrix[idx].score+ \ + * self._opengap # <<<<<<<<<<<<<< + * if score > scoremax : + * scoremax = score + */ + __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + __pyx_v_self->__pyx_base.__pyx_base._opengap); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":61 + * score = self.matrix.matrix[idx].score+ \ + * self._opengap + * if score > scoremax : # <<<<<<<<<<<<<< + * scoremax = score + * path = +1 + */ + __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":62 + * self._opengap + * if score > scoremax : + * scoremax = score # <<<<<<<<<<<<<< + * path = +1 + * + */ + __pyx_v_scoremax = __pyx_v_score; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":63 + * if score > scoremax : + * scoremax = score + * path = +1 # <<<<<<<<<<<<<< + * + * # 3 - open vertical gap + */ + __pyx_v_path = 1; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":66 + * + * # 3 - open vertical gap + * idx = self.index(j,i-1) # <<<<<<<<<<<<<< + * score = self.matrix.matrix[idx].score + \ + * self._opengap + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, (__pyx_v_i - 1)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":68 + * idx = self.index(j,i-1) + * score = self.matrix.matrix[idx].score + \ + * self._opengap # <<<<<<<<<<<<<< + * if score > scoremax : + * scoremax = score + */ + __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + __pyx_v_self->__pyx_base.__pyx_base._opengap); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":69 + * score = self.matrix.matrix[idx].score + \ + * self._opengap + * if score > scoremax : # <<<<<<<<<<<<<< + * scoremax = score + * path = -1 + */ + __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":70 + * self._opengap + * if score > scoremax : + * scoremax = score # <<<<<<<<<<<<<< + * path = -1 + * + */ + __pyx_v_scoremax = __pyx_v_score; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":71 + * if score > scoremax : + * scoremax = score + * path = -1 # <<<<<<<<<<<<<< + * + * # 4 - extend horizontal gap + */ + __pyx_v_path = -1; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":74 + * + * # 4 - extend horizontal gap + * jump = self.matrix.bestHJump[i] # <<<<<<<<<<<<<< + * if jump >= 0: + * idx = self.index(jump,i) + */ + __pyx_v_jump = (__pyx_v_self->__pyx_base.__pyx_base.matrix->bestHJump[__pyx_v_i]); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":75 + * # 4 - extend horizontal gap + * jump = self.matrix.bestHJump[i] + * if jump >= 0: # <<<<<<<<<<<<<< + * idx = self.index(jump,i) + * delta = j-jump + */ + __pyx_t_2 = (__pyx_v_jump >= 0); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":76 + * jump = self.matrix.bestHJump[i] + * if jump >= 0: + * idx = self.index(jump,i) # <<<<<<<<<<<<<< + * delta = j-jump + * score = self.matrix.matrix[idx].score + \ + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_jump, __pyx_v_i); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":77 + * if jump >= 0: + * idx = self.index(jump,i) + * delta = j-jump # <<<<<<<<<<<<<< + * score = self.matrix.matrix[idx].score + \ + * self._extgap * delta + */ + __pyx_v_delta = (__pyx_v_j - __pyx_v_jump); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":79 + * delta = j-jump + * score = self.matrix.matrix[idx].score + \ + * self._extgap * delta # <<<<<<<<<<<<<< + * if score > scoremax : + * scoremax = score + */ + __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + (__pyx_v_self->__pyx_base.__pyx_base._extgap * __pyx_v_delta)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":80 + * score = self.matrix.matrix[idx].score + \ + * self._extgap * delta + * if score > scoremax : # <<<<<<<<<<<<<< + * scoremax = score + * path = delta+1 + */ + __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":81 + * self._extgap * delta + * if score > scoremax : + * scoremax = score # <<<<<<<<<<<<<< + * path = delta+1 + * + */ + __pyx_v_scoremax = __pyx_v_score; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":82 + * if score > scoremax : + * scoremax = score + * path = delta+1 # <<<<<<<<<<<<<< + * + * # 5 - extend vertical gap + */ + __pyx_v_path = (__pyx_v_delta + 1); + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":85 + * + * # 5 - extend vertical gap + * jump = self.matrix.bestVJump[j] # <<<<<<<<<<<<<< + * if jump >= 0: + * idx = self.index(j,jump) + */ + __pyx_v_jump = (__pyx_v_self->__pyx_base.__pyx_base.matrix->bestVJump[__pyx_v_j]); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":86 + * # 5 - extend vertical gap + * jump = self.matrix.bestVJump[j] + * if jump >= 0: # <<<<<<<<<<<<<< + * idx = self.index(j,jump) + * delta = i-jump + */ + __pyx_t_2 = (__pyx_v_jump >= 0); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":87 + * jump = self.matrix.bestVJump[j] + * if jump >= 0: + * idx = self.index(j,jump) # <<<<<<<<<<<<<< + * delta = i-jump + * score = self.matrix.matrix[idx].score + \ + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_jump); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":88 + * if jump >= 0: + * idx = self.index(j,jump) + * delta = i-jump # <<<<<<<<<<<<<< + * score = self.matrix.matrix[idx].score + \ + * self._extgap * delta + */ + __pyx_v_delta = (__pyx_v_i - __pyx_v_jump); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":90 + * delta = i-jump + * score = self.matrix.matrix[idx].score + \ + * self._extgap * delta # <<<<<<<<<<<<<< + * if score > scoremax : + * scoremax = score + */ + __pyx_v_score = ((__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score + (__pyx_v_self->__pyx_base.__pyx_base._extgap * __pyx_v_delta)); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":91 + * score = self.matrix.matrix[idx].score + \ + * self._extgap * delta + * if score > scoremax : # <<<<<<<<<<<<<< + * scoremax = score + * path = -delta-1 + */ + __pyx_t_2 = (__pyx_v_score > __pyx_v_scoremax); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":92 + * self._extgap * delta + * if score > scoremax : + * scoremax = score # <<<<<<<<<<<<<< + * path = -delta-1 + * + */ + __pyx_v_scoremax = __pyx_v_score; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":93 + * if score > scoremax : + * scoremax = score + * path = -delta-1 # <<<<<<<<<<<<<< + * + * idx = self.index(j,i) + */ + __pyx_v_path = ((-__pyx_v_delta) - 1); + goto __pyx_L17; + } + __pyx_L17:; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":95 + * path = -delta-1 + * + * idx = self.index(j,i) # <<<<<<<<<<<<<< + * self.matrix.matrix[idx].score = scoremax + * self.matrix.matrix[idx].path = path + */ + __pyx_v_idx = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":96 + * + * idx = self.index(j,i) + * self.matrix.matrix[idx].score = scoremax # <<<<<<<<<<<<<< + * self.matrix.matrix[idx].path = path + * + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).score = __pyx_v_scoremax; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":97 + * idx = self.index(j,i) + * self.matrix.matrix[idx].score = scoremax + * self.matrix.matrix[idx].path = path # <<<<<<<<<<<<<< + * + * if path == -1: + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[__pyx_v_idx]).path = __pyx_v_path; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":99 + * self.matrix.matrix[idx].path = path + * + * if path == -1: # <<<<<<<<<<<<<< + * self.matrix.bestVJump[j]=i + * elif path == +1 : + */ + __pyx_t_2 = (__pyx_v_path == -1); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":100 + * + * if path == -1: + * self.matrix.bestVJump[j]=i # <<<<<<<<<<<<<< + * elif path == +1 : + * self.matrix.bestHJump[i]=j + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->bestVJump[__pyx_v_j]) = __pyx_v_i; + goto __pyx_L18; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":101 + * if path == -1: + * self.matrix.bestVJump[j]=i + * elif path == +1 : # <<<<<<<<<<<<<< + * self.matrix.bestHJump[i]=j + * + */ + __pyx_t_2 = (__pyx_v_path == 1); + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":102 + * self.matrix.bestVJump[j]=i + * elif path == +1 : + * self.matrix.bestHJump[i]=j # <<<<<<<<<<<<<< + * + * if i==self.vSeq.length and scoremax > self.xsmax: + */ + (__pyx_v_self->__pyx_base.__pyx_base.matrix->bestHJump[__pyx_v_i]) = __pyx_v_j; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":104 + * self.matrix.bestHJump[i]=j + * + * if i==self.vSeq.length and scoremax > self.xsmax: # <<<<<<<<<<<<<< + * self.xsmax=scoremax + * self.xmax=j + */ + if ((__pyx_v_i == __pyx_v_self->__pyx_base.__pyx_base.vSeq->length)) { + __pyx_t_2 = (__pyx_v_scoremax > __pyx_v_self->xsmax); + } else { + __pyx_t_2 = (__pyx_v_i == __pyx_v_self->__pyx_base.__pyx_base.vSeq->length); + } + if (__pyx_t_2) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":105 + * + * if i==self.vSeq.length and scoremax > self.xsmax: + * self.xsmax=scoremax # <<<<<<<<<<<<<< + * self.xmax=j + * + */ + __pyx_v_self->xsmax = __pyx_v_scoremax; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":106 + * if i==self.vSeq.length and scoremax > self.xsmax: + * self.xsmax=scoremax + * self.xmax=j # <<<<<<<<<<<<<< + * + * self.sequenceChanged=False + */ + __pyx_v_self->xmax = __pyx_v_j; + goto __pyx_L19; + } + __pyx_L19:; + } + } + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":108 + * self.xmax=j + * + * self.sequenceChanged=False # <<<<<<<<<<<<<< + * self.scoreChanged=False + * + */ + __pyx_v_self->__pyx_base.__pyx_base.sequenceChanged = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":109 + * + * self.sequenceChanged=False + * self.scoreChanged=False # <<<<<<<<<<<<<< + * + * return self.xsmax + */ + __pyx_v_self->__pyx_base.__pyx_base.scoreChanged = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":111 + * self.scoreChanged=False + * + * return self.xsmax # <<<<<<<<<<<<<< + * + * cdef void backtrack(self): + */ + __pyx_r = __pyx_v_self->xsmax; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.align._rassemble.RightDirectAssemble.doAlignment"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":113 + * return self.xsmax + * + * cdef void backtrack(self): # <<<<<<<<<<<<<< + * cdef list path=[] + * cdef int i + */ + +static void __pyx_f_8obitools_5align_10_rassemble_19RightDirectAssemble_backtrack(struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble *__pyx_v_self) { + PyObject *__pyx_v_path = 0; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_p; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath __pyx_1; + PyObject *__pyx_t_1 = NULL; + double __pyx_t_2; + struct __pyx_t_8obitools_5align_8_dynamic_alignPath *__pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("backtrack"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":114 + * + * cdef void backtrack(self): + * cdef list path=[] # <<<<<<<<<<<<<< + * cdef int i + * cdef int j + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_path = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":119 + * cdef int p + * + * self.doAlignment() # <<<<<<<<<<<<<< + * j=self.xmax + * i=self.vSeq.length + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.doAlignment(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self)); if (unlikely(__pyx_t_2 == 0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":120 + * + * self.doAlignment() + * j=self.xmax # <<<<<<<<<<<<<< + * i=self.vSeq.length + * self.path=allocatePath(i,j+1,self.path) + */ + __pyx_v_j = __pyx_v_self->xmax; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":121 + * self.doAlignment() + * j=self.xmax + * i=self.vSeq.length # <<<<<<<<<<<<<< + * self.path=allocatePath(i,j+1,self.path) + * + */ + __pyx_v_i = __pyx_v_self->__pyx_base.__pyx_base.vSeq->length; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":122 + * j=self.xmax + * i=self.vSeq.length + * self.path=allocatePath(i,j+1,self.path) # <<<<<<<<<<<<<< + * + * if self.xmax__pyx_base.__pyx_base.path; + __pyx_t_3 = __pyx_f_8obitools_5align_8_dynamic_allocatePath(__pyx_v_i, (__pyx_v_j + 1), &__pyx_1); + __pyx_v_self->__pyx_base.__pyx_base.path = __pyx_t_3; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":124 + * self.path=allocatePath(i,j+1,self.path) + * + * if self.xmaxxmax < __pyx_v_self->__pyx_base.__pyx_base.hSeq->length); + if (__pyx_t_4) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":125 + * + * if self.xmax__pyx_base.__pyx_base.path->path[__pyx_v_self->__pyx_base.__pyx_base.path->length]) = (__pyx_v_self->__pyx_base.__pyx_base.vSeq->length - __pyx_v_self->xmax); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":126 + * if self.xmax__pyx_base.__pyx_base.path->length += 1; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":128 + * self.path.length+=1 + * + * while (i or j): # <<<<<<<<<<<<<< + * p=self.matrix.matrix[self.index(j,i)].path + * self.path.path[self.path.length]=p + */ + while (1) { + if (!__pyx_v_i) { + __pyx_t_4 = __pyx_v_j; + } else { + __pyx_t_4 = __pyx_v_i; + } + if (!__pyx_t_4) break; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":129 + * + * while (i or j): + * p=self.matrix.matrix[self.index(j,i)].path # <<<<<<<<<<<<<< + * self.path.path[self.path.length]=p + * self.path.length+=1 + */ + __pyx_v_p = (__pyx_v_self->__pyx_base.__pyx_base.matrix->matrix[((struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.index(((struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *)__pyx_v_self), __pyx_v_j, __pyx_v_i)]).path; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":130 + * while (i or j): + * p=self.matrix.matrix[self.index(j,i)].path + * self.path.path[self.path.length]=p # <<<<<<<<<<<<<< + * self.path.length+=1 + * #path.append(p) + */ + (__pyx_v_self->__pyx_base.__pyx_base.path->path[__pyx_v_self->__pyx_base.__pyx_base.path->length]) = __pyx_v_p; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":131 + * p=self.matrix.matrix[self.index(j,i)].path + * self.path.path[self.path.length]=p + * self.path.length+=1 # <<<<<<<<<<<<<< + * #path.append(p) + * if p==0: + */ + __pyx_v_self->__pyx_base.__pyx_base.path->length += 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":133 + * self.path.length+=1 + * #path.append(p) + * if p==0: # <<<<<<<<<<<<<< + * i-=1 + * j-=1 + */ + __pyx_t_4 = (__pyx_v_p == 0); + if (__pyx_t_4) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":134 + * #path.append(p) + * if p==0: + * i-=1 # <<<<<<<<<<<<<< + * j-=1 + * elif p < 0: + */ + __pyx_v_i -= 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":135 + * if p==0: + * i-=1 + * j-=1 # <<<<<<<<<<<<<< + * elif p < 0: + * i+=p + */ + __pyx_v_j -= 1; + goto __pyx_L6; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":136 + * i-=1 + * j-=1 + * elif p < 0: # <<<<<<<<<<<<<< + * i+=p + * else: + */ + __pyx_t_4 = (__pyx_v_p < 0); + if (__pyx_t_4) { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":137 + * j-=1 + * elif p < 0: + * i+=p # <<<<<<<<<<<<<< + * else: + * j-=p + */ + __pyx_v_i += __pyx_v_p; + goto __pyx_L6; + } + /*else*/ { + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":139 + * i+=p + * else: + * j-=p # <<<<<<<<<<<<<< + * + * #path.reverse() + */ + __pyx_v_j -= __pyx_v_p; + } + __pyx_L6:; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":142 + * + * #path.reverse() + * self.path.hStart=0 # <<<<<<<<<<<<<< + * self.path.vStart=0 + * #reversePath(self.path) + */ + __pyx_v_self->__pyx_base.__pyx_base.path->hStart = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":143 + * #path.reverse() + * self.path.hStart=0 + * self.path.vStart=0 # <<<<<<<<<<<<<< + * #reversePath(self.path) + * #return 0,0,path + */ + __pyx_v_self->__pyx_base.__pyx_base.path->vStart = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_WriteUnraisable("obitools.align._rassemble.RightDirectAssemble.backtrack"); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_path); + __Pyx_FinishRefcountContext(); +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":151 + * + * property seqB: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.verticalSeq.wrapped + * + */ + +static PyObject *__pyx_pf_8obitools_5align_10_rassemble_20RightReverseAssemble_4seqB___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_8obitools_5align_10_rassemble_20RightReverseAssemble_4seqB___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("__get__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":152 + * property seqB: + * def __get__(self): + * return self.verticalSeq.wrapped # <<<<<<<<<<<<<< + * + * def __set__(self, seq): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq, __pyx_kp_wrapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.align._rassemble.RightReverseAssemble.seqB.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":154 + * return self.verticalSeq.wrapped + * + * def __set__(self, seq): # <<<<<<<<<<<<<< + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() + */ + +static int __pyx_pf_8obitools_5align_10_rassemble_20RightReverseAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_8obitools_5align_10_rassemble_20RightReverseAssemble_4seqB___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + int __pyx_r; + struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence __pyx_1; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *__pyx_t_3; + __Pyx_SetupRefcountContext("__set__"); + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":155 + * + * def __set__(self, seq): + * self.sequenceChanged=True # <<<<<<<<<<<<<< + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + */ + ((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.sequenceChanged = 1; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":156 + * def __set__(self, seq): + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() # <<<<<<<<<<<<<< + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_seq, __pyx_kp_complement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + __Pyx_DECREF(((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq); + ((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_rassemble.pyx":157 + * self.sequenceChanged=True + * self.verticalSeq=seq.complement() + * self.vSeq=allocateSequence(self.verticalSeq,self.vSeq) # <<<<<<<<<<<<<< + */ + __pyx_1.__pyx_n = 1; + __pyx_1.seq = ((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.vSeq; + __pyx_t_3 = __pyx_f_8obitools_5align_8_dynamic_allocateSequence(((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.verticalSeq, &__pyx_1); + ((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.vSeq = __pyx_t_3; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("obitools.align._rassemble.RightReverseAssemble.seqB.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_FinishRefcountContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightDirectAssemble __pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble; + +static PyObject *__pyx_tp_new_8obitools_5align_10_rassemble_RightDirectAssemble(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble *p; + PyObject *o = __pyx_ptype_8obitools_5align_4_nws_NWS->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming*)__pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble; + return o; +} + +static void __pyx_tp_dealloc_8obitools_5align_10_rassemble_RightDirectAssemble(PyObject *o) { + __pyx_ptype_8obitools_5align_4_nws_NWS->tp_dealloc(o); +} + +static int __pyx_tp_traverse_8obitools_5align_10_rassemble_RightDirectAssemble(PyObject *o, visitproc v, void *a) { + int e; + if (__pyx_ptype_8obitools_5align_4_nws_NWS->tp_traverse) { + e = __pyx_ptype_8obitools_5align_4_nws_NWS->tp_traverse(o, v, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_8obitools_5align_10_rassemble_RightDirectAssemble(PyObject *o) { + if (__pyx_ptype_8obitools_5align_4_nws_NWS->tp_clear) { + __pyx_ptype_8obitools_5align_4_nws_NWS->tp_clear(o); + } + return 0; +} + +static struct PyMethodDef __pyx_methods_8obitools_5align_10_rassemble_RightDirectAssemble[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_RightDirectAssemble = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_RightDirectAssemble = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_RightDirectAssemble = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_RightDirectAssemble = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_8obitools_5align_10_rassemble_RightDirectAssemble = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("obitools.align._rassemble.RightDirectAssemble"), /*tp_name*/ + sizeof(struct __pyx_obj_8obitools_5align_10_rassemble_RightDirectAssemble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_RightDirectAssemble, /*tp_as_number*/ + &__pyx_tp_as_sequence_RightDirectAssemble, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_RightDirectAssemble, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_RightDirectAssemble, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_traverse*/ + __pyx_tp_clear_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_8obitools_5align_10_rassemble_19RightDirectAssemble___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; +static struct __pyx_vtabstruct_8obitools_5align_10_rassemble_RightReverseAssemble __pyx_vtable_8obitools_5align_10_rassemble_RightReverseAssemble; + +static PyObject *__pyx_tp_new_8obitools_5align_10_rassemble_RightReverseAssemble(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *p; + PyObject *o = __pyx_tp_new_8obitools_5align_10_rassemble_RightDirectAssemble(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_8obitools_5align_8_dynamic_DynamicProgramming*)__pyx_vtabptr_8obitools_5align_10_rassemble_RightReverseAssemble; + return o; +} + +static PyObject *__pyx_getprop_8obitools_5align_10_rassemble_20RightReverseAssemble_seqB(PyObject *o, void *x) { + return __pyx_pf_8obitools_5align_10_rassemble_20RightReverseAssemble_4seqB___get__(o); +} + +static int __pyx_setprop_8obitools_5align_10_rassemble_20RightReverseAssemble_seqB(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_8obitools_5align_10_rassemble_20RightReverseAssemble_4seqB___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static struct PyMethodDef __pyx_methods_8obitools_5align_10_rassemble_RightReverseAssemble[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_8obitools_5align_10_rassemble_RightReverseAssemble[] = { + {(char *)"seqB", __pyx_getprop_8obitools_5align_10_rassemble_20RightReverseAssemble_seqB, __pyx_setprop_8obitools_5align_10_rassemble_20RightReverseAssemble_seqB, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_RightReverseAssemble = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_RightReverseAssemble = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_RightReverseAssemble = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_RightReverseAssemble = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_8obitools_5align_10_rassemble_RightReverseAssemble = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("obitools.align._rassemble.RightReverseAssemble"), /*tp_name*/ + sizeof(struct __pyx_obj_8obitools_5align_10_rassemble_RightReverseAssemble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + &__pyx_tp_as_number_RightReverseAssemble, /*tp_as_number*/ + &__pyx_tp_as_sequence_RightReverseAssemble, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_RightReverseAssemble, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_RightReverseAssemble, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_traverse*/ + __pyx_tp_clear_8obitools_5align_10_rassemble_RightDirectAssemble, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8obitools_5align_10_rassemble_RightReverseAssemble, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_8obitools_5align_10_rassemble_RightReverseAssemble, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8obitools_5align_10_rassemble_RightReverseAssemble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ +}; + +static struct PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_rassemble"), + __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, + {&__pyx_kp_match, __pyx_k_match, sizeof(__pyx_k_match), 1, 1, 1}, + {&__pyx_kp_mismatch, __pyx_k_mismatch, sizeof(__pyx_k_mismatch), 1, 1, 1}, + {&__pyx_kp_opengap, __pyx_k_opengap, sizeof(__pyx_k_opengap), 1, 1, 1}, + {&__pyx_kp_extgap, __pyx_k_extgap, sizeof(__pyx_k_extgap), 1, 1, 1}, + {&__pyx_kp_seq, __pyx_k_seq, sizeof(__pyx_k_seq), 1, 1, 1}, + {&__pyx_kp_needToCompute, __pyx_k_needToCompute, sizeof(__pyx_k_needToCompute), 1, 1, 1}, + {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, + {&__pyx_kp_wrapped, __pyx_k_wrapped, sizeof(__pyx_k_wrapped), 1, 1, 1}, + {&__pyx_kp_complement, __pyx_k_complement, sizeof(__pyx_k_complement), 1, 1, 1}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_6 = PyInt_FromLong(-6); if (unlikely(!__pyx_int_neg_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_8 = PyInt_FromLong(-8); if (unlikely(!__pyx_int_neg_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_rassemble(void); /*proto*/ +PyMODINIT_FUNC init_rassemble(void) +#else +PyMODINIT_FUNC PyInit__rassemble(void); /*proto*/ +PyMODINIT_FUNC PyInit__rassemble(void) +#endif +{ + PyObject *__pyx_1 = 0; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit__rassemble(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_rassemble"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__pyx_module_is_main_obitools__align___rassemble) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_8obitools_5align_4_nws_NWS = __Pyx_ImportType("obitools.align._nws", "NWS", sizeof(struct __pyx_obj_8obitools_5align_4_nws_NWS)); if (unlikely(!__pyx_ptype_8obitools_5align_4_nws_NWS)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_4_nws_NWS->tp_dict, &__pyx_vtabptr_8obitools_5align_4_nws_NWS) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble = &__pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble; + __pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_4_nws_NWS; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble.__pyx_base.__pyx_base.doAlignment = (double (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_10_rassemble_19RightDirectAssemble_doAlignment; + __pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble.__pyx_base.__pyx_base.backtrack = (void (*)(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming *))__pyx_f_8obitools_5align_10_rassemble_19RightDirectAssemble_backtrack; + #else + *(void(**)(void))&__pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble.__pyx_base.__pyx_base.doAlignment = (void(*)(void))__pyx_f_8obitools_5align_10_rassemble_19RightDirectAssemble_doAlignment; + *(void(**)(void))&__pyx_vtable_8obitools_5align_10_rassemble_RightDirectAssemble.__pyx_base.__pyx_base.backtrack = (void(*)(void))__pyx_f_8obitools_5align_10_rassemble_19RightDirectAssemble_backtrack; + #endif + __pyx_type_8obitools_5align_10_rassemble_RightDirectAssemble.tp_base = __pyx_ptype_8obitools_5align_4_nws_NWS; + if (PyType_Ready(&__pyx_type_8obitools_5align_10_rassemble_RightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_10_rassemble_RightDirectAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "RightDirectAssemble", (PyObject *)&__pyx_type_8obitools_5align_10_rassemble_RightDirectAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble = &__pyx_type_8obitools_5align_10_rassemble_RightDirectAssemble; + __pyx_vtabptr_8obitools_5align_10_rassemble_RightReverseAssemble = &__pyx_vtable_8obitools_5align_10_rassemble_RightReverseAssemble; + __pyx_vtable_8obitools_5align_10_rassemble_RightReverseAssemble.__pyx_base = *__pyx_vtabptr_8obitools_5align_10_rassemble_RightDirectAssemble; + __pyx_type_8obitools_5align_10_rassemble_RightReverseAssemble.tp_base = __pyx_ptype_8obitools_5align_10_rassemble_RightDirectAssemble; + if (PyType_Ready(&__pyx_type_8obitools_5align_10_rassemble_RightReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8obitools_5align_10_rassemble_RightReverseAssemble.tp_dict, __pyx_vtabptr_8obitools_5align_10_rassemble_RightReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "RightReverseAssemble", (PyObject *)&__pyx_type_8obitools_5align_10_rassemble_RightReverseAssemble) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8obitools_5align_10_rassemble_RightReverseAssemble = &__pyx_type_8obitools_5align_10_rassemble_RightReverseAssemble; + /*--- Type import code ---*/ + __pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming = __Pyx_ImportType("obitools.align._dynamic", "DynamicProgramming", sizeof(struct __pyx_obj_8obitools_5align_8_dynamic_DynamicProgramming)); if (unlikely(!__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_GetVtable(__pyx_ptype_8obitools_5align_8_dynamic_DynamicProgramming->tp_dict, &__pyx_vtabptr_8obitools_5align_8_dynamic_DynamicProgramming) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + __pyx_1 = __Pyx_ImportModule("obitools.align._dynamic"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocateMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateMatrix, "struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *(int, int, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateMatrix *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freeMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "resetMatrix", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_resetMatrix, "void (struct __pyx_t_8obitools_5align_8_dynamic_AlignMatrix *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocateSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocateSequence, "struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *(PyObject *, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocateSequence *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freeSequence", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freeSequence, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignSequence *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "allocatePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_allocatePath, "struct __pyx_t_8obitools_5align_8_dynamic_alignPath *(long, long, struct __pyx_opt_args_8obitools_5align_8_dynamic_allocatePath *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "reversePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_reversePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "freePath", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_freePath, "void (struct __pyx_t_8obitools_5align_8_dynamic_alignPath *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "bitCount", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_bitCount, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "iupacMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacMatch, "int (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_1, "iupacPartialMatch", (void (**)(void))&__pyx_f_8obitools_5align_8_dynamic_iupacPartialMatch, "double (unsigned char, unsigned char, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_1); __pyx_1 = 0; + /*--- Execution code ---*/ + + /* "/Users/coissac/encours/OBITools/src/obitools/align/_nws.pxd":1 + * from _dynamic cimport * # <<<<<<<<<<<<<< + * + * cdef class NWS(DynamicProgramming): + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + if (__pyx_m) { + __Pyx_AddTraceback("init obitools.align._rassemble"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init obitools.align._rassemble"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "_rassemble.pyx", + "_dynamic.pxd", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((char)-1) > ((char)0) && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((short)-1) > ((short)0) && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((int)-1) > ((int)0) && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s does not appear to be the correct type object", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) { + int result; + PyObject *pycobj; + + pycobj = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!pycobj) + goto bad; + *(void **)vtabptr = PyCObject_AsVoidPtr(pycobj); + if (!*(void **)vtabptr) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + PyObject *pycobj = 0; + int result; + + pycobj = PyCObject_FromVoidPtr(vtable, 0); + if (!pycobj) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + goto bad; + result = 0; + goto done; + +bad: + result = -1; +done: + Py_XDECREF(pycobj); + return result; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#if PY_VERSION_HEX < 0x02050000 + char *api = (char *)"__pyx_capi__"; +#else + const char *api = "__pyx_capi__"; +#endif + PyObject *d = 0; + PyObject *cobj = 0; + const char *desc; + const char *s1, *s2; + union { + void (*fp)(void); + void *p; + } tmp; + + d = PyObject_GetAttrString(module, api); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj); + *f = tmp.fp; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode && (!t->is_identifier)) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/src/obitools/align/_rassemble.pxd b/src/obitools/align/_rassemble.pxd new file mode 100644 index 0000000..2b32986 --- /dev/null +++ b/src/obitools/align/_rassemble.pxd @@ -0,0 +1,10 @@ +from _nws cimport * + +cdef class RightDirectAssemble(NWS): + cdef double xsmax + cdef int xmax + + cdef double doAlignment(self) except? 0 + +cdef class RightReverseAssemble(RightDirectAssemble): + pass \ No newline at end of file diff --git a/src/obitools/align/_rassemble.pyx b/src/obitools/align/_rassemble.pyx new file mode 100644 index 0000000..ec3dfec --- /dev/null +++ b/src/obitools/align/_rassemble.pyx @@ -0,0 +1,157 @@ +#...@PydevCodeAnalysisIgnore +''' +Created on 6 Nov. 2009 + +@author: coissac +''' + +from _rassemble cimport * + + +cdef class RightDirectAssemble(NWS): + + def __init__(self,match=4,mismatch=-6,opengap=-8,extgap=-2): + NWS.__init__(self,match,mismatch,opengap,extgap) + self.xsmax=0 + self.xmax=0 + + cdef double doAlignment(self) except? 0: + cdef int i # vertical index + cdef int j # horizontal index + cdef int idx + cdef int jump + cdef int delta + cdef double score + cdef double scoremax + cdef int path + + + if self.needToCompute: + self.allocate() + self.reset() + self.xsmax=0 + self.xmax=0 + + for j in range(1,self.hSeq.length+1): + idx = self.index(j,0) + self.matrix.matrix[idx].score = self._opengap + (self._extgap * (j-1)) + self.matrix.matrix[idx].path = j + + for i in range(1,self.vSeq.length+1): + idx = self.index(0,i) + self.matrix.matrix[idx].score = 0 + self.matrix.matrix[idx].path = -i + + for i in range(1,self.vSeq.length+1): + for j in range(1,self.hSeq.length+1): + + # 1 - came from diagonal + idx = self.index(j-1,i-1) + # print "computing cell : %d,%d --> %d/%d" % (j,i,self.index(j,i),self.matrix.msize), + scoremax = self.matrix.matrix[idx].score + \ + self.matchScore(j,i) + path = 0 + + # print "so=%f sd=%f sm=%f" % (self.matrix.matrix[idx].score,self.matchScore(j,i),scoremax), + + # 2 - open horizontal gap + idx = self.index(j-1,i) + score = self.matrix.matrix[idx].score+ \ + self._opengap + if score > scoremax : + scoremax = score + path = +1 + + # 3 - open vertical gap + idx = self.index(j,i-1) + score = self.matrix.matrix[idx].score + \ + self._opengap + if score > scoremax : + scoremax = score + path = -1 + + # 4 - extend horizontal gap + jump = self.matrix.bestHJump[i] + if jump >= 0: + idx = self.index(jump,i) + delta = j-jump + score = self.matrix.matrix[idx].score + \ + self._extgap * delta + if score > scoremax : + scoremax = score + path = delta+1 + + # 5 - extend vertical gap + jump = self.matrix.bestVJump[j] + if jump >= 0: + idx = self.index(j,jump) + delta = i-jump + score = self.matrix.matrix[idx].score + \ + self._extgap * delta + if score > scoremax : + scoremax = score + path = -delta-1 + + idx = self.index(j,i) + self.matrix.matrix[idx].score = scoremax + self.matrix.matrix[idx].path = path + + if path == -1: + self.matrix.bestVJump[j]=i + elif path == +1 : + self.matrix.bestHJump[i]=j + + if i==self.vSeq.length and scoremax > self.xsmax: + self.xsmax=scoremax + self.xmax=j + + self.sequenceChanged=False + self.scoreChanged=False + + return self.xsmax + + cdef void backtrack(self): + cdef list path=[] + cdef int i + cdef int j + cdef int p + + self.doAlignment() + j=self.xmax + i=self.vSeq.length + self.path=allocatePath(i,j+1,self.path) + + if self.xmaxob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define PyBytes_Type PyString_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#else + #define _USE_MATH_DEFINES +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif +#include +#define __PYX_HAVE_API__obitools__fastq___fastq +#include "math.h" +#include "string.h" +#include "stdlib.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) + + +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE +#endif + +typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ + + + +static int __pyx_skip_dispatch = 0; + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString +#else +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString +#endif + +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + + +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif + +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; +static const char **__pyx_f; + +static char __pyx_mdoc[] = "\nCreated on 16 sept. 2009\n\n@author: coissac\n"; + + +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#else +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Type declarations */ + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":26 + * + * + * cpdef object fastqQualityDecoder(char* qualstring, int base=0): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int mq=255 + */ + +struct __pyx_opt_args_8obitools_5fastq_6_fastq_fastqQualityDecoder { + int __pyx_n; + int base; +}; +/* Module declarations from obitools.fastq._fastq */ + +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_fastqQualityDecoder(char *, int __pyx_skip_dispatch, struct __pyx_opt_args_8obitools_5fastq_6_fastq_fastqQualityDecoder *__pyx_optional_args); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder(char *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder(char *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_qualityToSolexaError(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_qualityToSangerError(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_errorToSangerQuality(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_solexaToSangerQuality(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_errorToSangerFastQStr(PyObject *, int __pyx_skip_dispatch); /*proto*/ +#define __Pyx_MODULE_NAME "obitools.fastq._fastq" +int __pyx_module_is_main_obitools__fastq___fastq = 0; + +/* Implementation of obitools.fastq._fastq */ +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k_fastqQualityDecoder[] = "fastqQualityDecoder"; +static PyObject *__pyx_kp_fastqQualityDecoder; +static char __pyx_k_20[] = "fastqQualitySangerDecoder"; +static PyObject *__pyx_kp_20; +static char __pyx_k_21[] = "fastqQualitySolexaDecoder"; +static PyObject *__pyx_kp_21; +static char __pyx_k_22[] = "qualityToSolexaError"; +static PyObject *__pyx_kp_22; +static char __pyx_k_23[] = "qualityToSangerError"; +static PyObject *__pyx_kp_23; +static char __pyx_k_24[] = "errorToSangerQuality"; +static PyObject *__pyx_kp_24; +static char __pyx_k_25[] = "solexaToSangerQuality"; +static PyObject *__pyx_kp_25; +static char __pyx_k_26[] = "errorToSangerFastQStr"; +static PyObject *__pyx_kp_26; +static char __pyx_k_qualstring[] = "qualstring"; +static PyObject *__pyx_kp_qualstring; +static char __pyx_k_base[] = "base"; +static PyObject *__pyx_kp_base; +static char __pyx_k_quality[] = "quality"; +static PyObject *__pyx_kp_quality; +static char __pyx_k_array[] = "array"; +static PyObject *__pyx_kp_array; +static char __pyx_k_27[] = "d"; +static PyObject *__pyx_kp_27; +static char __pyx_k_buffer_info[] = "buffer_info"; +static PyObject *__pyx_kp_buffer_info; +static char __pyx_k_range[] = "range"; +static PyObject *__pyx_kp_range; +static PyObject *__pyx_builtin_range; + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":26 + * + * + * cpdef object fastqQualityDecoder(char* qualstring, int base=0): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int mq=255 + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualityDecoder(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_fastqQualityDecoder(char *__pyx_v_qualstring, int __pyx_skip_dispatch, struct __pyx_opt_args_8obitools_5fastq_6_fastq_fastqQualityDecoder *__pyx_optional_args) { + int __pyx_v_base = 0; + int __pyx_v_i; + int __pyx_v_mq; + PyObject *__pyx_v_quality; + PyObject *__pyx_v_olength; + double *__pyx_v_bdouble; + PyObject *__pyx_v_oaddress; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + unsigned long __pyx_t_4; + int __pyx_t_5; + __Pyx_SetupRefcountContext("fastqQualityDecoder"); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_base = __pyx_optional_args->base; + } + } + __pyx_v_quality = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":27 + * + * cpdef object fastqQualityDecoder(char* qualstring, int base=0): + * cdef int i=0 # <<<<<<<<<<<<<< + * cdef int mq=255 + * cdef object quality + */ + __pyx_v_i = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":28 + * cpdef object fastqQualityDecoder(char* qualstring, int base=0): + * cdef int i=0 + * cdef int mq=255 # <<<<<<<<<<<<<< + * cdef object quality + * cdef object oaddresse,olength + */ + __pyx_v_mq = 255; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":34 + * cdef double* bdouble + * + * quality = array('d',[0] * strlen(qualstring)) # <<<<<<<<<<<<<< + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_array); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_int_0); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_2 = PyInt_FromLong(strlen(__pyx_v_qualstring)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_27); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_27); + __Pyx_GIVEREF(__pyx_kp_27); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_quality); + __pyx_v_quality = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":35 + * + * quality = array('d',[0] * strlen(qualstring)) + * (oaddress,olength)=quality.buffer_info() # <<<<<<<<<<<<<< + * bdouble=oaddress + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_quality, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":36 + * quality = array('d',[0] * strlen(qualstring)) + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress # <<<<<<<<<<<<<< + * + * if base==0: + */ + __pyx_t_4 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_4 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bdouble = ((double *)((unsigned long)__pyx_t_4)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":38 + * bdouble=oaddress + * + * if base==0: # <<<<<<<<<<<<<< + * mq = 255 + * while (qualstring[i]!=0): + */ + __pyx_t_5 = (__pyx_v_base == 0); + if (__pyx_t_5) { + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":39 + * + * if base==0: + * mq = 255 # <<<<<<<<<<<<<< + * while (qualstring[i]!=0): + * if qualstring[i] 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_base); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fastqQualityDecoder") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_qualstring = __Pyx_PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_qualstring) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_base = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_base == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_base = 0; + } + } else { + __pyx_v_base = 0; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_base = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_base == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_qualstring = __Pyx_PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_qualstring) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fastqQualityDecoder", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualityDecoder"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_1.__pyx_n = 1; + __pyx_1.base = __pyx_v_base; + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_fastqQualityDecoder(__pyx_v_qualstring, 0, &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualityDecoder"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":55 + * return quality + * + * cpdef object fastqQualitySangerDecoder(char* qualstring): # <<<<<<<<<<<<<< + * return fastqQualityDecoder(qualstring,33) + * + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder(PyObject *__pyx_self, PyObject *__pyx_arg_qualstring); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder(char *__pyx_v_qualstring, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + struct __pyx_opt_args_8obitools_5fastq_6_fastq_fastqQualityDecoder __pyx_1; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("fastqQualitySangerDecoder"); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":56 + * + * cpdef object fastqQualitySangerDecoder(char* qualstring): + * return fastqQualityDecoder(qualstring,33) # <<<<<<<<<<<<<< + * + * cpdef object fastqQualitySolexaDecoder(char* qualstring): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1.__pyx_n = 1; + __pyx_1.base = 33; + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_fastqQualityDecoder(__pyx_v_qualstring, 0, &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualitySangerDecoder"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":55 + * return quality + * + * cpdef object fastqQualitySangerDecoder(char* qualstring): # <<<<<<<<<<<<<< + * return fastqQualityDecoder(qualstring,33) + * + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder(PyObject *__pyx_self, PyObject *__pyx_arg_qualstring); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder(PyObject *__pyx_self, PyObject *__pyx_arg_qualstring) { + char *__pyx_v_qualstring; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("fastqQualitySangerDecoder"); + __pyx_self = __pyx_self; + assert(__pyx_arg_qualstring); { + __pyx_v_qualstring = __Pyx_PyBytes_AsString(__pyx_arg_qualstring); if (unlikely((!__pyx_v_qualstring) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualitySangerDecoder"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder(__pyx_v_qualstring, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualitySangerDecoder"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":58 + * return fastqQualityDecoder(qualstring,33) + * + * cpdef object fastqQualitySolexaDecoder(char* qualstring): # <<<<<<<<<<<<<< + * return fastqQualityDecoder(qualstring,64) + * + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder(PyObject *__pyx_self, PyObject *__pyx_arg_qualstring); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder(char *__pyx_v_qualstring, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + struct __pyx_opt_args_8obitools_5fastq_6_fastq_fastqQualityDecoder __pyx_1; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("fastqQualitySolexaDecoder"); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":59 + * + * cpdef object fastqQualitySolexaDecoder(char* qualstring): + * return fastqQualityDecoder(qualstring,64) # <<<<<<<<<<<<<< + * + * cpdef object qualityToSolexaError(object quality): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_1.__pyx_n = 1; + __pyx_1.base = 64; + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_fastqQualityDecoder(__pyx_v_qualstring, 0, &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualitySolexaDecoder"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":58 + * return fastqQualityDecoder(qualstring,33) + * + * cpdef object fastqQualitySolexaDecoder(char* qualstring): # <<<<<<<<<<<<<< + * return fastqQualityDecoder(qualstring,64) + * + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder(PyObject *__pyx_self, PyObject *__pyx_arg_qualstring); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder(PyObject *__pyx_self, PyObject *__pyx_arg_qualstring) { + char *__pyx_v_qualstring; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("fastqQualitySolexaDecoder"); + __pyx_self = __pyx_self; + assert(__pyx_arg_qualstring); { + __pyx_v_qualstring = __Pyx_PyBytes_AsString(__pyx_arg_qualstring); if (unlikely((!__pyx_v_qualstring) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualitySolexaDecoder"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder(__pyx_v_qualstring, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.fastqQualitySolexaDecoder"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":61 + * return fastqQualityDecoder(qualstring,64) + * + * cpdef object qualityToSolexaError(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_qualityToSolexaError(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_qualityToSolexaError(PyObject *__pyx_v_quality, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_lq; + double __pyx_v_proba; + PyObject *__pyx_v_olength; + double *__pyx_v_bdouble; + PyObject *__pyx_v_oaddress; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned long __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("qualityToSolexaError"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":62 + * + * cpdef object qualityToSolexaError(object quality): + * cdef int i=0 # <<<<<<<<<<<<<< + * cdef int lq + * cdef double proba + */ + __pyx_v_i = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":69 + * cdef double* bdouble + * + * (oaddress,olength)=quality.buffer_info() # <<<<<<<<<<<<<< + * bdouble=oaddress + * lq=olength + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_quality, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":70 + * + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress # <<<<<<<<<<<<<< + * lq=olength + * + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bdouble = ((double *)((unsigned long)__pyx_t_3)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":71 + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress + * lq=olength # <<<<<<<<<<<<<< + * + * for i in range(lq): + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_olength); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_lq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":73 + * lq=olength + * + * for i in range(lq): # <<<<<<<<<<<<<< + * proba=1/(1+10.**(bdouble[i]/10.)) + * bdouble[i]=proba + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_lq; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":74 + * + * for i in range(lq): + * proba=1/(1+10.**(bdouble[i]/10.)) # <<<<<<<<<<<<<< + * bdouble[i]=proba + * + */ + __pyx_v_proba = (1 / (1 + pow(10.0, ((__pyx_v_bdouble[__pyx_v_i]) / 10.0)))); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":75 + * for i in range(lq): + * proba=1/(1+10.**(bdouble[i]/10.)) + * bdouble[i]=proba # <<<<<<<<<<<<<< + * + * return quality + */ + (__pyx_v_bdouble[__pyx_v_i]) = __pyx_v_proba; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":77 + * bdouble[i]=proba + * + * return quality # <<<<<<<<<<<<<< + * + * cpdef object qualityToSangerError(object quality): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_quality); + __pyx_r = __pyx_v_quality; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("obitools.fastq._fastq.qualityToSolexaError"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":61 + * return fastqQualityDecoder(qualstring,64) + * + * cpdef object qualityToSolexaError(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_qualityToSolexaError(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_qualityToSolexaError(PyObject *__pyx_self, PyObject *__pyx_v_quality) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("qualityToSolexaError"); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_qualityToSolexaError(__pyx_v_quality, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.qualityToSolexaError"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":79 + * return quality + * + * cpdef object qualityToSangerError(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_qualityToSangerError(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_qualityToSangerError(PyObject *__pyx_v_quality, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_lq; + double __pyx_v_proba; + PyObject *__pyx_v_olength; + double *__pyx_v_bdouble; + PyObject *__pyx_v_oaddress; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned long __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("qualityToSangerError"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":80 + * + * cpdef object qualityToSangerError(object quality): + * cdef int i=0 # <<<<<<<<<<<<<< + * cdef int lq + * cdef double proba + */ + __pyx_v_i = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":87 + * cdef double* bdouble + * + * (oaddress,olength)=quality.buffer_info() # <<<<<<<<<<<<<< + * bdouble=oaddress + * lq=olength + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_quality, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":88 + * + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress # <<<<<<<<<<<<<< + * lq=olength + * + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bdouble = ((double *)((unsigned long)__pyx_t_3)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":89 + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress + * lq=olength # <<<<<<<<<<<<<< + * + * for i in range(lq): + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_olength); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_lq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":91 + * lq=olength + * + * for i in range(lq): # <<<<<<<<<<<<<< + * proba=10.**(-bdouble[i]/10.) + * bdouble[i]=proba + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_lq; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":92 + * + * for i in range(lq): + * proba=10.**(-bdouble[i]/10.) # <<<<<<<<<<<<<< + * bdouble[i]=proba + * + */ + __pyx_v_proba = pow(10.0, ((-(__pyx_v_bdouble[__pyx_v_i])) / 10.0)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":93 + * for i in range(lq): + * proba=10.**(-bdouble[i]/10.) + * bdouble[i]=proba # <<<<<<<<<<<<<< + * + * return quality + */ + (__pyx_v_bdouble[__pyx_v_i]) = __pyx_v_proba; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":95 + * bdouble[i]=proba + * + * return quality # <<<<<<<<<<<<<< + * + * cpdef object errorToSangerQuality(object quality): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_quality); + __pyx_r = __pyx_v_quality; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("obitools.fastq._fastq.qualityToSangerError"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":79 + * return quality + * + * cpdef object qualityToSangerError(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_qualityToSangerError(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_qualityToSangerError(PyObject *__pyx_self, PyObject *__pyx_v_quality) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("qualityToSangerError"); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_qualityToSangerError(__pyx_v_quality, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.qualityToSangerError"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":97 + * return quality + * + * cpdef object errorToSangerQuality(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerQuality(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_errorToSangerQuality(PyObject *__pyx_v_quality, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_lq; + double __pyx_v_proba; + PyObject *__pyx_v_olength; + double *__pyx_v_bdouble; + PyObject *__pyx_v_oaddress; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned long __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("errorToSangerQuality"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":98 + * + * cpdef object errorToSangerQuality(object quality): + * cdef int i=0 # <<<<<<<<<<<<<< + * cdef int lq + * cdef double proba + */ + __pyx_v_i = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":105 + * cdef double* bdouble + * + * (oaddress,olength)=quality.buffer_info() # <<<<<<<<<<<<<< + * bdouble=oaddress + * lq=olength + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_quality, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":106 + * + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress # <<<<<<<<<<<<<< + * lq=olength + * + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bdouble = ((double *)((unsigned long)__pyx_t_3)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":107 + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress + * lq=olength # <<<<<<<<<<<<<< + * + * for i in range(lq): + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_olength); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_lq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":109 + * lq=olength + * + * for i in range(lq): # <<<<<<<<<<<<<< + * proba=-rint(log10(bdouble[i])*10) + * bdouble[i]=proba + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_lq; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":110 + * + * for i in range(lq): + * proba=-rint(log10(bdouble[i])*10) # <<<<<<<<<<<<<< + * bdouble[i]=proba + * + */ + __pyx_v_proba = (-rint((log10((__pyx_v_bdouble[__pyx_v_i])) * 10))); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":111 + * for i in range(lq): + * proba=-rint(log10(bdouble[i])*10) + * bdouble[i]=proba # <<<<<<<<<<<<<< + * + * return quality + */ + (__pyx_v_bdouble[__pyx_v_i]) = __pyx_v_proba; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":113 + * bdouble[i]=proba + * + * return quality # <<<<<<<<<<<<<< + * + * cpdef object solexaToSangerQuality(object quality): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_quality); + __pyx_r = __pyx_v_quality; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("obitools.fastq._fastq.errorToSangerQuality"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":97 + * return quality + * + * cpdef object errorToSangerQuality(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerQuality(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerQuality(PyObject *__pyx_self, PyObject *__pyx_v_quality) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("errorToSangerQuality"); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_errorToSangerQuality(__pyx_v_quality, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.errorToSangerQuality"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":115 + * return quality + * + * cpdef object solexaToSangerQuality(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_solexaToSangerQuality(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_solexaToSangerQuality(PyObject *__pyx_v_quality, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_lq; + double __pyx_v_proba; + PyObject *__pyx_v_olength; + double *__pyx_v_bdouble; + PyObject *__pyx_v_oaddress; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned long __pyx_t_3; + int __pyx_t_4; + __Pyx_SetupRefcountContext("solexaToSangerQuality"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":116 + * + * cpdef object solexaToSangerQuality(object quality): + * cdef int i=0 # <<<<<<<<<<<<<< + * cdef int lq + * cdef double proba + */ + __pyx_v_i = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":123 + * cdef double* bdouble + * + * (oaddress,olength)=quality.buffer_info() # <<<<<<<<<<<<<< + * bdouble=oaddress + * lq=olength + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_quality, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":124 + * + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress # <<<<<<<<<<<<<< + * lq=olength + * + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bdouble = ((double *)((unsigned long)__pyx_t_3)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":125 + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress + * lq=olength # <<<<<<<<<<<<<< + * + * for i in range(lq): + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_olength); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_lq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":127 + * lq=olength + * + * for i in range(lq): # <<<<<<<<<<<<<< + * proba=-rint(log10(1/(1+10.**(bdouble[i]/10.)))*10) + * bdouble[i]=proba + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_lq; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":128 + * + * for i in range(lq): + * proba=-rint(log10(1/(1+10.**(bdouble[i]/10.)))*10) # <<<<<<<<<<<<<< + * bdouble[i]=proba + * + */ + __pyx_v_proba = (-rint((log10((1 / (1 + pow(10.0, ((__pyx_v_bdouble[__pyx_v_i]) / 10.0))))) * 10))); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":129 + * for i in range(lq): + * proba=-rint(log10(1/(1+10.**(bdouble[i]/10.)))*10) + * bdouble[i]=proba # <<<<<<<<<<<<<< + * + * return quality + */ + (__pyx_v_bdouble[__pyx_v_i]) = __pyx_v_proba; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":131 + * bdouble[i]=proba + * + * return quality # <<<<<<<<<<<<<< + * + * cpdef object errorToSangerFastQStr(object quality): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_quality); + __pyx_r = __pyx_v_quality; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("obitools.fastq._fastq.solexaToSangerQuality"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":115 + * return quality + * + * cpdef object solexaToSangerQuality(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_solexaToSangerQuality(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_solexaToSangerQuality(PyObject *__pyx_self, PyObject *__pyx_v_quality) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("solexaToSangerQuality"); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_solexaToSangerQuality(__pyx_v_quality, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.solexaToSangerQuality"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":133 + * return quality + * + * cpdef object errorToSangerFastQStr(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerFastQStr(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_f_8obitools_5fastq_6_fastq_errorToSangerFastQStr(PyObject *__pyx_v_quality, int __pyx_skip_dispatch) { + int __pyx_v_i; + int __pyx_v_lq; + double __pyx_v_proba; + PyObject *__pyx_v_olength; + double *__pyx_v_bdouble; + char *__pyx_v_result; + PyObject *__pyx_v_code; + PyObject *__pyx_v_oaddress; + PyObject *__pyx_r = NULL; + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_3 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned long __pyx_t_3; + int __pyx_t_4; + void *__pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + __Pyx_SetupRefcountContext("errorToSangerFastQStr"); + __pyx_v_olength = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_code = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_oaddress = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":134 + * + * cpdef object errorToSangerFastQStr(object quality): + * cdef int i=0 # <<<<<<<<<<<<<< + * cdef int lq + * cdef double proba + */ + __pyx_v_i = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":143 + * cdef str code + * + * (oaddress,olength)=quality.buffer_info() # <<<<<<<<<<<<<< + * bdouble=oaddress + * lq=olength + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_quality, __pyx_kp_buffer_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); + __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } else { + __pyx_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_oaddress); + __pyx_v_oaddress = __pyx_2; + __pyx_2 = 0; + __Pyx_DECREF(__pyx_v_olength); + __pyx_v_olength = __pyx_3; + __pyx_3 = 0; + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":144 + * + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress # <<<<<<<<<<<<<< + * lq=olength + * result=malloc(olength+1) + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_oaddress); if (unlikely((__pyx_t_3 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bdouble = ((double *)((unsigned long)__pyx_t_3)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":145 + * (oaddress,olength)=quality.buffer_info() + * bdouble=oaddress + * lq=olength # <<<<<<<<<<<<<< + * result=malloc(olength+1) + * result[olength]=0 + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_olength); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_lq = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":146 + * bdouble=oaddress + * lq=olength + * result=malloc(olength+1) # <<<<<<<<<<<<<< + * result[olength]=0 + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_olength, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = malloc(__pyx_t_4); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = ((char *)__pyx_t_5); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":147 + * lq=olength + * result=malloc(olength+1) + * result[olength]=0 # <<<<<<<<<<<<<< + * + * for i in range(lq): + */ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_olength); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_result[__pyx_t_6]) = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":149 + * result[olength]=0 + * + * for i in range(lq): # <<<<<<<<<<<<<< + * proba=-rint(log10(bdouble[i])*10) + * if proba > 93.: + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_lq; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":150 + * + * for i in range(lq): + * proba=-rint(log10(bdouble[i])*10) # <<<<<<<<<<<<<< + * if proba > 93.: + * proba=93. + */ + __pyx_v_proba = (-rint((log10((__pyx_v_bdouble[__pyx_v_i])) * 10))); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":151 + * for i in range(lq): + * proba=-rint(log10(bdouble[i])*10) + * if proba > 93.: # <<<<<<<<<<<<<< + * proba=93. + * result[i]=33 + proba + */ + __pyx_t_7 = (__pyx_v_proba > 93.0); + if (__pyx_t_7) { + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":152 + * proba=-rint(log10(bdouble[i])*10) + * if proba > 93.: + * proba=93. # <<<<<<<<<<<<<< + * result[i]=33 + proba + * code=result + */ + __pyx_v_proba = 93.0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":153 + * if proba > 93.: + * proba=93. + * result[i]=33 + proba # <<<<<<<<<<<<<< + * code=result + * free(result) + */ + (__pyx_v_result[__pyx_v_i]) = (33 + ((int)__pyx_v_proba)); + } + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":154 + * proba=93. + * result[i]=33 + proba + * code=result # <<<<<<<<<<<<<< + * free(result) + * return code + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyString_CheckExact(__pyx_t_2)) || (__pyx_t_2) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected str, got %s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_code)); + __pyx_v_code = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":155 + * result[i]=33 + proba + * code=result + * free(result) # <<<<<<<<<<<<<< + * return code + */ + free(((void *)__pyx_v_result)); + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":156 + * code=result + * free(result) + * return code # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_code)); + __pyx_r = ((PyObject *)__pyx_v_code); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("obitools.fastq._fastq.errorToSangerFastQStr"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_olength); + __Pyx_DECREF(__pyx_v_code); + __Pyx_DECREF(__pyx_v_oaddress); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":133 + * return quality + * + * cpdef object errorToSangerFastQStr(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerFastQStr(PyObject *__pyx_self, PyObject *__pyx_v_quality); /*proto*/ +static PyObject *__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerFastQStr(PyObject *__pyx_self, PyObject *__pyx_v_quality) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_SetupRefcountContext("errorToSangerFastQStr"); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_8obitools_5fastq_6_fastq_errorToSangerFastQStr(__pyx_v_quality, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("obitools.fastq._fastq.errorToSangerFastQStr"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); + return __pyx_r; +} + +static struct PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("fastqQualityDecoder"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_fastqQualityDecoder, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fastqQualitySangerDecoder"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySangerDecoder, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fastqQualitySolexaDecoder"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_fastqQualitySolexaDecoder, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("qualityToSolexaError"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_qualityToSolexaError, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("qualityToSangerError"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_qualityToSangerError, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("errorToSangerQuality"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerQuality, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("solexaToSangerQuality"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_solexaToSangerQuality, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("errorToSangerFastQStr"), (PyCFunction)__pyx_pf_8obitools_5fastq_6_fastq_errorToSangerFastQStr, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static void __pyx_init_filenames(void); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_fastq"), + __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp_fastqQualityDecoder, __pyx_k_fastqQualityDecoder, sizeof(__pyx_k_fastqQualityDecoder), 1, 1, 1}, + {&__pyx_kp_20, __pyx_k_20, sizeof(__pyx_k_20), 1, 1, 1}, + {&__pyx_kp_21, __pyx_k_21, sizeof(__pyx_k_21), 1, 1, 1}, + {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 1, 1, 1}, + {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 1, 1}, + {&__pyx_kp_24, __pyx_k_24, sizeof(__pyx_k_24), 1, 1, 1}, + {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 1, 1, 1}, + {&__pyx_kp_26, __pyx_k_26, sizeof(__pyx_k_26), 1, 1, 1}, + {&__pyx_kp_qualstring, __pyx_k_qualstring, sizeof(__pyx_k_qualstring), 1, 1, 1}, + {&__pyx_kp_base, __pyx_k_base, sizeof(__pyx_k_base), 1, 1, 1}, + {&__pyx_kp_quality, __pyx_k_quality, sizeof(__pyx_k_quality), 1, 1, 1}, + {&__pyx_kp_array, __pyx_k_array, sizeof(__pyx_k_array), 1, 1, 1}, + {&__pyx_kp_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0}, + {&__pyx_kp_buffer_info, __pyx_k_buffer_info, sizeof(__pyx_k_buffer_info), 1, 1, 1}, + {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, + {0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_fastq(void); /*proto*/ +PyMODINIT_FUNC init_fastq(void) +#else +PyMODINIT_FUNC PyInit__fastq(void); /*proto*/ +PyMODINIT_FUNC PyInit__fastq(void) +#endif +{ + PyObject *__pyx_1 = 0; + PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit__fastq(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_fastq"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__pyx_module_is_main_obitools__fastq___fastq) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_skip_dispatch = 0; + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":7 + * ''' + * + * from array import array # <<<<<<<<<<<<<< + * + * cdef import from "math.h" : + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_kp_array); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_array); + __Pyx_GIVEREF(__pyx_kp_array); + __pyx_1 = __Pyx_Import(__pyx_kp_array, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_array); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + if (PyObject_SetAttr(__pyx_m, __pyx_kp_array, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/Users/coissac/encours/OBITools/src/obitools/fastq/_fastq.pyx":133 + * return quality + * + * cpdef object errorToSangerFastQStr(object quality): # <<<<<<<<<<<<<< + * cdef int i=0 + * cdef int lq + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init obitools.fastq._fastq"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init obitools.fastq._fastq"); + } + __pyx_L0:; + __Pyx_FinishRefcountContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +static const char *__pyx_filenames[] = { + "_fastq.pyx", +}; + +/* Runtime support code */ + +static void __pyx_init_filenames(void) { + __pyx_f = __pyx_filenames; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *__import__ = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!__import__) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(__import__); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((char)-1) > ((char)0) && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((short)-1) > ((short)0) && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((int)-1) > ((int)0) && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((long)-1) > ((long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode && (!t->is_identifier)) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_identifier || (t->is_unicode && t->intern)) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->is_unicode) { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/src/obitools/fastq/_fastq.pyx b/src/obitools/fastq/_fastq.pyx new file mode 100644 index 0000000..98148c7 --- /dev/null +++ b/src/obitools/fastq/_fastq.pyx @@ -0,0 +1,156 @@ +''' +Created on 16 sept. 2009 + +@author: coissac +''' + +from array import array + +cdef import from "math.h" : + double log10(double x) + double rint(double x) + +cdef import from "string.h": + int strlen(char* s) + +cdef import from "stdlib.h": + void* malloc(int size) except NULL + void* realloc(void* chunk,int size) except NULL + void free(void* chunk) + +cdef import from "string.h": + void bzero(void *s, size_t n) + + + +cpdef object fastqQualityDecoder(char* qualstring, int base=0): + cdef int i=0 + cdef int mq=255 + cdef object quality + cdef object oaddresse,olength + cdef int length + cdef double* bdouble + + quality = array('d',[0] * strlen(qualstring)) + (oaddress,olength)=quality.buffer_info() + bdouble=oaddress + + if base==0: + mq = 255 + while (qualstring[i]!=0): + if qualstring[i]oaddress + lq=olength + + for i in range(lq): + proba=1/(1+10.**(bdouble[i]/10.)) + bdouble[i]=proba + + return quality + +cpdef object qualityToSangerError(object quality): + cdef int i=0 + cdef int lq + cdef double proba + cdef object oaddresse,olength + cdef int length + cdef double* bdouble + + (oaddress,olength)=quality.buffer_info() + bdouble=oaddress + lq=olength + + for i in range(lq): + proba=10.**(-bdouble[i]/10.) + bdouble[i]=proba + + return quality + +cpdef object errorToSangerQuality(object quality): + cdef int i=0 + cdef int lq + cdef double proba + cdef object oaddresse,olength + cdef int length + cdef double* bdouble + + (oaddress,olength)=quality.buffer_info() + bdouble=oaddress + lq=olength + + for i in range(lq): + proba=-rint(log10(bdouble[i])*10) + bdouble[i]=proba + + return quality + +cpdef object solexaToSangerQuality(object quality): + cdef int i=0 + cdef int lq + cdef double proba + cdef object oaddresse,olength + cdef int length + cdef double* bdouble + + (oaddress,olength)=quality.buffer_info() + bdouble=oaddress + lq=olength + + for i in range(lq): + proba=-rint(log10(1/(1+10.**(bdouble[i]/10.)))*10) + bdouble[i]=proba + + return quality + +cpdef object errorToSangerFastQStr(object quality): + cdef int i=0 + cdef int lq + cdef double proba + cdef object oaddresse,olength + cdef int length + cdef double* bdouble + cdef char* result + cdef str code + + (oaddress,olength)=quality.buffer_info() + bdouble=oaddress + lq=olength + result=malloc(olength+1) + result[olength]=0 + + for i in range(lq): + proba=-rint(log10(bdouble[i])*10) + if proba > 93.: + proba=93. + result[i]=33 + proba + code=result + free(result) + return code diff --git a/src/obitools/format/genericparser/__init__.py b/src/obitools/format/genericparser/__init__.py index 8946897..3fb31ab 100644 --- a/src/obitools/format/genericparser/__init__.py +++ b/src/obitools/format/genericparser/__init__.py @@ -5,7 +5,7 @@ import re from obitools.utils import universalOpen -def genericEntryIteratorGenerator(startEntry=None,endEntry=None,head=False,tail=False,strip=False): +def genericEntryIteratorGenerator(startEntry=None,endEntry=None,head=False,tail=False,strip=False,join=True): ''' Transfome a text line iterator to an entry oriented iterator. @@ -62,10 +62,15 @@ def genericEntryIteratorGenerator(startEntry=None,endEntry=None,head=False,tail= if end: if endEntry is not None: entry.append(line) - e = ''.join(entry) + if join: + e = ''.join(entry) + if strip: + e=e.strip() + else: + e=entry + if strip: + e=[x.strip() for x in e] entry=[] - if strip: - e=e.strip() yield e started=False if endEntry is not None: @@ -78,9 +83,14 @@ def genericEntryIteratorGenerator(startEntry=None,endEntry=None,head=False,tail= except StopIteration: if entry and (endEntry is None or tail): - e = ''.join(entry) - if strip: - e=e.strip() + if join: + e = ''.join(entry) + if strip: + e=e.strip() + else: + e=entry + if strip: + e=[x.strip() for x in e] yield e diff --git a/src/obitools/location/__init__.py b/src/obitools/location/__init__.py index 816663c..e9fe11d 100644 --- a/src/obitools/location/__init__.py +++ b/src/obitools/location/__init__.py @@ -135,6 +135,8 @@ class SimpleLocation(Location): self._begin = begin self._end = end + self._before=False + self._after=False def _extractSequence(self,sequence): @@ -191,6 +193,26 @@ class SimpleLocation(Location): begin = property(getBegin,None,None,"beginning position of the location") end = property(getEnd,None,None,"ending position of the location") + def getBefore(self): + return self._before + + def getAfter(self): + return self._after + + def setBefore(self,value): + assert isinstance(value, bool) + self._before=value + + def setAfter(self,value): + assert isinstance(value, bool) + self._after=value + + before=property(getBefore,setBefore,None) + after=property(getAfter,setAfter,None) + + + + class PointLocation(Location): """ A point location describes a location on a sequence diff --git a/src/obitools/word/_binary.c b/src/obitools/word/_binary.c index 24ee8a9..ed9f3a6 100644 --- a/src/obitools/word/_binary.c +++ b/src/obitools/word/_binary.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Fri Dec 18 14:54:07 2009 */ +/* Generated by Cython 0.11.3 on Mon Jan 4 22:18:11 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -427,10 +427,10 @@ static char __pyx_k_t[] = "t"; static PyObject *__pyx_kp_t; static char __pyx_k_size[] = "size"; static PyObject *__pyx_kp_size; -static char __pyx_k_1[] = "w1"; -static PyObject *__pyx_kp_1; -static char __pyx_k_2[] = "w2"; -static PyObject *__pyx_kp_2; +static char __pyx_k_28[] = "w1"; +static PyObject *__pyx_kp_28; +static char __pyx_k_29[] = "w2"; +static PyObject *__pyx_kp_29; static char __pyx_k_word[] = "word"; static PyObject *__pyx_kp_word; static char __pyx_k_pattern[] = "pattern"; @@ -441,39 +441,39 @@ static char __pyx_k_xrange[] = "xrange"; static PyObject *__pyx_kp_xrange; static char __pyx_k_join[] = "join"; static PyObject *__pyx_kp_join; -static char __pyx_k_5[] = "acgt"; -static PyObject *__pyx_kp_5; +static char __pyx_k_32[] = "acgt"; +static PyObject *__pyx_kp_32; static char __pyx_k_lower[] = "lower"; static PyObject *__pyx_kp_lower; -static char __pyx_k_7[] = "c"; -static PyObject *__pyx_kp_7; -static char __pyx_k_8[] = "g"; -static PyObject *__pyx_kp_8; -static char __pyx_k_9[] = "t"; -static PyObject *__pyx_kp_9; -static char __pyx_k_10[] = "a"; -static PyObject *__pyx_kp_10; +static char __pyx_k_34[] = "c"; +static PyObject *__pyx_kp_34; +static char __pyx_k_35[] = "g"; +static PyObject *__pyx_kp_35; +static char __pyx_k_36[] = "t"; +static PyObject *__pyx_kp_36; +static char __pyx_k_37[] = "a"; +static PyObject *__pyx_kp_37; static char __pyx_k_RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_RuntimeError; -static char __pyx_k_12[] = "armwdhvn"; -static PyObject *__pyx_kp_12; -static char __pyx_k_13[] = "cymsbhvn"; -static PyObject *__pyx_kp_13; -static char __pyx_k_14[] = "grksbdvn"; -static PyObject *__pyx_kp_14; -static char __pyx_k_15[] = "tykwbdhn"; -static PyObject *__pyx_kp_15; +static char __pyx_k_39[] = "armwdhvn"; +static PyObject *__pyx_kp_39; +static char __pyx_k_40[] = "cymsbhvn"; +static PyObject *__pyx_kp_40; +static char __pyx_k_41[] = "grksbdvn"; +static PyObject *__pyx_kp_41; +static char __pyx_k_42[] = "tykwbdhn"; +static PyObject *__pyx_kp_42; static PyObject *__pyx_builtin_bin; static PyObject *__pyx_builtin_xrange; static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_kp_3; -static char __pyx_k_3[] = "(a:%s,c:%s,g:%s,t:%s)"; -static PyObject *__pyx_kp_4; -static char __pyx_k_4[] = ""; -static PyObject *__pyx_kp_6; -static PyObject *__pyx_kp_11; -static char __pyx_k_6[] = "Word length should be less or equal to 32"; -static char __pyx_k_11[] = "word should only contain a, c, g or t (%s)"; +static PyObject *__pyx_kp_30; +static char __pyx_k_30[] = "(a:%s,c:%s,g:%s,t:%s)"; +static PyObject *__pyx_kp_31; +static char __pyx_k_31[] = ""; +static PyObject *__pyx_kp_33; +static PyObject *__pyx_kp_38; +static char __pyx_k_33[] = "Word length should be less or equal to 32"; +static char __pyx_k_38[] = "word should only contain a, c, g or t (%s)"; /* "/Users/coissac/encours/OBITools/src/obitools/word/_binary.pyx":15 * @@ -695,7 +695,7 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern___str__(PyObjec __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(__pyx_kp_3, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; @@ -926,7 +926,7 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_wordDist(PyObject *__pyx_self unsigned PY_LONG_LONG __pyx_v_w2; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_1,&__pyx_kp_2,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_28,&__pyx_kp_29,0}; __Pyx_SetupRefcountContext("wordDist"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { @@ -940,11 +940,11 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_wordDist(PyObject *__pyx_self } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_1); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_28); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_2); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_29); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("wordDist", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -2032,7 +2032,7 @@ static PyObject *__pyx_f_8obitools_4word_7_binary_decodeWord(unsigned PY_LONG_L * cpdef int encodeWord(word) except -1: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(__pyx_kp_4, __pyx_kp_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_kp_31, __pyx_kp_join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); @@ -2085,7 +2085,7 @@ static PyObject *__pyx_f_8obitools_4word_7_binary_decodeWord(unsigned PY_LONG_L __pyx_t_4 = PyNumber_And(__pyx_t_6, __pyx_int_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_1 = PyObject_GetItem(__pyx_kp_5, __pyx_t_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_1 = PyObject_GetItem(__pyx_kp_32, __pyx_t_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_1); if (unlikely(__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2234,7 +2234,7 @@ static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, #ifndef PYREX_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!(__pyx_t_1 <= 32))) { - PyErr_SetObject(PyExc_AssertionError, __pyx_kp_6); + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_33); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif @@ -2318,7 +2318,7 @@ static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, * w|=1 * elif l=='g': */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_7, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_34, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -2346,7 +2346,7 @@ static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, * w|=2 * elif l=='t': */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_8, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_35, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -2374,7 +2374,7 @@ static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, * w|=3 * elif l!='a': */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_9, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_36, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -2402,7 +2402,7 @@ static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, * raise RuntimeError,"word should only contain a, c, g or t (%s)" % word * return w */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_10, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_l, __pyx_kp_37, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -2415,7 +2415,7 @@ static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, * return w * */ - __pyx_t_2 = PyNumber_Remainder(__pyx_kp_11, __pyx_v_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(__pyx_kp_38, __pyx_v_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_builtin_RuntimeError, __pyx_t_2, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -2669,7 +2669,7 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_encodePattern(PyObject *__pyx * a|=1 * if l in 'cymsbhvn': */ - __pyx_t_4 = (PySequence_Contains(__pyx_kp_12, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (PySequence_Contains(__pyx_kp_39, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { /* "/Users/coissac/encours/OBITools/src/obitools/word/_binary.pyx":177 @@ -2695,7 +2695,7 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_encodePattern(PyObject *__pyx * c|=1 * if l in 'grksbdvn': */ - __pyx_t_4 = (PySequence_Contains(__pyx_kp_13, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (PySequence_Contains(__pyx_kp_40, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { /* "/Users/coissac/encours/OBITools/src/obitools/word/_binary.pyx":179 @@ -2721,7 +2721,7 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_encodePattern(PyObject *__pyx * g|=1 * if l in 'tykwbdhn': */ - __pyx_t_4 = (PySequence_Contains(__pyx_kp_14, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (PySequence_Contains(__pyx_kp_41, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { /* "/Users/coissac/encours/OBITools/src/obitools/word/_binary.pyx":181 @@ -2747,7 +2747,7 @@ static PyObject *__pyx_pf_8obitools_4word_7_binary_encodePattern(PyObject *__pyx * t|=1 * */ - __pyx_t_4 = (PySequence_Contains(__pyx_kp_15, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (PySequence_Contains(__pyx_kp_42, __pyx_v_l)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { /* "/Users/coissac/encours/OBITools/src/obitools/word/_binary.pyx":183 @@ -3349,28 +3349,28 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_g, __pyx_k_g, sizeof(__pyx_k_g), 1, 1, 1}, {&__pyx_kp_t, __pyx_k_t, sizeof(__pyx_k_t), 1, 1, 1}, {&__pyx_kp_size, __pyx_k_size, sizeof(__pyx_k_size), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 1, 1, 1}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 1, 1, 1}, + {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 1, 1, 1}, + {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 1, 1, 1}, {&__pyx_kp_word, __pyx_k_word, sizeof(__pyx_k_word), 1, 1, 1}, {&__pyx_kp_pattern, __pyx_k_pattern, sizeof(__pyx_k_pattern), 1, 1, 1}, {&__pyx_kp_bin, __pyx_k_bin, sizeof(__pyx_k_bin), 1, 1, 1}, {&__pyx_kp_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 1, 1, 1}, {&__pyx_kp_join, __pyx_k_join, sizeof(__pyx_k_join), 1, 1, 1}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0}, + {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0}, {&__pyx_kp_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 1, 1, 1}, - {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0}, - {&__pyx_kp_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0}, - {&__pyx_kp_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0}, - {&__pyx_kp_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0}, + {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0}, + {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0}, + {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0}, + {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0}, {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0}, - {&__pyx_kp_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0}, - {&__pyx_kp_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0}, - {&__pyx_kp_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0}, - {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0}, - {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0}, - {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0}, - {&__pyx_kp_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 0}, + {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0}, + {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0}, + {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 1, 0}, + {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0}, + {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0}, + {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 0}, + {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 0}, + {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 0}, {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { diff --git a/src/solexaPairEnd.py b/src/solexaPairEnd.py new file mode 100644 index 0000000..8135521 --- /dev/null +++ b/src/solexaPairEnd.py @@ -0,0 +1,264 @@ +#!/usr/local/bin/python +''' +Created on 30 dec. 2009 + +@author: coissac +''' + +from obitools.options import getOptionManager +from obitools.fastq import fastqSolexaIterator, formatFastq +from obitools.alignment import columnIterator +from obitools.align import QSolexaReverseAssemble +from obitools.align import QSolexaRightReverseAssemble +from array import array +from obitools import NucSequence +import sys + +def addSolexaPairEndOptions(optionManager): + optionManager.add_option('-r','--reverse-reads', + action="store", dest="reverse", + metavar="", + type="string", + default=None, + help="Filename containing reverse solexa reads " + ) + + + +def checkAlignOk(ali): + #print not (ali[0][0]=='-' or ali[1][len(ali[1])-1]=='-') + return not (ali[0][0]=='-' or ali[1][len(ali[1])-1]=='-') + + +def iterOnAligment(ali): + pos0=0 + pos1=len(ali[1].wrapped)-1 + begin0=False + end0=False + begin1=False + end1=False + for nuc0,nuc1 in columnIterator(ali): + if nuc0=='-': + if begin0: + if not end0: + score0 = ( ali[0].wrapped.quality[pos0-1] + +ali[0].wrapped.quality[pos0] + )/2 + else: + score0 = 1. + else: + score0 = 0. + else: + begin0=True + score0 = ali[0].wrapped.quality[pos0] + pos0+=1 + end0= pos0==len(ali[0].wrapped) + + if nuc1=='-': + if begin1: + if not end1: + score1 = ( ali[1].wrapped.wrapped.quality[pos1] + +ali[1].wrapped.wrapped.quality[pos1+1] + )/2 + else: + score1 = 0. + else: + score1 = 1. + else: + begin1=True + score1 = ali[1].wrapped.wrapped.quality[pos1] + pos1-=1 + end1=pos1<0 + + result = (nuc0,score0,nuc1,score1) + yield result + + +class IterOnConsensus: + def __init__(self,ali): + self._ali=ali + self.__seqASingle=0 + self.__seqBSingle=0 + self.__seqABMatch=0 + self.__seqAMismatch=0 + self.__seqBMismatch=0 + self.__seqAInsertion=0 + self.__seqBInsertion=0 + self.__seqADeletion=0 + self.__seqBDeletion=0 + + def get_seqASingle(self): + return self.__seqASingle + + + def get_seqBSingle(self): + return self.__seqBSingle + + + def get_seqABMatch(self): + return self.__seqABMatch + + + def get_seqAMismatch(self): + return self.__seqAMismatch + + + def get_seqBMismatch(self): + return self.__seqBMismatch + + + def get_seqAInsertion(self): + return self.__seqAInsertion + + + def get_seqBInsertion(self): + return self.__seqBInsertion + + + def get_seqADeletion(self): + return self.__seqADeletion + + + def get_seqBDeletion(self): + return self.__seqBDeletion + + + def __iter__(self): + firstSeqB=False + + for nuc0,score0,nuc1,score1 in iterOnAligment(ali): + if nuc0==nuc1: + if nuc1!='-': + firstSeqB=True + self.__seqABMatch+=1 + self.__seqBSingle=0 + yield (nuc0,score0*score1) + else: + h0 = score0 * (1-score1/3) + h1 = score1 * (1-score0/3) + if h0 < h1: + + if nuc0!='-': + self.__seqBSingle=0 + if nuc1=='-': + if firstSeqB: + self.__seqAInsertion+=1 + else: + self.__seqASingle+=1 + else: + firstSeqB=True + self.__seqAMismatch+=1 + yield (nuc0,h0) + else: + self.__seqADeletion+=1 + else: + if nuc1!='-': + firstSeqB=True + if nuc0=='-': + self.__seqBInsertion+=1 + self.__seqBSingle+=1 + else: + self.__seqBMismatch+=1 + self.__seqBSingle=0 + yield (nuc1,h1) + else: + self.__seqBSingle=0 + self.__seqBDeletion+=1 + + seqASingle = property(get_seqASingle, None, None, "direct's docstring") + seqBSingle = property(get_seqBSingle, None, None, "reverse's docstring") + seqABMatch = property(get_seqABMatch, None, None, "idem's docstring") + seqAMismatch = property(get_seqAMismatch, None, None, "mismatchdirect's docstring") + seqBMismatch = property(get_seqBMismatch, None, None, "mismatchreverse's docstring") + seqAInsertion = property(get_seqAInsertion, None, None, "insertdirect's docstring") + seqBInsertion = property(get_seqBInsertion, None, None, "insertreverse's docstring") + seqADeletion = property(get_seqADeletion, None, None, "deletedirect's docstring") + seqBDeletion = property(get_seqBDeletion, None, None, "deletereverse's docstring") + +def iterOnConsensus(ali): + for nuc0,score0,nuc1,score1 in iterOnAligment(ali): + if nuc0==nuc1: + if nuc1!='-': + op='m' + yield (nuc0,score0*score1) + else: + h0 = score0 * (1-score1/3) + h1 = score1 * (1-score0/3) + if h0 < h1: + + if nuc0!='-': + if nuc1=='-': + op="d" + else: + op='s' + yield (nuc0,h0) + else: + if nuc1!='-': + if nuc0=='-': + op="i" + else: + op='s' + yield (nuc1,h1) + +def buildConsensus(ali): + seq=[] + quality=array('d') + ic=IterOnConsensus(ali) + for nuc,score in ic: + seq.append(nuc) + quality.append(score) + seq=''.join(seq) + seq=NucSequence(ali[0].wrapped.id+'_CONS',seq,**ali[0].wrapped.getTags()) + seq.quality=quality + if hasattr(ali, "direction"): + seq['alignment']=ali.direction + seq['seqASingle']=ic.seqASingle + seq['seqBSingle']=ic.seqBSingle + seq['seqABMatch']=ic.seqABMatch + seq['seqAMismatch']=ic.seqAMismatch + seq['seqBMismatch']=ic.seqBMismatch + seq['seqAInsertion']=ic.seqAInsertion + seq['seqBInsertion']=ic.seqBInsertion-ic.seqBSingle + seq['seqADeletion']=ic.seqADeletion + seq['seqBDeletion']=ic.seqBDeletion + return seq + +def buildAlignment(direct,reverse): + la = QSolexaReverseAssemble() + ra = QSolexaRightReverseAssemble() + for d in direct: + r = reverse.next() + la.seqA=d + la.seqB=r + ali=la() + ali.direction='left' + if not checkAlignOk(ali): +# print >>sys.stderr,"-> bad : -------------------------" +# print >>sys.stderr,ali +# print >>sys.stderr,"----------------------------------" + ra.seqA=d + ra.seqB=r + ali=ra() + ali.direction='right' +# print >>sys.stderr,ali +# print >>sys.stderr,"----------------------------------" + yield ali + + + + +if __name__ == '__main__': + optionParser = getOptionManager([addSolexaPairEndOptions], + entryIterator=fastqSolexaIterator + ) + + (options, direct) = optionParser() + + reverse = fastqSolexaIterator(options.reverse) + + for ali in buildAlignment(direct, reverse): + consensus = buildConsensus(ali) + print formatFastq(consensus) + + +