Merge pull request #363 from taoliu/fix_test_bdgopt
[MACS.git] / MACS2 / PeakDetect.c
blobb9e569c8738dee14d92d5d3e58cc2ad4a4008453
1 /* Generated by Cython 0.29.13 */
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8 #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_13"
11 #define CYTHON_HEX_VERSION 0x001D0DF0
12 #define CYTHON_FUTURE_DIVISION 1
13 #include <stddef.h>
14 #ifndef offsetof
15 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18 #ifndef __stdcall
19 #define __stdcall
20 #endif
21 #ifndef __cdecl
22 #define __cdecl
23 #endif
24 #ifndef __fastcall
25 #define __fastcall
26 #endif
27 #endif
28 #ifndef DL_IMPORT
29 #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32 #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36 #if PY_VERSION_HEX >= 0x02070000
37 #define HAVE_LONG_LONG
38 #endif
39 #endif
40 #ifndef PY_LONG_LONG
41 #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44 #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47 #define CYTHON_COMPILING_IN_PYPY 1
48 #define CYTHON_COMPILING_IN_PYSTON 0
49 #define CYTHON_COMPILING_IN_CPYTHON 0
50 #undef CYTHON_USE_TYPE_SLOTS
51 #define CYTHON_USE_TYPE_SLOTS 0
52 #undef CYTHON_USE_PYTYPE_LOOKUP
53 #define CYTHON_USE_PYTYPE_LOOKUP 0
54 #if PY_VERSION_HEX < 0x03050000
55 #undef CYTHON_USE_ASYNC_SLOTS
56 #define CYTHON_USE_ASYNC_SLOTS 0
57 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58 #define CYTHON_USE_ASYNC_SLOTS 1
59 #endif
60 #undef CYTHON_USE_PYLIST_INTERNALS
61 #define CYTHON_USE_PYLIST_INTERNALS 0
62 #undef CYTHON_USE_UNICODE_INTERNALS
63 #define CYTHON_USE_UNICODE_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_WRITER
65 #define CYTHON_USE_UNICODE_WRITER 0
66 #undef CYTHON_USE_PYLONG_INTERNALS
67 #define CYTHON_USE_PYLONG_INTERNALS 0
68 #undef CYTHON_AVOID_BORROWED_REFS
69 #define CYTHON_AVOID_BORROWED_REFS 1
70 #undef CYTHON_ASSUME_SAFE_MACROS
71 #define CYTHON_ASSUME_SAFE_MACROS 0
72 #undef CYTHON_UNPACK_METHODS
73 #define CYTHON_UNPACK_METHODS 0
74 #undef CYTHON_FAST_THREAD_STATE
75 #define CYTHON_FAST_THREAD_STATE 0
76 #undef CYTHON_FAST_PYCALL
77 #define CYTHON_FAST_PYCALL 0
78 #undef CYTHON_PEP489_MULTI_PHASE_INIT
79 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80 #undef CYTHON_USE_TP_FINALIZE
81 #define CYTHON_USE_TP_FINALIZE 0
82 #undef CYTHON_USE_DICT_VERSIONS
83 #define CYTHON_USE_DICT_VERSIONS 0
84 #undef CYTHON_USE_EXC_INFO_STACK
85 #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87 #define CYTHON_COMPILING_IN_PYPY 0
88 #define CYTHON_COMPILING_IN_PYSTON 1
89 #define CYTHON_COMPILING_IN_CPYTHON 0
90 #ifndef CYTHON_USE_TYPE_SLOTS
91 #define CYTHON_USE_TYPE_SLOTS 1
92 #endif
93 #undef CYTHON_USE_PYTYPE_LOOKUP
94 #define CYTHON_USE_PYTYPE_LOOKUP 0
95 #undef CYTHON_USE_ASYNC_SLOTS
96 #define CYTHON_USE_ASYNC_SLOTS 0
97 #undef CYTHON_USE_PYLIST_INTERNALS
98 #define CYTHON_USE_PYLIST_INTERNALS 0
99 #ifndef CYTHON_USE_UNICODE_INTERNALS
100 #define CYTHON_USE_UNICODE_INTERNALS 1
101 #endif
102 #undef CYTHON_USE_UNICODE_WRITER
103 #define CYTHON_USE_UNICODE_WRITER 0
104 #undef CYTHON_USE_PYLONG_INTERNALS
105 #define CYTHON_USE_PYLONG_INTERNALS 0
106 #ifndef CYTHON_AVOID_BORROWED_REFS
107 #define CYTHON_AVOID_BORROWED_REFS 0
108 #endif
109 #ifndef CYTHON_ASSUME_SAFE_MACROS
110 #define CYTHON_ASSUME_SAFE_MACROS 1
111 #endif
112 #ifndef CYTHON_UNPACK_METHODS
113 #define CYTHON_UNPACK_METHODS 1
114 #endif
115 #undef CYTHON_FAST_THREAD_STATE
116 #define CYTHON_FAST_THREAD_STATE 0
117 #undef CYTHON_FAST_PYCALL
118 #define CYTHON_FAST_PYCALL 0
119 #undef CYTHON_PEP489_MULTI_PHASE_INIT
120 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121 #undef CYTHON_USE_TP_FINALIZE
122 #define CYTHON_USE_TP_FINALIZE 0
123 #undef CYTHON_USE_DICT_VERSIONS
124 #define CYTHON_USE_DICT_VERSIONS 0
125 #undef CYTHON_USE_EXC_INFO_STACK
126 #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128 #define CYTHON_COMPILING_IN_PYPY 0
129 #define CYTHON_COMPILING_IN_PYSTON 0
130 #define CYTHON_COMPILING_IN_CPYTHON 1
131 #ifndef CYTHON_USE_TYPE_SLOTS
132 #define CYTHON_USE_TYPE_SLOTS 1
133 #endif
134 #if PY_VERSION_HEX < 0x02070000
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138 #define CYTHON_USE_PYTYPE_LOOKUP 1
139 #endif
140 #if PY_MAJOR_VERSION < 3
141 #undef CYTHON_USE_ASYNC_SLOTS
142 #define CYTHON_USE_ASYNC_SLOTS 0
143 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144 #define CYTHON_USE_ASYNC_SLOTS 1
145 #endif
146 #if PY_VERSION_HEX < 0x02070000
147 #undef CYTHON_USE_PYLONG_INTERNALS
148 #define CYTHON_USE_PYLONG_INTERNALS 0
149 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150 #define CYTHON_USE_PYLONG_INTERNALS 1
151 #endif
152 #ifndef CYTHON_USE_PYLIST_INTERNALS
153 #define CYTHON_USE_PYLIST_INTERNALS 1
154 #endif
155 #ifndef CYTHON_USE_UNICODE_INTERNALS
156 #define CYTHON_USE_UNICODE_INTERNALS 1
157 #endif
158 #if PY_VERSION_HEX < 0x030300F0
159 #undef CYTHON_USE_UNICODE_WRITER
160 #define CYTHON_USE_UNICODE_WRITER 0
161 #elif !defined(CYTHON_USE_UNICODE_WRITER)
162 #define CYTHON_USE_UNICODE_WRITER 1
163 #endif
164 #ifndef CYTHON_AVOID_BORROWED_REFS
165 #define CYTHON_AVOID_BORROWED_REFS 0
166 #endif
167 #ifndef CYTHON_ASSUME_SAFE_MACROS
168 #define CYTHON_ASSUME_SAFE_MACROS 1
169 #endif
170 #ifndef CYTHON_UNPACK_METHODS
171 #define CYTHON_UNPACK_METHODS 1
172 #endif
173 #ifndef CYTHON_FAST_THREAD_STATE
174 #define CYTHON_FAST_THREAD_STATE 1
175 #endif
176 #ifndef CYTHON_FAST_PYCALL
177 #define CYTHON_FAST_PYCALL 1
178 #endif
179 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181 #endif
182 #ifndef CYTHON_USE_TP_FINALIZE
183 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184 #endif
185 #ifndef CYTHON_USE_DICT_VERSIONS
186 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187 #endif
188 #ifndef CYTHON_USE_EXC_INFO_STACK
189 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190 #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196 #include "longintrepr.h"
197 #undef SHIFT
198 #undef BASE
199 #undef MASK
200 #ifdef SIZEOF_VOID_P
201 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202 #endif
203 #endif
204 #ifndef __has_attribute
205 #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208 #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211 #if defined(__GNUC__)
212 #define CYTHON_RESTRICT __restrict__
213 #elif defined(_MSC_VER) && _MSC_VER >= 1400
214 #define CYTHON_RESTRICT __restrict
215 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216 #define CYTHON_RESTRICT restrict
217 #else
218 #define CYTHON_RESTRICT
219 #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
225 # else
226 # define CYTHON_UNUSED
227 # endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 # define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
236 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 # else
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 # endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
244 # else
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250 #ifndef _MSC_STDINT_H_
251 #if _MSC_VER < 1300
252 typedef unsigned char uint8_t;
253 typedef unsigned int uint32_t;
254 #else
255 typedef unsigned __int8 uint8_t;
256 typedef unsigned __int32 uint32_t;
257 #endif
258 #endif
259 #else
260 #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263 #if defined(__cplusplus) && __cplusplus >= 201103L
264 #if __has_cpp_attribute(fallthrough)
265 #define CYTHON_FALLTHROUGH [[fallthrough]]
266 #elif __has_cpp_attribute(clang::fallthrough)
267 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268 #elif __has_cpp_attribute(gnu::fallthrough)
269 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270 #endif
271 #endif
272 #ifndef CYTHON_FALLTHROUGH
273 #if __has_attribute(fallthrough)
274 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275 #else
276 #define CYTHON_FALLTHROUGH
277 #endif
278 #endif
279 #if defined(__clang__ ) && defined(__apple_build_version__)
280 #if __apple_build_version__ < 7000000
281 #undef CYTHON_FALLTHROUGH
282 #define CYTHON_FALLTHROUGH
283 #endif
284 #endif
285 #endif
287 #ifndef CYTHON_INLINE
288 #if defined(__clang__)
289 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290 #elif defined(__GNUC__)
291 #define CYTHON_INLINE __inline__
292 #elif defined(_MSC_VER)
293 #define CYTHON_INLINE __inline
294 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295 #define CYTHON_INLINE inline
296 #else
297 #define CYTHON_INLINE
298 #endif
299 #endif
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302 #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310 #define __Pyx_DefaultClassType PyClass_Type
311 #else
312 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320 #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323 #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326 #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332 #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335 #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338 #ifndef METH_FASTCALL
339 #define METH_FASTCALL 0x80
340 #endif
341 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343 Py_ssize_t nargs, PyObject *kwnames);
344 #else
345 #define __Pyx_PyCFunctionFast _PyCFunctionFast
346 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355 #define PyObject_Malloc(s) PyMem_Malloc(s)
356 #define PyObject_Free(p) PyMem_Free(p)
357 #define PyObject_Realloc(p) PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
361 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
362 #define PyMem_RawFree(p) PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
366 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
369 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372 #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376 #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378 #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385 *key = PyThread_create_key();
386 return 0;
388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390 *key = Py_tss_NEEDS_INIT;
391 return key;
393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394 PyObject_Free(key);
396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397 return *key != Py_tss_NEEDS_INIT;
399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400 PyThread_delete_key(*key);
401 *key = Py_tss_NEEDS_INIT;
403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404 return PyThread_set_key_value(*key, value);
406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407 return PyThread_get_key_value(*key);
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
417 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
418 #else
419 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
420 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428 #define CYTHON_PEP393_ENABLED 1
429 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
430 0 : _PyUnicode_Ready((PyObject *)(op)))
431 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
432 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
434 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
435 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
436 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
437 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
438 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
439 #else
440 #define CYTHON_PEP393_ENABLED 0
441 #define PyUnicode_1BYTE_KIND 1
442 #define PyUnicode_2BYTE_KIND 2
443 #define PyUnicode_4BYTE_KIND 4
444 #define __Pyx_PyUnicode_READY(op) (0)
445 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
446 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
447 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
448 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
449 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
450 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
451 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
452 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
453 #endif
454 #if CYTHON_COMPILING_IN_PYPY
455 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
456 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
457 #else
458 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
459 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
460 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
461 #endif
462 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
463 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
464 #endif
465 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
466 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
469 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
470 #endif
471 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
472 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
473 #if PY_MAJOR_VERSION >= 3
474 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
475 #else
476 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
477 #endif
478 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
479 #define PyObject_ASCII(o) PyObject_Repr(o)
480 #endif
481 #if PY_MAJOR_VERSION >= 3
482 #define PyBaseString_Type PyUnicode_Type
483 #define PyStringObject PyUnicodeObject
484 #define PyString_Type PyUnicode_Type
485 #define PyString_Check PyUnicode_Check
486 #define PyString_CheckExact PyUnicode_CheckExact
487 #define PyObject_Unicode PyObject_Str
488 #endif
489 #if PY_MAJOR_VERSION >= 3
490 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
491 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
492 #else
493 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
494 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
495 #endif
496 #ifndef PySet_CheckExact
497 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
498 #endif
499 #if CYTHON_ASSUME_SAFE_MACROS
500 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
501 #else
502 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
503 #endif
504 #if PY_MAJOR_VERSION >= 3
505 #define PyIntObject PyLongObject
506 #define PyInt_Type PyLong_Type
507 #define PyInt_Check(op) PyLong_Check(op)
508 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
509 #define PyInt_FromString PyLong_FromString
510 #define PyInt_FromUnicode PyLong_FromUnicode
511 #define PyInt_FromLong PyLong_FromLong
512 #define PyInt_FromSize_t PyLong_FromSize_t
513 #define PyInt_FromSsize_t PyLong_FromSsize_t
514 #define PyInt_AsLong PyLong_AsLong
515 #define PyInt_AS_LONG PyLong_AS_LONG
516 #define PyInt_AsSsize_t PyLong_AsSsize_t
517 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
518 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
519 #define PyNumber_Int PyNumber_Long
520 #endif
521 #if PY_MAJOR_VERSION >= 3
522 #define PyBoolObject PyLongObject
523 #endif
524 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
525 #ifndef PyUnicode_InternFromString
526 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
527 #endif
528 #endif
529 #if PY_VERSION_HEX < 0x030200A4
530 typedef long Py_hash_t;
531 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
532 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
533 #else
534 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
535 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
536 #endif
537 #if PY_MAJOR_VERSION >= 3
538 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
539 #else
540 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
541 #endif
542 #if CYTHON_USE_ASYNC_SLOTS
543 #if PY_VERSION_HEX >= 0x030500B1
544 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
545 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
546 #else
547 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
548 #endif
549 #else
550 #define __Pyx_PyType_AsAsync(obj) NULL
551 #endif
552 #ifndef __Pyx_PyAsyncMethodsStruct
553 typedef struct {
554 unaryfunc am_await;
555 unaryfunc am_aiter;
556 unaryfunc am_anext;
557 } __Pyx_PyAsyncMethodsStruct;
558 #endif
560 #if defined(WIN32) || defined(MS_WINDOWS)
561 #define _USE_MATH_DEFINES
562 #endif
563 #include <math.h>
564 #ifdef NAN
565 #define __PYX_NAN() ((float) NAN)
566 #else
567 static CYTHON_INLINE float __PYX_NAN() {
568 float value;
569 memset(&value, 0xFF, sizeof(value));
570 return value;
572 #endif
573 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
574 #define __Pyx_truncl trunc
575 #else
576 #define __Pyx_truncl truncl
577 #endif
580 #define __PYX_ERR(f_index, lineno, Ln_error) \
582 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
585 #ifndef __PYX_EXTERN_C
586 #ifdef __cplusplus
587 #define __PYX_EXTERN_C extern "C"
588 #else
589 #define __PYX_EXTERN_C extern
590 #endif
591 #endif
593 #define __PYX_HAVE__MACS2__PeakDetect
594 #define __PYX_HAVE_API__MACS2__PeakDetect
595 /* Early includes */
596 #ifdef _OPENMP
597 #include <omp.h>
598 #endif /* _OPENMP */
600 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
601 #define CYTHON_WITHOUT_ASSERTIONS
602 #endif
604 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
605 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
607 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
608 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
609 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
610 #define __PYX_DEFAULT_STRING_ENCODING ""
611 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
612 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
613 #define __Pyx_uchar_cast(c) ((unsigned char)c)
614 #define __Pyx_long_cast(x) ((long)x)
615 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
616 (sizeof(type) < sizeof(Py_ssize_t)) ||\
617 (sizeof(type) > sizeof(Py_ssize_t) &&\
618 likely(v < (type)PY_SSIZE_T_MAX ||\
619 v == (type)PY_SSIZE_T_MAX) &&\
620 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
621 v == (type)PY_SSIZE_T_MIN))) ||\
622 (sizeof(type) == sizeof(Py_ssize_t) &&\
623 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
624 v == (type)PY_SSIZE_T_MAX))) )
625 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
626 return (size_t) i < (size_t) limit;
628 #if defined (__cplusplus) && __cplusplus >= 201103L
629 #include <cstdlib>
630 #define __Pyx_sst_abs(value) std::abs(value)
631 #elif SIZEOF_INT >= SIZEOF_SIZE_T
632 #define __Pyx_sst_abs(value) abs(value)
633 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
634 #define __Pyx_sst_abs(value) labs(value)
635 #elif defined (_MSC_VER)
636 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
637 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
638 #define __Pyx_sst_abs(value) llabs(value)
639 #elif defined (__GNUC__)
640 #define __Pyx_sst_abs(value) __builtin_llabs(value)
641 #else
642 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
643 #endif
644 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
645 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
646 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
647 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
648 #define __Pyx_PyBytes_FromString PyBytes_FromString
649 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
650 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
651 #if PY_MAJOR_VERSION < 3
652 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
653 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
654 #else
655 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
656 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
657 #endif
658 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
659 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
660 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
661 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
662 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
663 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
664 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
665 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
666 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
667 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
668 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
669 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
670 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
671 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
672 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
673 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
674 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
675 const Py_UNICODE *u_end = u;
676 while (*u_end++) ;
677 return (size_t)(u_end - u - 1);
679 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
680 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
681 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
682 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
683 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
684 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
685 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
686 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
687 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
688 #define __Pyx_PySequence_Tuple(obj)\
689 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
690 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
691 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
692 #if CYTHON_ASSUME_SAFE_MACROS
693 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
694 #else
695 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
696 #endif
697 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
698 #if PY_MAJOR_VERSION >= 3
699 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
700 #else
701 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
702 #endif
703 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
704 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
705 static int __Pyx_sys_getdefaultencoding_not_ascii;
706 static int __Pyx_init_sys_getdefaultencoding_params(void) {
707 PyObject* sys;
708 PyObject* default_encoding = NULL;
709 PyObject* ascii_chars_u = NULL;
710 PyObject* ascii_chars_b = NULL;
711 const char* default_encoding_c;
712 sys = PyImport_ImportModule("sys");
713 if (!sys) goto bad;
714 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
715 Py_DECREF(sys);
716 if (!default_encoding) goto bad;
717 default_encoding_c = PyBytes_AsString(default_encoding);
718 if (!default_encoding_c) goto bad;
719 if (strcmp(default_encoding_c, "ascii") == 0) {
720 __Pyx_sys_getdefaultencoding_not_ascii = 0;
721 } else {
722 char ascii_chars[128];
723 int c;
724 for (c = 0; c < 128; c++) {
725 ascii_chars[c] = c;
727 __Pyx_sys_getdefaultencoding_not_ascii = 1;
728 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
729 if (!ascii_chars_u) goto bad;
730 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
731 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
732 PyErr_Format(
733 PyExc_ValueError,
734 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
735 default_encoding_c);
736 goto bad;
738 Py_DECREF(ascii_chars_u);
739 Py_DECREF(ascii_chars_b);
741 Py_DECREF(default_encoding);
742 return 0;
743 bad:
744 Py_XDECREF(default_encoding);
745 Py_XDECREF(ascii_chars_u);
746 Py_XDECREF(ascii_chars_b);
747 return -1;
749 #endif
750 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
751 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
752 #else
753 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
754 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
755 static char* __PYX_DEFAULT_STRING_ENCODING;
756 static int __Pyx_init_sys_getdefaultencoding_params(void) {
757 PyObject* sys;
758 PyObject* default_encoding = NULL;
759 char* default_encoding_c;
760 sys = PyImport_ImportModule("sys");
761 if (!sys) goto bad;
762 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
763 Py_DECREF(sys);
764 if (!default_encoding) goto bad;
765 default_encoding_c = PyBytes_AsString(default_encoding);
766 if (!default_encoding_c) goto bad;
767 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
768 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
769 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
770 Py_DECREF(default_encoding);
771 return 0;
772 bad:
773 Py_XDECREF(default_encoding);
774 return -1;
776 #endif
777 #endif
780 /* Test for GCC > 2.95 */
781 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
782 #define likely(x) __builtin_expect(!!(x), 1)
783 #define unlikely(x) __builtin_expect(!!(x), 0)
784 #else /* !__GNUC__ or GCC < 2.95 */
785 #define likely(x) (x)
786 #define unlikely(x) (x)
787 #endif /* __GNUC__ */
788 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
790 static PyObject *__pyx_m = NULL;
791 static PyObject *__pyx_d;
792 static PyObject *__pyx_b;
793 static PyObject *__pyx_cython_runtime = NULL;
794 static PyObject *__pyx_empty_tuple;
795 static PyObject *__pyx_empty_bytes;
796 static PyObject *__pyx_empty_unicode;
797 static int __pyx_lineno;
798 static int __pyx_clineno = 0;
799 static const char * __pyx_cfilenm= __FILE__;
800 static const char *__pyx_filename;
803 static const char *__pyx_f[] = {
804 "MACS2/PeakDetect.pyx",
807 /*--- Type declarations ---*/
809 /* --- Runtime support code (head) --- */
810 /* Refnanny.proto */
811 #ifndef CYTHON_REFNANNY
812 #define CYTHON_REFNANNY 0
813 #endif
814 #if CYTHON_REFNANNY
815 typedef struct {
816 void (*INCREF)(void*, PyObject*, int);
817 void (*DECREF)(void*, PyObject*, int);
818 void (*GOTREF)(void*, PyObject*, int);
819 void (*GIVEREF)(void*, PyObject*, int);
820 void* (*SetupContext)(const char*, int, const char*);
821 void (*FinishContext)(void**);
822 } __Pyx_RefNannyAPIStruct;
823 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
824 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
825 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
826 #ifdef WITH_THREAD
827 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
828 if (acquire_gil) {\
829 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
830 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
831 PyGILState_Release(__pyx_gilstate_save);\
832 } else {\
833 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
835 #else
836 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
837 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
838 #endif
839 #define __Pyx_RefNannyFinishContext()\
840 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
841 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
842 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
843 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
844 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
845 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
846 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
847 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
848 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
849 #else
850 #define __Pyx_RefNannyDeclarations
851 #define __Pyx_RefNannySetupContext(name, acquire_gil)
852 #define __Pyx_RefNannyFinishContext()
853 #define __Pyx_INCREF(r) Py_INCREF(r)
854 #define __Pyx_DECREF(r) Py_DECREF(r)
855 #define __Pyx_GOTREF(r)
856 #define __Pyx_GIVEREF(r)
857 #define __Pyx_XINCREF(r) Py_XINCREF(r)
858 #define __Pyx_XDECREF(r) Py_XDECREF(r)
859 #define __Pyx_XGOTREF(r)
860 #define __Pyx_XGIVEREF(r)
861 #endif
862 #define __Pyx_XDECREF_SET(r, v) do {\
863 PyObject *tmp = (PyObject *) r;\
864 r = v; __Pyx_XDECREF(tmp);\
865 } while (0)
866 #define __Pyx_DECREF_SET(r, v) do {\
867 PyObject *tmp = (PyObject *) r;\
868 r = v; __Pyx_DECREF(tmp);\
869 } while (0)
870 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
871 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
873 /* PyObjectGetAttrStr.proto */
874 #if CYTHON_USE_TYPE_SLOTS
875 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
876 #else
877 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
878 #endif
880 /* GetBuiltinName.proto */
881 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
883 /* PyThreadStateGet.proto */
884 #if CYTHON_FAST_THREAD_STATE
885 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
886 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
887 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
888 #else
889 #define __Pyx_PyThreadState_declare
890 #define __Pyx_PyThreadState_assign
891 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
892 #endif
894 /* PyErrFetchRestore.proto */
895 #if CYTHON_FAST_THREAD_STATE
896 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
897 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
898 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
899 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
900 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
901 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
902 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
903 #if CYTHON_COMPILING_IN_CPYTHON
904 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
905 #else
906 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
907 #endif
908 #else
909 #define __Pyx_PyErr_Clear() PyErr_Clear()
910 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
911 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
912 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
913 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
914 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
915 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
916 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
917 #endif
919 /* Profile.proto */
920 #ifndef CYTHON_PROFILE
921 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
922 #define CYTHON_PROFILE 0
923 #else
924 #define CYTHON_PROFILE 1
925 #endif
926 #endif
927 #ifndef CYTHON_TRACE_NOGIL
928 #define CYTHON_TRACE_NOGIL 0
929 #else
930 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
931 #define CYTHON_TRACE 1
932 #endif
933 #endif
934 #ifndef CYTHON_TRACE
935 #define CYTHON_TRACE 0
936 #endif
937 #if CYTHON_TRACE
938 #undef CYTHON_PROFILE_REUSE_FRAME
939 #endif
940 #ifndef CYTHON_PROFILE_REUSE_FRAME
941 #define CYTHON_PROFILE_REUSE_FRAME 0
942 #endif
943 #if CYTHON_PROFILE || CYTHON_TRACE
944 #include "compile.h"
945 #include "frameobject.h"
946 #include "traceback.h"
947 #if CYTHON_PROFILE_REUSE_FRAME
948 #define CYTHON_FRAME_MODIFIER static
949 #define CYTHON_FRAME_DEL(frame)
950 #else
951 #define CYTHON_FRAME_MODIFIER
952 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
953 #endif
954 #define __Pyx_TraceDeclarations\
955 static PyCodeObject *__pyx_frame_code = NULL;\
956 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
957 int __Pyx_use_tracing = 0;
958 #define __Pyx_TraceFrameInit(codeobj)\
959 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
960 #ifdef WITH_THREAD
961 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
962 if (nogil) {\
963 if (CYTHON_TRACE_NOGIL) {\
964 PyThreadState *tstate;\
965 PyGILState_STATE state = PyGILState_Ensure();\
966 tstate = __Pyx_PyThreadState_Current;\
967 if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
968 (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
969 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
971 PyGILState_Release(state);\
972 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
974 } else {\
975 PyThreadState* tstate = PyThreadState_GET();\
976 if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
977 (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
978 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
979 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
982 #else
983 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
984 { PyThreadState* tstate = PyThreadState_GET();\
985 if (unlikely(tstate->use_tracing) && !tstate->tracing &&\
986 (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
987 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
988 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
991 #endif
992 #define __Pyx_TraceException()\
993 if (likely(!__Pyx_use_tracing)); else {\
994 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
995 if (tstate->use_tracing &&\
996 (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) {\
997 tstate->tracing++;\
998 tstate->use_tracing = 0;\
999 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1000 if (exc_info) {\
1001 if (CYTHON_TRACE && tstate->c_tracefunc)\
1002 tstate->c_tracefunc(\
1003 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1004 tstate->c_profilefunc(\
1005 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1006 Py_DECREF(exc_info);\
1008 tstate->use_tracing = 1;\
1009 tstate->tracing--;\
1012 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1013 PyObject *type, *value, *traceback;
1014 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1015 tstate->tracing++;
1016 tstate->use_tracing = 0;
1017 if (CYTHON_TRACE && tstate->c_tracefunc)
1018 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1019 if (tstate->c_profilefunc)
1020 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1021 CYTHON_FRAME_DEL(frame);
1022 tstate->use_tracing = 1;
1023 tstate->tracing--;
1024 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1026 #ifdef WITH_THREAD
1027 #define __Pyx_TraceReturn(result, nogil)\
1028 if (likely(!__Pyx_use_tracing)); else {\
1029 if (nogil) {\
1030 if (CYTHON_TRACE_NOGIL) {\
1031 PyThreadState *tstate;\
1032 PyGILState_STATE state = PyGILState_Ensure();\
1033 tstate = __Pyx_PyThreadState_Current;\
1034 if (tstate->use_tracing) {\
1035 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1037 PyGILState_Release(state);\
1039 } else {\
1040 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1041 if (tstate->use_tracing) {\
1042 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1046 #else
1047 #define __Pyx_TraceReturn(result, nogil)\
1048 if (likely(!__Pyx_use_tracing)); else {\
1049 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1050 if (tstate->use_tracing) {\
1051 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1054 #endif
1055 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
1056 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
1057 #else
1058 #define __Pyx_TraceDeclarations
1059 #define __Pyx_TraceFrameInit(codeobj)
1060 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
1061 #define __Pyx_TraceException()
1062 #define __Pyx_TraceReturn(result, nogil)
1063 #endif
1064 #if CYTHON_TRACE
1065 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
1066 int ret;
1067 PyObject *type, *value, *traceback;
1068 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1069 __Pyx_PyFrame_SetLineNumber(frame, lineno);
1070 tstate->tracing++;
1071 tstate->use_tracing = 0;
1072 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
1073 tstate->use_tracing = 1;
1074 tstate->tracing--;
1075 if (likely(!ret)) {
1076 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1077 } else {
1078 Py_XDECREF(type);
1079 Py_XDECREF(value);
1080 Py_XDECREF(traceback);
1082 return ret;
1084 #ifdef WITH_THREAD
1085 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1086 if (likely(!__Pyx_use_tracing)); else {\
1087 if (nogil) {\
1088 if (CYTHON_TRACE_NOGIL) {\
1089 int ret = 0;\
1090 PyThreadState *tstate;\
1091 PyGILState_STATE state = PyGILState_Ensure();\
1092 tstate = __Pyx_PyThreadState_Current;\
1093 if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
1094 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1096 PyGILState_Release(state);\
1097 if (unlikely(ret)) goto_error;\
1099 } else {\
1100 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1101 if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
1102 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1103 if (unlikely(ret)) goto_error;\
1107 #else
1108 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1109 if (likely(!__Pyx_use_tracing)); else {\
1110 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1111 if (unlikely(tstate->use_tracing && tstate->c_tracefunc && __pyx_frame->f_trace)) {\
1112 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1113 if (unlikely(ret)) goto_error;\
1116 #endif
1117 #else
1118 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
1119 #endif
1121 /* PyCFunctionFastCall.proto */
1122 #if CYTHON_FAST_PYCCALL
1123 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1124 #else
1125 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1126 #endif
1128 /* PyFunctionFastCall.proto */
1129 #if CYTHON_FAST_PYCALL
1130 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1131 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1132 #if 1 || PY_VERSION_HEX < 0x030600B1
1133 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1134 #else
1135 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1136 #endif
1137 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1138 (sizeof(char [1 - 2*!(cond)]) - 1)
1139 #ifndef Py_MEMBER_SIZE
1140 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1141 #endif
1142 static size_t __pyx_pyframe_localsplus_offset = 0;
1143 #include "frameobject.h"
1144 #define __Pxy_PyFrame_Initialize_Offsets()\
1145 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1146 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1147 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1148 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1149 #endif
1151 /* PyObjectCall.proto */
1152 #if CYTHON_COMPILING_IN_CPYTHON
1153 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1154 #else
1155 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1156 #endif
1158 /* PyObjectCallMethO.proto */
1159 #if CYTHON_COMPILING_IN_CPYTHON
1160 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1161 #endif
1163 /* PyObjectCallOneArg.proto */
1164 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1166 /* PyObjectCallNoArg.proto */
1167 #if CYTHON_COMPILING_IN_CPYTHON
1168 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1169 #else
1170 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1171 #endif
1173 /* None.proto */
1174 static CYTHON_INLINE long __Pyx_div_long(long, long);
1176 /* None.proto */
1177 static CYTHON_INLINE long __Pyx_mod_long(long, long);
1179 /* RaiseDoubleKeywords.proto */
1180 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1182 /* ParseKeywords.proto */
1183 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1184 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1185 const char* function_name);
1187 /* RaiseArgTupleInvalid.proto */
1188 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1189 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1191 /* PyObjectSetAttrStr.proto */
1192 #if CYTHON_USE_TYPE_SLOTS
1193 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1194 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1195 #else
1196 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1197 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1198 #endif
1200 /* PyObjectCall2Args.proto */
1201 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1203 /* PyFloatBinop.proto */
1204 #if !CYTHON_COMPILING_IN_PYPY
1205 static PyObject* __Pyx_PyFloat_NeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1206 #else
1207 #define __Pyx_PyFloat_NeObjC(op1, op2, floatval, inplace, zerodivision_check)\
1208 (PyObject_RichCompare(op1, op2, Py_NE))
1209 #endif
1211 /* ListAppend.proto */
1212 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1213 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1214 PyListObject* L = (PyListObject*) list;
1215 Py_ssize_t len = Py_SIZE(list);
1216 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1217 Py_INCREF(x);
1218 PyList_SET_ITEM(list, len, x);
1219 Py_SIZE(list) = len+1;
1220 return 0;
1222 return PyList_Append(list, x);
1224 #else
1225 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1226 #endif
1228 /* PyDictVersioning.proto */
1229 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1230 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1231 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1232 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1233 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1234 (cache_var) = (value);
1235 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1236 static PY_UINT64_T __pyx_dict_version = 0;\
1237 static PyObject *__pyx_dict_cached_value = NULL;\
1238 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1239 (VAR) = __pyx_dict_cached_value;\
1240 } else {\
1241 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1242 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1245 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1246 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1247 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1248 #else
1249 #define __PYX_GET_DICT_VERSION(dict) (0)
1250 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1251 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1252 #endif
1254 /* GetModuleGlobalName.proto */
1255 #if CYTHON_USE_DICT_VERSIONS
1256 #define __Pyx_GetModuleGlobalName(var, name) {\
1257 static PY_UINT64_T __pyx_dict_version = 0;\
1258 static PyObject *__pyx_dict_cached_value = NULL;\
1259 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1260 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1261 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1263 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1264 PY_UINT64_T __pyx_dict_version;\
1265 PyObject *__pyx_dict_cached_value;\
1266 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1268 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1269 #else
1270 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1271 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1272 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1273 #endif
1275 /* PyObjectFormat.proto */
1276 #if CYTHON_USE_UNICODE_WRITER
1277 static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f);
1278 #else
1279 #define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f)
1280 #endif
1282 /* IncludeStringH.proto */
1283 #include <string.h>
1285 /* JoinPyUnicode.proto */
1286 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
1287 Py_UCS4 max_char);
1289 /* None.proto */
1290 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1292 /* PyFloatBinop.proto */
1293 #if !CYTHON_COMPILING_IN_PYPY
1294 static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1295 #else
1296 #define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\
1297 (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
1298 #endif
1300 /* Import.proto */
1301 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1303 /* ImportFrom.proto */
1304 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1306 /* FetchCommonType.proto */
1307 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1309 /* CythonFunction.proto */
1310 #define __Pyx_CyFunction_USED 1
1311 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1312 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1313 #define __Pyx_CYFUNCTION_CCLASS 0x04
1314 #define __Pyx_CyFunction_GetClosure(f)\
1315 (((__pyx_CyFunctionObject *) (f))->func_closure)
1316 #define __Pyx_CyFunction_GetClassObj(f)\
1317 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1318 #define __Pyx_CyFunction_Defaults(type, f)\
1319 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1320 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1321 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1322 typedef struct {
1323 PyCFunctionObject func;
1324 #if PY_VERSION_HEX < 0x030500A0
1325 PyObject *func_weakreflist;
1326 #endif
1327 PyObject *func_dict;
1328 PyObject *func_name;
1329 PyObject *func_qualname;
1330 PyObject *func_doc;
1331 PyObject *func_globals;
1332 PyObject *func_code;
1333 PyObject *func_closure;
1334 PyObject *func_classobj;
1335 void *defaults;
1336 int defaults_pyobjects;
1337 int flags;
1338 PyObject *defaults_tuple;
1339 PyObject *defaults_kwdict;
1340 PyObject *(*defaults_getter)(PyObject *);
1341 PyObject *func_annotations;
1342 } __pyx_CyFunctionObject;
1343 static PyTypeObject *__pyx_CyFunctionType = 0;
1344 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1345 #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
1346 __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
1347 static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
1348 int flags, PyObject* qualname,
1349 PyObject *self,
1350 PyObject *module, PyObject *globals,
1351 PyObject* code);
1352 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1353 size_t size,
1354 int pyobjects);
1355 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1356 PyObject *tuple);
1357 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1358 PyObject *dict);
1359 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1360 PyObject *dict);
1361 static int __pyx_CyFunction_init(void);
1363 /* SetNameInClass.proto */
1364 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1365 #define __Pyx_SetNameInClass(ns, name, value)\
1366 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1367 #elif CYTHON_COMPILING_IN_CPYTHON
1368 #define __Pyx_SetNameInClass(ns, name, value)\
1369 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1370 #else
1371 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1372 #endif
1374 /* CalculateMetaclass.proto */
1375 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1377 /* Py3ClassCreate.proto */
1378 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1379 PyObject *mkw, PyObject *modname, PyObject *doc);
1380 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1381 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1383 /* CLineInTraceback.proto */
1384 #ifdef CYTHON_CLINE_IN_TRACEBACK
1385 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1386 #else
1387 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1388 #endif
1390 /* CodeObjectCache.proto */
1391 typedef struct {
1392 PyCodeObject* code_object;
1393 int code_line;
1394 } __Pyx_CodeObjectCacheEntry;
1395 struct __Pyx_CodeObjectCache {
1396 int count;
1397 int max_count;
1398 __Pyx_CodeObjectCacheEntry* entries;
1400 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1401 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1402 static PyCodeObject *__pyx_find_code_object(int code_line);
1403 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1405 /* AddTraceback.proto */
1406 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1407 int py_line, const char *filename);
1409 /* CIntToPy.proto */
1410 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1412 /* CIntFromPy.proto */
1413 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1415 /* CIntFromPy.proto */
1416 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1418 /* FastTypeChecks.proto */
1419 #if CYTHON_COMPILING_IN_CPYTHON
1420 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1421 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1422 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1423 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1424 #else
1425 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1426 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1427 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1428 #endif
1429 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1431 /* CStringEquals.proto */
1432 static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *);
1434 /* CheckBinaryVersion.proto */
1435 static int __Pyx_check_binary_version(void);
1437 /* InitStrings.proto */
1438 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1441 /* Module declarations from 'MACS2.PeakDetect' */
1442 static PyObject *__pyx_f_5MACS2_10PeakDetect_subpeak_letters(short); /*proto*/
1443 #define __Pyx_MODULE_NAME "MACS2.PeakDetect"
1444 extern int __pyx_module_is_main_MACS2__PeakDetect;
1445 int __pyx_module_is_main_MACS2__PeakDetect = 0;
1447 /* Implementation of 'MACS2.PeakDetect' */
1448 static PyObject *__pyx_builtin_chr;
1449 static const char __pyx_k_d[] = "d";
1450 static const char __pyx_k_f[] = "f";
1451 static const char __pyx_k_i[] = "i";
1452 static const char __pyx_k_p[] = "p";
1453 static const char __pyx_k_q[] = "q";
1454 static const char __pyx_k_5f[] = ".5f";
1455 static const char __pyx_k__4[] = ", ";
1456 static const char __pyx_k__5[] = "...";
1457 static const char __pyx_k__7[] = "*";
1458 static const char __pyx_k_gc[] = "gc";
1459 static const char __pyx_k_io[] = "io";
1460 static const char __pyx_k_chr[] = "chr";
1461 static const char __pyx_k_doc[] = "__doc__";
1462 static const char __pyx_k_opt[] = "opt";
1463 static const char __pyx_k_info[] = "info";
1464 static const char __pyx_k_init[] = "__init__";
1465 static const char __pyx_k_main[] = "__main__";
1466 static const char __pyx_k_name[] = "name";
1467 static const char __pyx_k_self[] = "self";
1468 static const char __pyx_k_test[] = "__test__";
1469 static const char __pyx_k_warn[] = "warn";
1470 static const char __pyx_k_broad[] = "broad";
1471 static const char __pyx_k_debug[] = "debug";
1472 static const char __pyx_k_gsize[] = "gsize";
1473 static const char __pyx_k_peaks[] = "peaks";
1474 static const char __pyx_k_ratio[] = "ratio";
1475 static const char __pyx_k_shift[] = "shift";
1476 static const char __pyx_k_tmp_v[] = "tmp_v";
1477 static const char __pyx_k_total[] = "total";
1478 static const char __pyx_k_treat[] = "treat";
1479 static const char __pyx_k_tsize[] = "tsize";
1480 static const char __pyx_k_PeakIO[] = "PeakIO";
1481 static const char __pyx_k_encode[] = "encode";
1482 static const char __pyx_k_import[] = "__import__";
1483 static const char __pyx_k_length[] = "length";
1484 static const char __pyx_k_llocal[] = "llocal";
1485 static const char __pyx_k_maxgap[] = "maxgap";
1486 static const char __pyx_k_minlen[] = "minlen";
1487 static const char __pyx_k_module[] = "__module__";
1488 static const char __pyx_k_name_2[] = "__name__";
1489 static const char __pyx_k_slocal[] = "slocal";
1490 static const char __pyx_k_PE_MODE[] = "PE_MODE";
1491 static const char __pyx_k_control[] = "control";
1492 static const char __pyx_k_destroy[] = "destroy";
1493 static const char __pyx_k_do_SPMR[] = "do_SPMR";
1494 static const char __pyx_k_groupby[] = "groupby";
1495 static const char __pyx_k_lregion[] = "lregion";
1496 static const char __pyx_k_max_gap[] = "max_gap";
1497 static const char __pyx_k_prepare[] = "__prepare__";
1498 static const char __pyx_k_sregion[] = "sregion";
1499 static const char __pyx_k_ctrl_d_s[] = "ctrl_d_s";
1500 static const char __pyx_k_nolambda[] = "nolambda";
1501 static const char __pyx_k_operator[] = "operator";
1502 static const char __pyx_k_qualname[] = "__qualname__";
1503 static const char __pyx_k_bdg_treat[] = "bdg_treat";
1504 static const char __pyx_k_end_shift[] = "end_shift";
1505 static const char __pyx_k_itertools[] = "itertools";
1506 static const char __pyx_k_lambda_bg[] = "lambda_bg";
1507 static const char __pyx_k_metaclass[] = "__metaclass__";
1508 static const char __pyx_k_save_SPMR[] = "save_SPMR";
1509 static const char __pyx_k_store_bdg[] = "store_bdg";
1510 static const char __pyx_k_tocontrol[] = "tocontrol";
1511 static const char __pyx_k_trackline[] = "trackline";
1512 static const char __pyx_k_treat_sum[] = "treat_sum";
1513 static const char __pyx_k_PeakDetect[] = "PeakDetect";
1514 static const char __pyx_k_bedGraphIO[] = "bedGraphIO";
1515 static const char __pyx_k_call_peaks[] = "call_peaks";
1516 static const char __pyx_k_itemgetter[] = "itemgetter";
1517 static const char __pyx_k_largelocal[] = "largelocal";
1518 static const char __pyx_k_log_pvalue[] = "log_pvalue";
1519 static const char __pyx_k_log_qvalue[] = "log_qvalue";
1520 static const char __pyx_k_min_length[] = "min_length";
1521 static const char __pyx_k_scoretrack[] = "scoretrack";
1522 static const char __pyx_k_smalllocal[] = "smalllocal";
1523 static const char __pyx_k_bdg_control[] = "bdg_control";
1524 static const char __pyx_k_control_sum[] = "control_sum";
1525 static const char __pyx_k_final_peaks[] = "final_peaks";
1526 static const char __pyx_k_treat_scale[] = "treat_scale";
1527 static const char __pyx_k_treat_total[] = "treat_total";
1528 static const char __pyx_k_call_summits[] = "call_summits";
1529 static const char __pyx_k_ctrl_scale_s[] = "ctrl_scale_s";
1530 static const char __pyx_k_lvl1_max_gap[] = "lvl1_max_gap";
1531 static const char __pyx_k_lvl2_max_gap[] = "lvl2_max_gap";
1532 static const char __pyx_k_treat_length[] = "treat_length";
1533 static const char __pyx_k_control_total[] = "control_total";
1534 static const char __pyx_k_lvl1_cutoff_s[] = "lvl1_cutoff_s";
1535 static const char __pyx_k_lvl2_cutoff_s[] = "lvl2_cutoff_s";
1536 static const char __pyx_k_save_bedGraph[] = "save_bedGraph";
1537 static const char __pyx_k_MACS2_Constants[] = "MACS2.Constants";
1538 static const char __pyx_k_MACS2_IO_PeakIO[] = "MACS2.IO.PeakIO";
1539 static const char __pyx_k_call_broadpeaks[] = "call_broadpeaks";
1540 static const char __pyx_k_cutoff_analysis[] = "cutoff_analysis";
1541 static const char __pyx_k_log_broadcutoff[] = "log_broadcutoff";
1542 static const char __pyx_k_scorecalculator[] = "scorecalculator";
1543 static const char __pyx_k_MACS2_PeakDetect[] = "MACS2.PeakDetect";
1544 static const char __pyx_k_enable_trackline[] = "enable_trackline";
1545 static const char __pyx_k_PeakDetect___init[] = "PeakDetect.__init__";
1546 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1547 static const char __pyx_k_MACS2_IO_BedGraphIO[] = "MACS2.IO.BedGraphIO";
1548 static const char __pyx_k_ratio_treat2control[] = "ratio_treat2control";
1549 static const char __pyx_k_CallerFromAlignments[] = "CallerFromAlignments";
1550 static const char __pyx_k_MACS2_PeakDetect_pyx[] = "MACS2/PeakDetect.pyx";
1551 static const char __pyx_k_call_peaks_w_control[] = "__call_peaks_w_control";
1552 static const char __pyx_k_cutoff_analysis_file[] = "cutoff_analysis_file";
1553 static const char __pyx_k_treat_scaling_factor[] = "treat_scaling_factor";
1554 static const char __pyx_k_MACS2_IO_CallPeakUnit[] = "MACS2.IO.CallPeakUnit";
1555 static const char __pyx_k_PeakDetect_call_peaks[] = "PeakDetect.call_peaks";
1556 static const char __pyx_k_call_peaks_wo_control[] = "__call_peaks_wo_control";
1557 static const char __pyx_k_ctrl_scaling_factor_s[] = "ctrl_scaling_factor_s";
1558 static const char __pyx_k_average_template_length[] = "average_template_length";
1559 static const char __pyx_k_bedGraph_treat_filename[] = "bedGraph_treat_filename";
1560 static const char __pyx_k_bedGraph_filename_prefix[] = "bedGraph_filename_prefix";
1561 static const char __pyx_k_cutoff_analysis_filename[] = "cutoff_analysis_filename";
1562 static const char __pyx_k_bedGraph_control_filename[] = "bedGraph_control_filename";
1563 static const char __pyx_k_effective_depth_in_million[] = "effective_depth_in_million";
1564 static const char __pyx_k_3_DYNAMIC_LAMBDA_IS_DISABLED[] = "#3 !!!! DYNAMIC LAMBDA IS DISABLED !!!!";
1565 static const char __pyx_k_3_Going_to_call_summits_inside[] = "#3 Going to call summits inside each peak ...";
1566 static const char __pyx_k_llocal_can_t_be_smaller_than_d[] = "llocal can't be smaller than d!";
1567 static const char __pyx_k_slocal_can_t_be_smaller_than_d[] = "slocal can't be smaller than d!";
1568 static const char __pyx_k_3_Call_broad_peaks_with_given_l[] = "#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: ";
1569 static const char __pyx_k_3_Call_peaks_with_given_log10pv[] = "#3 Call peaks with given -log10pvalue cutoff: %.5f ...";
1570 static const char __pyx_k_Module_Description_Detect_peaks[] = "Module Description: Detect peaks, main module\n\nThis code is free software; you can redistribute it and/or modify it\nunder the terms of the BSD License (see the file LICENSE included with\nthe distribution).\n";
1571 static const char __pyx_k_PeakDetect__call_peaks_w_contro[] = "_PeakDetect__call_peaks_w_control";
1572 static const char __pyx_k_PeakDetect__call_peaks_wo_contr[] = "_PeakDetect__call_peaks_wo_control";
1573 static const char __pyx_k_Class_to_do_the_peak_calling_e_g[] = "Class to do the peak calling.\n\n e.g\n >>> from MACS2.cPeakDetect import cPeakDetect\n >>> pd = PeakDetect(treat=treatdata, control=controldata, pvalue=pvalue_cutoff, d=100, gsize=3000000000)\n >>> pd.call_peaks()\n ";
1574 static const char __pyx_k_PeakDetect___call_peaks_w_contro[] = "PeakDetect.__call_peaks_w_control";
1575 static const char __pyx_k_PeakDetect___call_peaks_wo_contr[] = "PeakDetect.__call_peaks_wo_control";
1576 static const char __pyx_k_llocal_can_t_be_smaller_than_slo[] = "llocal can't be smaller than slocal!";
1577 static const char __pyx_k_3_Call_broad_peaks_with_given_l_2[] = "#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: ";
1578 static PyObject *__pyx_kp_u_3_Call_broad_peaks_with_given_l;
1579 static PyObject *__pyx_kp_u_3_Call_broad_peaks_with_given_l_2;
1580 static PyObject *__pyx_kp_u_3_Call_peaks_with_given_log10pv;
1581 static PyObject *__pyx_kp_u_3_DYNAMIC_LAMBDA_IS_DISABLED;
1582 static PyObject *__pyx_kp_u_3_Going_to_call_summits_inside;
1583 static PyObject *__pyx_kp_u_5f;
1584 static PyObject *__pyx_n_s_CallerFromAlignments;
1585 static PyObject *__pyx_kp_s_Class_to_do_the_peak_calling_e_g;
1586 static PyObject *__pyx_n_s_MACS2_Constants;
1587 static PyObject *__pyx_n_s_MACS2_IO_BedGraphIO;
1588 static PyObject *__pyx_n_s_MACS2_IO_CallPeakUnit;
1589 static PyObject *__pyx_n_s_MACS2_IO_PeakIO;
1590 static PyObject *__pyx_n_s_MACS2_PeakDetect;
1591 static PyObject *__pyx_kp_s_MACS2_PeakDetect_pyx;
1592 static PyObject *__pyx_n_s_PE_MODE;
1593 static PyObject *__pyx_n_s_PeakDetect;
1594 static PyObject *__pyx_n_s_PeakDetect___call_peaks_w_contro;
1595 static PyObject *__pyx_n_s_PeakDetect___call_peaks_wo_contr;
1596 static PyObject *__pyx_n_s_PeakDetect___init;
1597 static PyObject *__pyx_n_s_PeakDetect__call_peaks_w_contro;
1598 static PyObject *__pyx_n_s_PeakDetect__call_peaks_wo_contr;
1599 static PyObject *__pyx_n_s_PeakDetect_call_peaks;
1600 static PyObject *__pyx_n_s_PeakIO;
1601 static PyObject *__pyx_kp_u__4;
1602 static PyObject *__pyx_kp_u__5;
1603 static PyObject *__pyx_n_s__7;
1604 static PyObject *__pyx_n_s_average_template_length;
1605 static PyObject *__pyx_n_s_bdg_control;
1606 static PyObject *__pyx_n_s_bdg_treat;
1607 static PyObject *__pyx_n_s_bedGraphIO;
1608 static PyObject *__pyx_n_s_bedGraph_control_filename;
1609 static PyObject *__pyx_n_s_bedGraph_filename_prefix;
1610 static PyObject *__pyx_n_s_bedGraph_treat_filename;
1611 static PyObject *__pyx_n_s_broad;
1612 static PyObject *__pyx_n_s_call_broadpeaks;
1613 static PyObject *__pyx_n_s_call_peaks;
1614 static PyObject *__pyx_n_s_call_peaks_w_control;
1615 static PyObject *__pyx_n_s_call_peaks_wo_control;
1616 static PyObject *__pyx_n_s_call_summits;
1617 static PyObject *__pyx_n_s_chr;
1618 static PyObject *__pyx_n_s_cline_in_traceback;
1619 static PyObject *__pyx_n_s_control;
1620 static PyObject *__pyx_n_s_control_sum;
1621 static PyObject *__pyx_n_s_control_total;
1622 static PyObject *__pyx_n_s_ctrl_d_s;
1623 static PyObject *__pyx_n_s_ctrl_scale_s;
1624 static PyObject *__pyx_n_s_ctrl_scaling_factor_s;
1625 static PyObject *__pyx_n_s_cutoff_analysis;
1626 static PyObject *__pyx_n_s_cutoff_analysis_file;
1627 static PyObject *__pyx_n_s_cutoff_analysis_filename;
1628 static PyObject *__pyx_n_s_d;
1629 static PyObject *__pyx_n_s_debug;
1630 static PyObject *__pyx_n_s_destroy;
1631 static PyObject *__pyx_n_s_do_SPMR;
1632 static PyObject *__pyx_n_s_doc;
1633 static PyObject *__pyx_n_s_effective_depth_in_million;
1634 static PyObject *__pyx_n_s_enable_trackline;
1635 static PyObject *__pyx_n_s_encode;
1636 static PyObject *__pyx_n_s_end_shift;
1637 static PyObject *__pyx_n_u_f;
1638 static PyObject *__pyx_n_s_final_peaks;
1639 static PyObject *__pyx_n_s_gc;
1640 static PyObject *__pyx_n_s_groupby;
1641 static PyObject *__pyx_n_s_gsize;
1642 static PyObject *__pyx_n_s_i;
1643 static PyObject *__pyx_n_s_import;
1644 static PyObject *__pyx_n_s_info;
1645 static PyObject *__pyx_n_s_init;
1646 static PyObject *__pyx_n_s_io;
1647 static PyObject *__pyx_n_s_itemgetter;
1648 static PyObject *__pyx_n_s_itertools;
1649 static PyObject *__pyx_n_s_lambda_bg;
1650 static PyObject *__pyx_n_s_largelocal;
1651 static PyObject *__pyx_n_s_length;
1652 static PyObject *__pyx_n_s_llocal;
1653 static PyObject *__pyx_kp_u_llocal_can_t_be_smaller_than_d;
1654 static PyObject *__pyx_kp_u_llocal_can_t_be_smaller_than_slo;
1655 static PyObject *__pyx_n_s_log_broadcutoff;
1656 static PyObject *__pyx_n_s_log_pvalue;
1657 static PyObject *__pyx_n_s_log_qvalue;
1658 static PyObject *__pyx_n_s_lregion;
1659 static PyObject *__pyx_n_s_lvl1_cutoff_s;
1660 static PyObject *__pyx_n_s_lvl1_max_gap;
1661 static PyObject *__pyx_n_s_lvl2_cutoff_s;
1662 static PyObject *__pyx_n_s_lvl2_max_gap;
1663 static PyObject *__pyx_n_s_main;
1664 static PyObject *__pyx_n_s_max_gap;
1665 static PyObject *__pyx_n_s_maxgap;
1666 static PyObject *__pyx_n_s_metaclass;
1667 static PyObject *__pyx_n_s_min_length;
1668 static PyObject *__pyx_n_s_minlen;
1669 static PyObject *__pyx_n_s_module;
1670 static PyObject *__pyx_n_s_name;
1671 static PyObject *__pyx_n_s_name_2;
1672 static PyObject *__pyx_n_s_nolambda;
1673 static PyObject *__pyx_n_s_operator;
1674 static PyObject *__pyx_n_s_opt;
1675 static PyObject *__pyx_n_u_p;
1676 static PyObject *__pyx_n_s_peaks;
1677 static PyObject *__pyx_n_s_prepare;
1678 static PyObject *__pyx_n_u_q;
1679 static PyObject *__pyx_n_s_qualname;
1680 static PyObject *__pyx_n_s_ratio;
1681 static PyObject *__pyx_n_s_ratio_treat2control;
1682 static PyObject *__pyx_n_s_save_SPMR;
1683 static PyObject *__pyx_n_s_save_bedGraph;
1684 static PyObject *__pyx_n_s_scorecalculator;
1685 static PyObject *__pyx_n_s_scoretrack;
1686 static PyObject *__pyx_n_s_self;
1687 static PyObject *__pyx_n_s_shift;
1688 static PyObject *__pyx_n_s_slocal;
1689 static PyObject *__pyx_kp_u_slocal_can_t_be_smaller_than_d;
1690 static PyObject *__pyx_n_s_smalllocal;
1691 static PyObject *__pyx_n_s_sregion;
1692 static PyObject *__pyx_n_s_store_bdg;
1693 static PyObject *__pyx_n_s_test;
1694 static PyObject *__pyx_n_s_tmp_v;
1695 static PyObject *__pyx_n_s_tocontrol;
1696 static PyObject *__pyx_n_s_total;
1697 static PyObject *__pyx_n_s_trackline;
1698 static PyObject *__pyx_n_s_treat;
1699 static PyObject *__pyx_n_s_treat_length;
1700 static PyObject *__pyx_n_s_treat_scale;
1701 static PyObject *__pyx_n_s_treat_scaling_factor;
1702 static PyObject *__pyx_n_s_treat_sum;
1703 static PyObject *__pyx_n_s_treat_total;
1704 static PyObject *__pyx_n_s_tsize;
1705 static PyObject *__pyx_n_s_warn;
1706 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_opt, PyObject *__pyx_v_treat, PyObject *__pyx_v_control, PyObject *__pyx_v_d, CYTHON_UNUSED PyObject *__pyx_v_maxgap, CYTHON_UNUSED PyObject *__pyx_v_minlen, PyObject *__pyx_v_slocal, PyObject *__pyx_v_llocal); /* proto */
1707 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect_2call_peaks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1708 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect_4__call_peaks_w_control(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1709 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect_6__call_peaks_wo_control(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1710 static PyObject *__pyx_float_1_0;
1711 static PyObject *__pyx_float_1000000_0;
1712 static PyObject *__pyx_int_1;
1713 static PyObject *__pyx_int_2;
1714 static PyObject *__pyx_int_4;
1715 static PyObject *__pyx_codeobj_;
1716 static PyObject *__pyx_tuple__8;
1717 static PyObject *__pyx_tuple__9;
1718 static PyObject *__pyx_tuple__10;
1719 static PyObject *__pyx_tuple__11;
1720 static PyObject *__pyx_tuple__12;
1721 static PyObject *__pyx_codeobj__2;
1722 static PyObject *__pyx_codeobj__3;
1723 static PyObject *__pyx_codeobj__6;
1724 /* Late includes */
1726 /* "MACS2/PeakDetect.pyx":22
1727 * from MACS2.IO.CallPeakUnit import CallerFromAlignments
1729 * cdef bytes subpeak_letters(short i): # <<<<<<<<<<<<<<
1730 * if i < 26:
1731 * return chr(97+i).encode()
1734 static PyObject *__pyx_f_5MACS2_10PeakDetect_subpeak_letters(short __pyx_v_i) {
1735 PyObject *__pyx_r = NULL;
1736 __Pyx_TraceDeclarations
1737 __Pyx_RefNannyDeclarations
1738 int __pyx_t_1;
1739 PyObject *__pyx_t_2 = NULL;
1740 PyObject *__pyx_t_3 = NULL;
1741 PyObject *__pyx_t_4 = NULL;
1742 PyObject *__pyx_t_5 = NULL;
1743 __Pyx_RefNannySetupContext("subpeak_letters", 0);
1744 __Pyx_TraceCall("subpeak_letters", __pyx_f[0], 22, 0, __PYX_ERR(0, 22, __pyx_L1_error));
1746 /* "MACS2/PeakDetect.pyx":23
1748 * cdef bytes subpeak_letters(short i):
1749 * if i < 26: # <<<<<<<<<<<<<<
1750 * return chr(97+i).encode()
1751 * else:
1753 __pyx_t_1 = ((__pyx_v_i < 26) != 0);
1754 if (__pyx_t_1) {
1756 /* "MACS2/PeakDetect.pyx":24
1757 * cdef bytes subpeak_letters(short i):
1758 * if i < 26:
1759 * return chr(97+i).encode() # <<<<<<<<<<<<<<
1760 * else:
1761 * return subpeak_letters(i // 26) + chr(97 + (i % 26)).encode()
1763 __Pyx_XDECREF(__pyx_r);
1764 __pyx_t_3 = __Pyx_PyInt_From_long((97 + __pyx_v_i)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
1765 __Pyx_GOTREF(__pyx_t_3);
1766 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error)
1767 __Pyx_GOTREF(__pyx_t_4);
1768 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1769 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
1770 __Pyx_GOTREF(__pyx_t_3);
1771 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1772 __pyx_t_4 = NULL;
1773 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
1774 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
1775 if (likely(__pyx_t_4)) {
1776 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1777 __Pyx_INCREF(__pyx_t_4);
1778 __Pyx_INCREF(function);
1779 __Pyx_DECREF_SET(__pyx_t_3, function);
1782 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
1783 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
1784 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
1785 __Pyx_GOTREF(__pyx_t_2);
1786 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1787 if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 24, __pyx_L1_error)
1788 __pyx_r = ((PyObject*)__pyx_t_2);
1789 __pyx_t_2 = 0;
1790 goto __pyx_L0;
1792 /* "MACS2/PeakDetect.pyx":23
1794 * cdef bytes subpeak_letters(short i):
1795 * if i < 26: # <<<<<<<<<<<<<<
1796 * return chr(97+i).encode()
1797 * else:
1801 /* "MACS2/PeakDetect.pyx":26
1802 * return chr(97+i).encode()
1803 * else:
1804 * return subpeak_letters(i // 26) + chr(97 + (i % 26)).encode() # <<<<<<<<<<<<<<
1806 * class PeakDetect:
1808 /*else*/ {
1809 __Pyx_XDECREF(__pyx_r);
1810 __pyx_t_2 = __pyx_f_5MACS2_10PeakDetect_subpeak_letters(__Pyx_div_long(__pyx_v_i, 26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
1811 __Pyx_GOTREF(__pyx_t_2);
1812 __pyx_t_4 = __Pyx_PyInt_From_long((97 + __Pyx_mod_long(__pyx_v_i, 26))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
1813 __Pyx_GOTREF(__pyx_t_4);
1814 __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
1815 __Pyx_GOTREF(__pyx_t_5);
1816 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1817 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
1818 __Pyx_GOTREF(__pyx_t_4);
1819 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1820 __pyx_t_5 = NULL;
1821 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
1822 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
1823 if (likely(__pyx_t_5)) {
1824 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
1825 __Pyx_INCREF(__pyx_t_5);
1826 __Pyx_INCREF(function);
1827 __Pyx_DECREF_SET(__pyx_t_4, function);
1830 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
1831 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1832 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
1833 __Pyx_GOTREF(__pyx_t_3);
1834 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1835 __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
1836 __Pyx_GOTREF(__pyx_t_4);
1837 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1838 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1839 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 26, __pyx_L1_error)
1840 __pyx_r = ((PyObject*)__pyx_t_4);
1841 __pyx_t_4 = 0;
1842 goto __pyx_L0;
1845 /* "MACS2/PeakDetect.pyx":22
1846 * from MACS2.IO.CallPeakUnit import CallerFromAlignments
1848 * cdef bytes subpeak_letters(short i): # <<<<<<<<<<<<<<
1849 * if i < 26:
1850 * return chr(97+i).encode()
1853 /* function exit code */
1854 __pyx_L1_error:;
1855 __Pyx_XDECREF(__pyx_t_2);
1856 __Pyx_XDECREF(__pyx_t_3);
1857 __Pyx_XDECREF(__pyx_t_4);
1858 __Pyx_XDECREF(__pyx_t_5);
1859 __Pyx_AddTraceback("MACS2.PeakDetect.subpeak_letters", __pyx_clineno, __pyx_lineno, __pyx_filename);
1860 __pyx_r = 0;
1861 __pyx_L0:;
1862 __Pyx_XGIVEREF(__pyx_r);
1863 __Pyx_TraceReturn(__pyx_r, 0);
1864 __Pyx_RefNannyFinishContext();
1865 return __pyx_r;
1868 /* "MACS2/PeakDetect.pyx":36
1869 * >>> pd.call_peaks()
1870 * """
1871 * def __init__ (self,opt = None,treat = None, control = None, d = None, # <<<<<<<<<<<<<<
1872 * maxgap = None, minlen = None, slocal = None, llocal = None):
1873 * """Initialize the PeakDetect object.
1876 /* Python wrapper */
1877 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1878 static char __pyx_doc_5MACS2_10PeakDetect_10PeakDetect___init__[] = "Initialize the PeakDetect object.\n\n ";
1879 static PyMethodDef __pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5MACS2_10PeakDetect_10PeakDetect___init__};
1880 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1881 PyObject *__pyx_v_self = 0;
1882 PyObject *__pyx_v_opt = 0;
1883 PyObject *__pyx_v_treat = 0;
1884 PyObject *__pyx_v_control = 0;
1885 PyObject *__pyx_v_d = 0;
1886 CYTHON_UNUSED PyObject *__pyx_v_maxgap = 0;
1887 CYTHON_UNUSED PyObject *__pyx_v_minlen = 0;
1888 PyObject *__pyx_v_slocal = 0;
1889 PyObject *__pyx_v_llocal = 0;
1890 PyObject *__pyx_r = 0;
1891 __Pyx_RefNannyDeclarations
1892 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1894 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_opt,&__pyx_n_s_treat,&__pyx_n_s_control,&__pyx_n_s_d,&__pyx_n_s_maxgap,&__pyx_n_s_minlen,&__pyx_n_s_slocal,&__pyx_n_s_llocal,0};
1895 PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
1896 values[1] = ((PyObject *)((PyObject *)Py_None));
1897 values[2] = ((PyObject *)((PyObject *)Py_None));
1898 values[3] = ((PyObject *)((PyObject *)Py_None));
1899 values[4] = ((PyObject *)((PyObject *)Py_None));
1901 /* "MACS2/PeakDetect.pyx":37
1902 * """
1903 * def __init__ (self,opt = None,treat = None, control = None, d = None,
1904 * maxgap = None, minlen = None, slocal = None, llocal = None): # <<<<<<<<<<<<<<
1905 * """Initialize the PeakDetect object.
1908 values[5] = ((PyObject *)((PyObject *)Py_None));
1909 values[6] = ((PyObject *)((PyObject *)Py_None));
1910 values[7] = ((PyObject *)((PyObject *)Py_None));
1911 values[8] = ((PyObject *)((PyObject *)Py_None));
1912 if (unlikely(__pyx_kwds)) {
1913 Py_ssize_t kw_args;
1914 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1915 switch (pos_args) {
1916 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
1917 CYTHON_FALLTHROUGH;
1918 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
1919 CYTHON_FALLTHROUGH;
1920 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
1921 CYTHON_FALLTHROUGH;
1922 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
1923 CYTHON_FALLTHROUGH;
1924 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1925 CYTHON_FALLTHROUGH;
1926 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1927 CYTHON_FALLTHROUGH;
1928 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1929 CYTHON_FALLTHROUGH;
1930 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1931 CYTHON_FALLTHROUGH;
1932 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1933 CYTHON_FALLTHROUGH;
1934 case 0: break;
1935 default: goto __pyx_L5_argtuple_error;
1937 kw_args = PyDict_Size(__pyx_kwds);
1938 switch (pos_args) {
1939 case 0:
1940 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
1941 else goto __pyx_L5_argtuple_error;
1942 CYTHON_FALLTHROUGH;
1943 case 1:
1944 if (kw_args > 0) {
1945 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opt);
1946 if (value) { values[1] = value; kw_args--; }
1948 CYTHON_FALLTHROUGH;
1949 case 2:
1950 if (kw_args > 0) {
1951 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treat);
1952 if (value) { values[2] = value; kw_args--; }
1954 CYTHON_FALLTHROUGH;
1955 case 3:
1956 if (kw_args > 0) {
1957 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_control);
1958 if (value) { values[3] = value; kw_args--; }
1960 CYTHON_FALLTHROUGH;
1961 case 4:
1962 if (kw_args > 0) {
1963 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
1964 if (value) { values[4] = value; kw_args--; }
1966 CYTHON_FALLTHROUGH;
1967 case 5:
1968 if (kw_args > 0) {
1969 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxgap);
1970 if (value) { values[5] = value; kw_args--; }
1972 CYTHON_FALLTHROUGH;
1973 case 6:
1974 if (kw_args > 0) {
1975 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minlen);
1976 if (value) { values[6] = value; kw_args--; }
1978 CYTHON_FALLTHROUGH;
1979 case 7:
1980 if (kw_args > 0) {
1981 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_slocal);
1982 if (value) { values[7] = value; kw_args--; }
1984 CYTHON_FALLTHROUGH;
1985 case 8:
1986 if (kw_args > 0) {
1987 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_llocal);
1988 if (value) { values[8] = value; kw_args--; }
1991 if (unlikely(kw_args > 0)) {
1992 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 36, __pyx_L3_error)
1994 } else {
1995 switch (PyTuple_GET_SIZE(__pyx_args)) {
1996 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
1997 CYTHON_FALLTHROUGH;
1998 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
1999 CYTHON_FALLTHROUGH;
2000 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2001 CYTHON_FALLTHROUGH;
2002 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2003 CYTHON_FALLTHROUGH;
2004 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2005 CYTHON_FALLTHROUGH;
2006 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2007 CYTHON_FALLTHROUGH;
2008 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2009 CYTHON_FALLTHROUGH;
2010 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2011 CYTHON_FALLTHROUGH;
2012 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2013 break;
2014 default: goto __pyx_L5_argtuple_error;
2017 __pyx_v_self = values[0];
2018 __pyx_v_opt = values[1];
2019 __pyx_v_treat = values[2];
2020 __pyx_v_control = values[3];
2021 __pyx_v_d = values[4];
2022 __pyx_v_maxgap = values[5];
2023 __pyx_v_minlen = values[6];
2024 __pyx_v_slocal = values[7];
2025 __pyx_v_llocal = values[8];
2027 goto __pyx_L4_argument_unpacking_done;
2028 __pyx_L5_argtuple_error:;
2029 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 36, __pyx_L3_error)
2030 __pyx_L3_error:;
2031 __Pyx_AddTraceback("MACS2.PeakDetect.PeakDetect.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2032 __Pyx_RefNannyFinishContext();
2033 return NULL;
2034 __pyx_L4_argument_unpacking_done:;
2035 __pyx_r = __pyx_pf_5MACS2_10PeakDetect_10PeakDetect___init__(__pyx_self, __pyx_v_self, __pyx_v_opt, __pyx_v_treat, __pyx_v_control, __pyx_v_d, __pyx_v_maxgap, __pyx_v_minlen, __pyx_v_slocal, __pyx_v_llocal);
2037 /* "MACS2/PeakDetect.pyx":36
2038 * >>> pd.call_peaks()
2039 * """
2040 * def __init__ (self,opt = None,treat = None, control = None, d = None, # <<<<<<<<<<<<<<
2041 * maxgap = None, minlen = None, slocal = None, llocal = None):
2042 * """Initialize the PeakDetect object.
2045 /* function exit code */
2046 __Pyx_RefNannyFinishContext();
2047 return __pyx_r;
2050 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_opt, PyObject *__pyx_v_treat, PyObject *__pyx_v_control, PyObject *__pyx_v_d, CYTHON_UNUSED PyObject *__pyx_v_maxgap, CYTHON_UNUSED PyObject *__pyx_v_minlen, PyObject *__pyx_v_slocal, PyObject *__pyx_v_llocal) {
2051 PyObject *__pyx_r = NULL;
2052 __Pyx_TraceDeclarations
2053 __Pyx_RefNannyDeclarations
2054 PyObject *__pyx_t_1 = NULL;
2055 int __pyx_t_2;
2056 PyObject *__pyx_t_3 = NULL;
2057 PyObject *__pyx_t_4 = NULL;
2058 __Pyx_TraceFrameInit(__pyx_codeobj_)
2059 __Pyx_RefNannySetupContext("__init__", 0);
2060 __Pyx_TraceCall("__init__", __pyx_f[0], 36, 0, __PYX_ERR(0, 36, __pyx_L1_error));
2062 /* "MACS2/PeakDetect.pyx":41
2064 * """
2065 * self.opt = opt # <<<<<<<<<<<<<<
2066 * self.info = opt.info
2067 * self.debug = opt.debug
2069 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_opt, __pyx_v_opt) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
2071 /* "MACS2/PeakDetect.pyx":42
2072 * """
2073 * self.opt = opt
2074 * self.info = opt.info # <<<<<<<<<<<<<<
2075 * self.debug = opt.debug
2076 * self.warn = opt.warn
2078 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2079 __Pyx_GOTREF(__pyx_t_1);
2080 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_info, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
2081 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2083 /* "MACS2/PeakDetect.pyx":43
2084 * self.opt = opt
2085 * self.info = opt.info
2086 * self.debug = opt.debug # <<<<<<<<<<<<<<
2087 * self.warn = opt.warn
2090 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
2091 __Pyx_GOTREF(__pyx_t_1);
2092 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_debug, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
2093 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2095 /* "MACS2/PeakDetect.pyx":44
2096 * self.info = opt.info
2097 * self.debug = opt.debug
2098 * self.warn = opt.warn # <<<<<<<<<<<<<<
2100 * self.treat = treat
2102 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
2103 __Pyx_GOTREF(__pyx_t_1);
2104 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_warn, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
2105 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2107 /* "MACS2/PeakDetect.pyx":46
2108 * self.warn = opt.warn
2110 * self.treat = treat # <<<<<<<<<<<<<<
2111 * self.control = control
2112 * self.ratio_treat2control = None
2114 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_treat, __pyx_v_treat) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
2116 /* "MACS2/PeakDetect.pyx":47
2118 * self.treat = treat
2119 * self.control = control # <<<<<<<<<<<<<<
2120 * self.ratio_treat2control = None
2121 * self.peaks = None
2123 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_control, __pyx_v_control) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
2125 /* "MACS2/PeakDetect.pyx":48
2126 * self.treat = treat
2127 * self.control = control
2128 * self.ratio_treat2control = None # <<<<<<<<<<<<<<
2129 * self.peaks = None
2130 * self.final_peaks = None
2132 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control, Py_None) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
2134 /* "MACS2/PeakDetect.pyx":49
2135 * self.control = control
2136 * self.ratio_treat2control = None
2137 * self.peaks = None # <<<<<<<<<<<<<<
2138 * self.final_peaks = None
2139 * self.PE_MODE = opt.PE_MODE
2141 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_peaks, Py_None) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
2143 /* "MACS2/PeakDetect.pyx":50
2144 * self.ratio_treat2control = None
2145 * self.peaks = None
2146 * self.final_peaks = None # <<<<<<<<<<<<<<
2147 * self.PE_MODE = opt.PE_MODE
2148 * self.scoretrack = None
2150 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_final_peaks, Py_None) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
2152 /* "MACS2/PeakDetect.pyx":51
2153 * self.peaks = None
2154 * self.final_peaks = None
2155 * self.PE_MODE = opt.PE_MODE # <<<<<<<<<<<<<<
2156 * self.scoretrack = None
2159 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_PE_MODE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
2160 __Pyx_GOTREF(__pyx_t_1);
2161 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_PE_MODE, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
2162 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2164 /* "MACS2/PeakDetect.pyx":52
2165 * self.final_peaks = None
2166 * self.PE_MODE = opt.PE_MODE
2167 * self.scoretrack = None # <<<<<<<<<<<<<<
2169 * #self.femax = opt.femax
2171 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scoretrack, Py_None) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
2173 /* "MACS2/PeakDetect.pyx":58
2174 * #self.festep = opt.festep
2176 * self.log_pvalue = opt.log_pvalue # -log10pvalue # <<<<<<<<<<<<<<
2177 * self.log_qvalue = opt.log_qvalue # -log10qvalue
2178 * if d != None:
2180 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
2181 __Pyx_GOTREF(__pyx_t_1);
2182 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
2183 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2185 /* "MACS2/PeakDetect.pyx":59
2187 * self.log_pvalue = opt.log_pvalue # -log10pvalue
2188 * self.log_qvalue = opt.log_qvalue # -log10qvalue # <<<<<<<<<<<<<<
2189 * if d != None:
2190 * self.d = d
2192 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
2193 __Pyx_GOTREF(__pyx_t_1);
2194 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue, __pyx_t_1) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
2195 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2197 /* "MACS2/PeakDetect.pyx":60
2198 * self.log_pvalue = opt.log_pvalue # -log10pvalue
2199 * self.log_qvalue = opt.log_qvalue # -log10qvalue
2200 * if d != None: # <<<<<<<<<<<<<<
2201 * self.d = d
2202 * else:
2204 __pyx_t_1 = PyObject_RichCompare(__pyx_v_d, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
2205 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 60, __pyx_L1_error)
2206 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2207 if (__pyx_t_2) {
2209 /* "MACS2/PeakDetect.pyx":61
2210 * self.log_qvalue = opt.log_qvalue # -log10qvalue
2211 * if d != None:
2212 * self.d = d # <<<<<<<<<<<<<<
2213 * else:
2214 * self.d = self.opt.d
2216 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_d, __pyx_v_d) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
2218 /* "MACS2/PeakDetect.pyx":60
2219 * self.log_pvalue = opt.log_pvalue # -log10pvalue
2220 * self.log_qvalue = opt.log_qvalue # -log10qvalue
2221 * if d != None: # <<<<<<<<<<<<<<
2222 * self.d = d
2223 * else:
2225 goto __pyx_L3;
2228 /* "MACS2/PeakDetect.pyx":63
2229 * self.d = d
2230 * else:
2231 * self.d = self.opt.d # <<<<<<<<<<<<<<
2233 * if opt.maxgap:
2235 /*else*/ {
2236 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
2237 __Pyx_GOTREF(__pyx_t_1);
2238 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
2239 __Pyx_GOTREF(__pyx_t_3);
2240 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2241 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_d, __pyx_t_3) < 0) __PYX_ERR(0, 63, __pyx_L1_error)
2242 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2244 __pyx_L3:;
2246 /* "MACS2/PeakDetect.pyx":65
2247 * self.d = self.opt.d
2249 * if opt.maxgap: # <<<<<<<<<<<<<<
2250 * self.maxgap = opt.maxgap
2251 * else:
2253 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
2254 __Pyx_GOTREF(__pyx_t_3);
2255 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 65, __pyx_L1_error)
2256 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2257 if (__pyx_t_2) {
2259 /* "MACS2/PeakDetect.pyx":66
2261 * if opt.maxgap:
2262 * self.maxgap = opt.maxgap # <<<<<<<<<<<<<<
2263 * else:
2264 * self.maxgap = opt.tsize
2266 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
2267 __Pyx_GOTREF(__pyx_t_3);
2268 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_maxgap, __pyx_t_3) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
2269 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2271 /* "MACS2/PeakDetect.pyx":65
2272 * self.d = self.opt.d
2274 * if opt.maxgap: # <<<<<<<<<<<<<<
2275 * self.maxgap = opt.maxgap
2276 * else:
2278 goto __pyx_L4;
2281 /* "MACS2/PeakDetect.pyx":68
2282 * self.maxgap = opt.maxgap
2283 * else:
2284 * self.maxgap = opt.tsize # <<<<<<<<<<<<<<
2286 * if opt.minlen:
2288 /*else*/ {
2289 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_tsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
2290 __Pyx_GOTREF(__pyx_t_3);
2291 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_maxgap, __pyx_t_3) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
2292 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2294 __pyx_L4:;
2296 /* "MACS2/PeakDetect.pyx":70
2297 * self.maxgap = opt.tsize
2299 * if opt.minlen: # <<<<<<<<<<<<<<
2300 * self.minlen = opt.minlen
2301 * else:
2303 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_minlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
2304 __Pyx_GOTREF(__pyx_t_3);
2305 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 70, __pyx_L1_error)
2306 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2307 if (__pyx_t_2) {
2309 /* "MACS2/PeakDetect.pyx":71
2311 * if opt.minlen:
2312 * self.minlen = opt.minlen # <<<<<<<<<<<<<<
2313 * else:
2314 * self.minlen = self.d
2316 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_minlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
2317 __Pyx_GOTREF(__pyx_t_3);
2318 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_minlen, __pyx_t_3) < 0) __PYX_ERR(0, 71, __pyx_L1_error)
2319 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2321 /* "MACS2/PeakDetect.pyx":70
2322 * self.maxgap = opt.tsize
2324 * if opt.minlen: # <<<<<<<<<<<<<<
2325 * self.minlen = opt.minlen
2326 * else:
2328 goto __pyx_L5;
2331 /* "MACS2/PeakDetect.pyx":73
2332 * self.minlen = opt.minlen
2333 * else:
2334 * self.minlen = self.d # <<<<<<<<<<<<<<
2336 * self.end_shift = self.opt.shift
2338 /*else*/ {
2339 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
2340 __Pyx_GOTREF(__pyx_t_3);
2341 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_minlen, __pyx_t_3) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
2342 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2344 __pyx_L5:;
2346 /* "MACS2/PeakDetect.pyx":75
2347 * self.minlen = self.d
2349 * self.end_shift = self.opt.shift # <<<<<<<<<<<<<<
2350 * self.gsize = opt.gsize
2353 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
2354 __Pyx_GOTREF(__pyx_t_3);
2355 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shift); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
2356 __Pyx_GOTREF(__pyx_t_1);
2357 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2358 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_end_shift, __pyx_t_1) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
2359 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2361 /* "MACS2/PeakDetect.pyx":76
2363 * self.end_shift = self.opt.shift
2364 * self.gsize = opt.gsize # <<<<<<<<<<<<<<
2366 * self.nolambda = opt.nolambda
2368 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_gsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
2369 __Pyx_GOTREF(__pyx_t_1);
2370 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_gsize, __pyx_t_1) < 0) __PYX_ERR(0, 76, __pyx_L1_error)
2371 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2373 /* "MACS2/PeakDetect.pyx":78
2374 * self.gsize = opt.gsize
2376 * self.nolambda = opt.nolambda # <<<<<<<<<<<<<<
2378 * if slocal != None:
2380 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_nolambda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
2381 __Pyx_GOTREF(__pyx_t_1);
2382 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nolambda, __pyx_t_1) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
2383 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2385 /* "MACS2/PeakDetect.pyx":80
2386 * self.nolambda = opt.nolambda
2388 * if slocal != None: # <<<<<<<<<<<<<<
2389 * self.sregion = slocal
2390 * else:
2392 __pyx_t_1 = PyObject_RichCompare(__pyx_v_slocal, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
2393 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 80, __pyx_L1_error)
2394 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2395 if (__pyx_t_2) {
2397 /* "MACS2/PeakDetect.pyx":81
2399 * if slocal != None:
2400 * self.sregion = slocal # <<<<<<<<<<<<<<
2401 * else:
2402 * self.sregion = opt.smalllocal
2404 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sregion, __pyx_v_slocal) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
2406 /* "MACS2/PeakDetect.pyx":80
2407 * self.nolambda = opt.nolambda
2409 * if slocal != None: # <<<<<<<<<<<<<<
2410 * self.sregion = slocal
2411 * else:
2413 goto __pyx_L6;
2416 /* "MACS2/PeakDetect.pyx":83
2417 * self.sregion = slocal
2418 * else:
2419 * self.sregion = opt.smalllocal # <<<<<<<<<<<<<<
2421 * if llocal != None:
2423 /*else*/ {
2424 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_smalllocal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2425 __Pyx_GOTREF(__pyx_t_1);
2426 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sregion, __pyx_t_1) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
2427 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2429 __pyx_L6:;
2431 /* "MACS2/PeakDetect.pyx":85
2432 * self.sregion = opt.smalllocal
2434 * if llocal != None: # <<<<<<<<<<<<<<
2435 * self.lregion = llocal
2436 * else:
2438 __pyx_t_1 = PyObject_RichCompare(__pyx_v_llocal, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
2439 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 85, __pyx_L1_error)
2440 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2441 if (__pyx_t_2) {
2443 /* "MACS2/PeakDetect.pyx":86
2445 * if llocal != None:
2446 * self.lregion = llocal # <<<<<<<<<<<<<<
2447 * else:
2448 * self.lregion = opt.largelocal
2450 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lregion, __pyx_v_llocal) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
2452 /* "MACS2/PeakDetect.pyx":85
2453 * self.sregion = opt.smalllocal
2455 * if llocal != None: # <<<<<<<<<<<<<<
2456 * self.lregion = llocal
2457 * else:
2459 goto __pyx_L7;
2462 /* "MACS2/PeakDetect.pyx":88
2463 * self.lregion = llocal
2464 * else:
2465 * self.lregion = opt.largelocal # <<<<<<<<<<<<<<
2467 * if (self.nolambda):
2469 /*else*/ {
2470 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_opt, __pyx_n_s_largelocal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
2471 __Pyx_GOTREF(__pyx_t_1);
2472 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lregion, __pyx_t_1) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
2473 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2475 __pyx_L7:;
2477 /* "MACS2/PeakDetect.pyx":90
2478 * self.lregion = opt.largelocal
2480 * if (self.nolambda): # <<<<<<<<<<<<<<
2481 * self.info("#3 !!!! DYNAMIC LAMBDA IS DISABLED !!!!")
2482 * #self.diag = opt.diag
2484 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nolambda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
2485 __Pyx_GOTREF(__pyx_t_1);
2486 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
2487 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2488 if (__pyx_t_2) {
2490 /* "MACS2/PeakDetect.pyx":91
2492 * if (self.nolambda):
2493 * self.info("#3 !!!! DYNAMIC LAMBDA IS DISABLED !!!!") # <<<<<<<<<<<<<<
2494 * #self.diag = opt.diag
2495 * #self.save_score = opt.store_score
2497 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
2498 __Pyx_GOTREF(__pyx_t_3);
2499 __pyx_t_4 = NULL;
2500 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2501 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2502 if (likely(__pyx_t_4)) {
2503 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2504 __Pyx_INCREF(__pyx_t_4);
2505 __Pyx_INCREF(function);
2506 __Pyx_DECREF_SET(__pyx_t_3, function);
2509 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_u_3_DYNAMIC_LAMBDA_IS_DISABLED) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_3_DYNAMIC_LAMBDA_IS_DISABLED);
2510 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2511 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
2512 __Pyx_GOTREF(__pyx_t_1);
2513 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2514 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2516 /* "MACS2/PeakDetect.pyx":90
2517 * self.lregion = opt.largelocal
2519 * if (self.nolambda): # <<<<<<<<<<<<<<
2520 * self.info("#3 !!!! DYNAMIC LAMBDA IS DISABLED !!!!")
2521 * #self.diag = opt.diag
2525 /* "MACS2/PeakDetect.pyx":36
2526 * >>> pd.call_peaks()
2527 * """
2528 * def __init__ (self,opt = None,treat = None, control = None, d = None, # <<<<<<<<<<<<<<
2529 * maxgap = None, minlen = None, slocal = None, llocal = None):
2530 * """Initialize the PeakDetect object.
2533 /* function exit code */
2534 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2535 goto __pyx_L0;
2536 __pyx_L1_error:;
2537 __Pyx_XDECREF(__pyx_t_1);
2538 __Pyx_XDECREF(__pyx_t_3);
2539 __Pyx_XDECREF(__pyx_t_4);
2540 __Pyx_AddTraceback("MACS2.PeakDetect.PeakDetect.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2541 __pyx_r = NULL;
2542 __pyx_L0:;
2543 __Pyx_XGIVEREF(__pyx_r);
2544 __Pyx_TraceReturn(__pyx_r, 0);
2545 __Pyx_RefNannyFinishContext();
2546 return __pyx_r;
2549 /* "MACS2/PeakDetect.pyx":97
2550 * #self.zwig_ctl= opt.zwig_ctl
2552 * def call_peaks (self): # <<<<<<<<<<<<<<
2553 * """Call peaks function.
2557 /* Python wrapper */
2558 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_3call_peaks(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2559 static char __pyx_doc_5MACS2_10PeakDetect_10PeakDetect_2call_peaks[] = "Call peaks function.\n\n Scan the whole genome for peaks. RESULTS WILL BE SAVED IN\n self.final_peaks and self.final_negative_peaks.\n ";
2560 static PyMethodDef __pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_3call_peaks = {"call_peaks", (PyCFunction)__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_3call_peaks, METH_O, __pyx_doc_5MACS2_10PeakDetect_10PeakDetect_2call_peaks};
2561 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_3call_peaks(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2562 PyObject *__pyx_r = 0;
2563 __Pyx_RefNannyDeclarations
2564 __Pyx_RefNannySetupContext("call_peaks (wrapper)", 0);
2565 __pyx_r = __pyx_pf_5MACS2_10PeakDetect_10PeakDetect_2call_peaks(__pyx_self, ((PyObject *)__pyx_v_self));
2567 /* function exit code */
2568 __Pyx_RefNannyFinishContext();
2569 return __pyx_r;
2572 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect_2call_peaks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
2573 PyObject *__pyx_r = NULL;
2574 __Pyx_TraceDeclarations
2575 __Pyx_RefNannyDeclarations
2576 PyObject *__pyx_t_1 = NULL;
2577 int __pyx_t_2;
2578 PyObject *__pyx_t_3 = NULL;
2579 PyObject *__pyx_t_4 = NULL;
2580 __Pyx_TraceFrameInit(__pyx_codeobj__2)
2581 __Pyx_RefNannySetupContext("call_peaks", 0);
2582 __Pyx_TraceCall("call_peaks", __pyx_f[0], 97, 0, __PYX_ERR(0, 97, __pyx_L1_error));
2584 /* "MACS2/PeakDetect.pyx":103
2585 * self.final_peaks and self.final_negative_peaks.
2586 * """
2587 * if self.control: # w/ control # <<<<<<<<<<<<<<
2588 * #if self.opt.broad:
2589 * # (self.peaks,self.broadpeaks) = self.__call_peaks_w_control()
2591 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
2592 __Pyx_GOTREF(__pyx_t_1);
2593 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 103, __pyx_L1_error)
2594 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2595 if (__pyx_t_2) {
2597 /* "MACS2/PeakDetect.pyx":107
2598 * # (self.peaks,self.broadpeaks) = self.__call_peaks_w_control()
2599 * #else:
2600 * self.peaks = self.__call_peaks_w_control () # <<<<<<<<<<<<<<
2601 * else: # w/o control
2602 * #if self.opt.broad:
2604 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PeakDetect__call_peaks_w_contro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
2605 __Pyx_GOTREF(__pyx_t_3);
2606 __pyx_t_4 = NULL;
2607 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2608 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2609 if (likely(__pyx_t_4)) {
2610 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2611 __Pyx_INCREF(__pyx_t_4);
2612 __Pyx_INCREF(function);
2613 __Pyx_DECREF_SET(__pyx_t_3, function);
2616 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
2617 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2618 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
2619 __Pyx_GOTREF(__pyx_t_1);
2620 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2621 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_peaks, __pyx_t_1) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
2622 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2624 /* "MACS2/PeakDetect.pyx":103
2625 * self.final_peaks and self.final_negative_peaks.
2626 * """
2627 * if self.control: # w/ control # <<<<<<<<<<<<<<
2628 * #if self.opt.broad:
2629 * # (self.peaks,self.broadpeaks) = self.__call_peaks_w_control()
2631 goto __pyx_L3;
2634 /* "MACS2/PeakDetect.pyx":112
2635 * # (self.peaks,self.broadpeaks) = self.__call_peaks_wo_control()
2636 * #else:
2637 * self.peaks = self.__call_peaks_wo_control () # <<<<<<<<<<<<<<
2638 * return self.peaks
2641 /*else*/ {
2642 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PeakDetect__call_peaks_wo_contr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
2643 __Pyx_GOTREF(__pyx_t_3);
2644 __pyx_t_4 = NULL;
2645 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2646 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2647 if (likely(__pyx_t_4)) {
2648 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2649 __Pyx_INCREF(__pyx_t_4);
2650 __Pyx_INCREF(function);
2651 __Pyx_DECREF_SET(__pyx_t_3, function);
2654 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
2655 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2656 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
2657 __Pyx_GOTREF(__pyx_t_1);
2658 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2659 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_peaks, __pyx_t_1) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
2660 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2662 __pyx_L3:;
2664 /* "MACS2/PeakDetect.pyx":113
2665 * #else:
2666 * self.peaks = self.__call_peaks_wo_control ()
2667 * return self.peaks # <<<<<<<<<<<<<<
2669 * def __call_peaks_w_control (self):
2671 __Pyx_XDECREF(__pyx_r);
2672 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_peaks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
2673 __Pyx_GOTREF(__pyx_t_1);
2674 __pyx_r = __pyx_t_1;
2675 __pyx_t_1 = 0;
2676 goto __pyx_L0;
2678 /* "MACS2/PeakDetect.pyx":97
2679 * #self.zwig_ctl= opt.zwig_ctl
2681 * def call_peaks (self): # <<<<<<<<<<<<<<
2682 * """Call peaks function.
2686 /* function exit code */
2687 __pyx_L1_error:;
2688 __Pyx_XDECREF(__pyx_t_1);
2689 __Pyx_XDECREF(__pyx_t_3);
2690 __Pyx_XDECREF(__pyx_t_4);
2691 __Pyx_AddTraceback("MACS2.PeakDetect.PeakDetect.call_peaks", __pyx_clineno, __pyx_lineno, __pyx_filename);
2692 __pyx_r = NULL;
2693 __pyx_L0:;
2694 __Pyx_XGIVEREF(__pyx_r);
2695 __Pyx_TraceReturn(__pyx_r, 0);
2696 __Pyx_RefNannyFinishContext();
2697 return __pyx_r;
2700 /* "MACS2/PeakDetect.pyx":115
2701 * return self.peaks
2703 * def __call_peaks_w_control (self): # <<<<<<<<<<<<<<
2704 * """To call peaks with control data.
2708 /* Python wrapper */
2709 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_5__call_peaks_w_control(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2710 static char __pyx_doc_5MACS2_10PeakDetect_10PeakDetect_4__call_peaks_w_control[] = "To call peaks with control data.\n\n A peak info type is a: dictionary\n\n key value: chromosome\n\n items: (peak start,peak end, peak length, peak summit, peak\n height, number of tags in peak region, peak pvalue, peak\n fold_enrichment) <-- tuple type\n\n While calculating pvalue:\n\n First, t and c will be adjusted by the ratio between total\n reads in treatment and total reads in control, depending on\n --to-small option.\n\n Then, t and c will be multiplied by the smallest peak size --\n self.d.\n\n Finally, a poisson CDF is applied to calculate one-side pvalue\n for enrichment.\n ";
2711 static PyMethodDef __pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_5__call_peaks_w_control = {"__call_peaks_w_control", (PyCFunction)__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_5__call_peaks_w_control, METH_O, __pyx_doc_5MACS2_10PeakDetect_10PeakDetect_4__call_peaks_w_control};
2712 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_5__call_peaks_w_control(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2713 PyObject *__pyx_r = 0;
2714 __Pyx_RefNannyDeclarations
2715 __Pyx_RefNannySetupContext("__call_peaks_w_control (wrapper)", 0);
2716 __pyx_r = __pyx_pf_5MACS2_10PeakDetect_10PeakDetect_4__call_peaks_w_control(__pyx_self, ((PyObject *)__pyx_v_self));
2718 /* function exit code */
2719 __Pyx_RefNannyFinishContext();
2720 return __pyx_r;
2723 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect_4__call_peaks_w_control(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
2724 float __pyx_v_lambda_bg;
2725 CYTHON_UNUSED float __pyx_v_effective_depth_in_million;
2726 float __pyx_v_treat_scale;
2727 float __pyx_v_d;
2728 PyObject *__pyx_v_ctrl_scale_s = 0;
2729 PyObject *__pyx_v_ctrl_d_s = 0;
2730 long __pyx_v_treat_total;
2731 long __pyx_v_control_total;
2732 long __pyx_v_treat_sum;
2733 long __pyx_v_control_sum;
2734 PyObject *__pyx_v_tmp_v = NULL;
2735 PyObject *__pyx_v_scorecalculator = NULL;
2736 PyObject *__pyx_v_call_summits = NULL;
2737 PyObject *__pyx_v_peaks = NULL;
2738 PyObject *__pyx_r = NULL;
2739 __Pyx_TraceDeclarations
2740 __Pyx_RefNannyDeclarations
2741 PyObject *__pyx_t_1 = NULL;
2742 PyObject *__pyx_t_2 = NULL;
2743 long __pyx_t_3;
2744 int __pyx_t_4;
2745 float __pyx_t_5;
2746 PyObject *__pyx_t_6 = NULL;
2747 int __pyx_t_7;
2748 int __pyx_t_8;
2749 PyObject *__pyx_t_9 = NULL;
2750 PyObject *__pyx_t_10 = NULL;
2751 Py_ssize_t __pyx_t_11;
2752 Py_UCS4 __pyx_t_12;
2753 __Pyx_TraceFrameInit(__pyx_codeobj__3)
2754 __Pyx_RefNannySetupContext("__call_peaks_w_control", 0);
2755 __Pyx_TraceCall("__call_peaks_w_control", __pyx_f[0], 115, 0, __PYX_ERR(0, 115, __pyx_L1_error));
2757 /* "MACS2/PeakDetect.pyx":147
2758 * long control_sum # approx sum of control pileup values
2760 * treat_total = self.treat.total # <<<<<<<<<<<<<<
2762 * if self.PE_MODE:
2764 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
2765 __Pyx_GOTREF(__pyx_t_1);
2766 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_total); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
2767 __Pyx_GOTREF(__pyx_t_2);
2768 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2769 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error)
2770 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2771 __pyx_v_treat_total = __pyx_t_3;
2773 /* "MACS2/PeakDetect.pyx":149
2774 * treat_total = self.treat.total
2776 * if self.PE_MODE: # <<<<<<<<<<<<<<
2777 * d = self.treat.average_template_length
2778 * control_total = self.control.total * 2 # in PE mode, entire fragment is counted as 1
2780 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PE_MODE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
2781 __Pyx_GOTREF(__pyx_t_2);
2782 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 149, __pyx_L1_error)
2783 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2784 if (__pyx_t_4) {
2786 /* "MACS2/PeakDetect.pyx":150
2788 * if self.PE_MODE:
2789 * d = self.treat.average_template_length # <<<<<<<<<<<<<<
2790 * control_total = self.control.total * 2 # in PE mode, entire fragment is counted as 1
2791 * # in treatment whereas both ends of fragment are counted in control/input.
2793 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
2794 __Pyx_GOTREF(__pyx_t_2);
2795 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_average_template_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
2796 __Pyx_GOTREF(__pyx_t_1);
2797 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2798 __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error)
2799 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2800 __pyx_v_d = __pyx_t_5;
2802 /* "MACS2/PeakDetect.pyx":151
2803 * if self.PE_MODE:
2804 * d = self.treat.average_template_length
2805 * control_total = self.control.total * 2 # in PE mode, entire fragment is counted as 1 # <<<<<<<<<<<<<<
2806 * # in treatment whereas both ends of fragment are counted in control/input.
2807 * treat_sum = self.treat.length
2809 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
2810 __Pyx_GOTREF(__pyx_t_1);
2811 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_total); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
2812 __Pyx_GOTREF(__pyx_t_2);
2813 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2814 __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_int_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
2815 __Pyx_GOTREF(__pyx_t_1);
2816 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2817 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error)
2818 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2819 __pyx_v_control_total = __pyx_t_3;
2821 /* "MACS2/PeakDetect.pyx":153
2822 * control_total = self.control.total * 2 # in PE mode, entire fragment is counted as 1
2823 * # in treatment whereas both ends of fragment are counted in control/input.
2824 * treat_sum = self.treat.length # <<<<<<<<<<<<<<
2825 * control_sum = control_total * self.treat.average_template_length
2826 * self.ratio_treat2control = float(treat_sum)/control_sum
2828 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
2829 __Pyx_GOTREF(__pyx_t_1);
2830 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
2831 __Pyx_GOTREF(__pyx_t_2);
2832 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2833 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error)
2834 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2835 __pyx_v_treat_sum = __pyx_t_3;
2837 /* "MACS2/PeakDetect.pyx":154
2838 * # in treatment whereas both ends of fragment are counted in control/input.
2839 * treat_sum = self.treat.length
2840 * control_sum = control_total * self.treat.average_template_length # <<<<<<<<<<<<<<
2841 * self.ratio_treat2control = float(treat_sum)/control_sum
2842 * else:
2844 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_control_total); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
2845 __Pyx_GOTREF(__pyx_t_2);
2846 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
2847 __Pyx_GOTREF(__pyx_t_1);
2848 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_average_template_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
2849 __Pyx_GOTREF(__pyx_t_6);
2850 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2851 __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
2852 __Pyx_GOTREF(__pyx_t_1);
2853 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2854 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2855 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error)
2856 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2857 __pyx_v_control_sum = __pyx_t_3;
2859 /* "MACS2/PeakDetect.pyx":155
2860 * treat_sum = self.treat.length
2861 * control_sum = control_total * self.treat.average_template_length
2862 * self.ratio_treat2control = float(treat_sum)/control_sum # <<<<<<<<<<<<<<
2863 * else:
2864 * d = self.d
2866 if (unlikely(__pyx_v_control_sum == 0)) {
2867 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
2868 __PYX_ERR(0, 155, __pyx_L1_error)
2870 __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_v_treat_sum) / ((double)__pyx_v_control_sum))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
2871 __Pyx_GOTREF(__pyx_t_1);
2872 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control, __pyx_t_1) < 0) __PYX_ERR(0, 155, __pyx_L1_error)
2873 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2875 /* "MACS2/PeakDetect.pyx":149
2876 * treat_total = self.treat.total
2878 * if self.PE_MODE: # <<<<<<<<<<<<<<
2879 * d = self.treat.average_template_length
2880 * control_total = self.control.total * 2 # in PE mode, entire fragment is counted as 1
2882 goto __pyx_L3;
2885 /* "MACS2/PeakDetect.pyx":157
2886 * self.ratio_treat2control = float(treat_sum)/control_sum
2887 * else:
2888 * d = self.d # <<<<<<<<<<<<<<
2889 * control_total = self.control.total
2890 * treat_sum = self.treat.total * self.d
2892 /*else*/ {
2893 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
2894 __Pyx_GOTREF(__pyx_t_1);
2895 __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
2896 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2897 __pyx_v_d = __pyx_t_5;
2899 /* "MACS2/PeakDetect.pyx":158
2900 * else:
2901 * d = self.d
2902 * control_total = self.control.total # <<<<<<<<<<<<<<
2903 * treat_sum = self.treat.total * self.d
2904 * control_sum = self.control.total * self.d
2906 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
2907 __Pyx_GOTREF(__pyx_t_1);
2908 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_total); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error)
2909 __Pyx_GOTREF(__pyx_t_6);
2910 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2911 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error)
2912 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2913 __pyx_v_control_total = __pyx_t_3;
2915 /* "MACS2/PeakDetect.pyx":159
2916 * d = self.d
2917 * control_total = self.control.total
2918 * treat_sum = self.treat.total * self.d # <<<<<<<<<<<<<<
2919 * control_sum = self.control.total * self.d
2920 * self.ratio_treat2control = float(treat_sum)/control_sum
2922 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 159, __pyx_L1_error)
2923 __Pyx_GOTREF(__pyx_t_6);
2924 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_total); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
2925 __Pyx_GOTREF(__pyx_t_1);
2926 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2927 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 159, __pyx_L1_error)
2928 __Pyx_GOTREF(__pyx_t_6);
2929 __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error)
2930 __Pyx_GOTREF(__pyx_t_2);
2931 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2932 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2933 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error)
2934 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2935 __pyx_v_treat_sum = __pyx_t_3;
2937 /* "MACS2/PeakDetect.pyx":160
2938 * control_total = self.control.total
2939 * treat_sum = self.treat.total * self.d
2940 * control_sum = self.control.total * self.d # <<<<<<<<<<<<<<
2941 * self.ratio_treat2control = float(treat_sum)/control_sum
2944 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
2945 __Pyx_GOTREF(__pyx_t_2);
2946 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_total); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L1_error)
2947 __Pyx_GOTREF(__pyx_t_6);
2948 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2949 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
2950 __Pyx_GOTREF(__pyx_t_2);
2951 __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
2952 __Pyx_GOTREF(__pyx_t_1);
2953 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2954 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2955 __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
2956 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2957 __pyx_v_control_sum = __pyx_t_3;
2959 /* "MACS2/PeakDetect.pyx":161
2960 * treat_sum = self.treat.total * self.d
2961 * control_sum = self.control.total * self.d
2962 * self.ratio_treat2control = float(treat_sum)/control_sum # <<<<<<<<<<<<<<
2964 * if self.opt.ratio != 1.0:
2966 if (unlikely(__pyx_v_control_sum == 0)) {
2967 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
2968 __PYX_ERR(0, 161, __pyx_L1_error)
2970 __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_v_treat_sum) / ((double)__pyx_v_control_sum))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
2971 __Pyx_GOTREF(__pyx_t_1);
2972 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control, __pyx_t_1) < 0) __PYX_ERR(0, 161, __pyx_L1_error)
2973 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2975 __pyx_L3:;
2977 /* "MACS2/PeakDetect.pyx":163
2978 * self.ratio_treat2control = float(treat_sum)/control_sum
2980 * if self.opt.ratio != 1.0: # <<<<<<<<<<<<<<
2981 * self.ratio_treat2control = self.opt.ratio
2984 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2985 __Pyx_GOTREF(__pyx_t_1);
2986 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
2987 __Pyx_GOTREF(__pyx_t_2);
2988 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2989 __pyx_t_1 = __Pyx_PyFloat_NeObjC(__pyx_t_2, __pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2990 __Pyx_GOTREF(__pyx_t_1);
2991 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2992 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
2993 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2994 if (__pyx_t_4) {
2996 /* "MACS2/PeakDetect.pyx":164
2998 * if self.opt.ratio != 1.0:
2999 * self.ratio_treat2control = self.opt.ratio # <<<<<<<<<<<<<<
3001 * if self.opt.tocontrol:
3003 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error)
3004 __Pyx_GOTREF(__pyx_t_1);
3005 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ratio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
3006 __Pyx_GOTREF(__pyx_t_2);
3007 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3008 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control, __pyx_t_2) < 0) __PYX_ERR(0, 164, __pyx_L1_error)
3009 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3011 /* "MACS2/PeakDetect.pyx":163
3012 * self.ratio_treat2control = float(treat_sum)/control_sum
3014 * if self.opt.ratio != 1.0: # <<<<<<<<<<<<<<
3015 * self.ratio_treat2control = self.opt.ratio
3020 /* "MACS2/PeakDetect.pyx":166
3021 * self.ratio_treat2control = self.opt.ratio
3023 * if self.opt.tocontrol: # <<<<<<<<<<<<<<
3024 * # if MACS decides to scale treatment to control data because treatment is bigger
3025 * effective_depth_in_million = control_total / 1000000.0
3027 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
3028 __Pyx_GOTREF(__pyx_t_2);
3029 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tocontrol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
3030 __Pyx_GOTREF(__pyx_t_1);
3031 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3032 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 166, __pyx_L1_error)
3033 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3034 if (__pyx_t_4) {
3036 /* "MACS2/PeakDetect.pyx":168
3037 * if self.opt.tocontrol:
3038 * # if MACS decides to scale treatment to control data because treatment is bigger
3039 * effective_depth_in_million = control_total / 1000000.0 # <<<<<<<<<<<<<<
3040 * lambda_bg = float( control_sum )/ self.gsize
3041 * treat_scale = 1/self.ratio_treat2control
3043 __pyx_v_effective_depth_in_million = (((double)__pyx_v_control_total) / 1000000.0);
3045 /* "MACS2/PeakDetect.pyx":169
3046 * # if MACS decides to scale treatment to control data because treatment is bigger
3047 * effective_depth_in_million = control_total / 1000000.0
3048 * lambda_bg = float( control_sum )/ self.gsize # <<<<<<<<<<<<<<
3049 * treat_scale = 1/self.ratio_treat2control
3050 * else:
3052 __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_control_sum)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
3053 __Pyx_GOTREF(__pyx_t_1);
3054 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error)
3055 __Pyx_GOTREF(__pyx_t_2);
3056 __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
3057 __Pyx_GOTREF(__pyx_t_6);
3058 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3059 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3060 __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error)
3061 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3062 __pyx_v_lambda_bg = __pyx_t_5;
3064 /* "MACS2/PeakDetect.pyx":170
3065 * effective_depth_in_million = control_total / 1000000.0
3066 * lambda_bg = float( control_sum )/ self.gsize
3067 * treat_scale = 1/self.ratio_treat2control # <<<<<<<<<<<<<<
3068 * else:
3069 * # if MACS decides to scale control to treatment because control sample is bigger
3071 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error)
3072 __Pyx_GOTREF(__pyx_t_6);
3073 __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error)
3074 __Pyx_GOTREF(__pyx_t_2);
3075 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3076 __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
3077 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3078 __pyx_v_treat_scale = __pyx_t_5;
3080 /* "MACS2/PeakDetect.pyx":166
3081 * self.ratio_treat2control = self.opt.ratio
3083 * if self.opt.tocontrol: # <<<<<<<<<<<<<<
3084 * # if MACS decides to scale treatment to control data because treatment is bigger
3085 * effective_depth_in_million = control_total / 1000000.0
3087 goto __pyx_L5;
3090 /* "MACS2/PeakDetect.pyx":173
3091 * else:
3092 * # if MACS decides to scale control to treatment because control sample is bigger
3093 * effective_depth_in_million = treat_total / 1000000.0 # <<<<<<<<<<<<<<
3094 * lambda_bg = float( treat_sum )/ self.gsize
3095 * treat_scale = 1.0
3097 /*else*/ {
3098 __pyx_v_effective_depth_in_million = (((double)__pyx_v_treat_total) / 1000000.0);
3100 /* "MACS2/PeakDetect.pyx":174
3101 * # if MACS decides to scale control to treatment because control sample is bigger
3102 * effective_depth_in_million = treat_total / 1000000.0
3103 * lambda_bg = float( treat_sum )/ self.gsize # <<<<<<<<<<<<<<
3104 * treat_scale = 1.0
3107 __pyx_t_2 = PyFloat_FromDouble(((double)__pyx_v_treat_sum)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
3108 __Pyx_GOTREF(__pyx_t_2);
3109 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error)
3110 __Pyx_GOTREF(__pyx_t_6);
3111 __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
3112 __Pyx_GOTREF(__pyx_t_1);
3113 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3114 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3115 __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error)
3116 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3117 __pyx_v_lambda_bg = __pyx_t_5;
3119 /* "MACS2/PeakDetect.pyx":175
3120 * effective_depth_in_million = treat_total / 1000000.0
3121 * lambda_bg = float( treat_sum )/ self.gsize
3122 * treat_scale = 1.0 # <<<<<<<<<<<<<<
3124 * # prepare d_s for control data
3126 __pyx_v_treat_scale = 1.0;
3128 __pyx_L5:;
3130 /* "MACS2/PeakDetect.pyx":178
3132 * # prepare d_s for control data
3133 * if self.sregion: # <<<<<<<<<<<<<<
3134 * assert self.d <= self.sregion, "slocal can't be smaller than d!"
3135 * if self.lregion:
3137 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
3138 __Pyx_GOTREF(__pyx_t_1);
3139 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
3140 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3141 if (__pyx_t_4) {
3143 /* "MACS2/PeakDetect.pyx":179
3144 * # prepare d_s for control data
3145 * if self.sregion:
3146 * assert self.d <= self.sregion, "slocal can't be smaller than d!" # <<<<<<<<<<<<<<
3147 * if self.lregion:
3148 * assert self.d <= self.lregion , "llocal can't be smaller than d!"
3150 #ifndef CYTHON_WITHOUT_ASSERTIONS
3151 if (unlikely(!Py_OptimizeFlag)) {
3152 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
3153 __Pyx_GOTREF(__pyx_t_1);
3154 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 179, __pyx_L1_error)
3155 __Pyx_GOTREF(__pyx_t_6);
3156 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
3157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3158 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3159 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 179, __pyx_L1_error)
3160 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3161 if (unlikely(!__pyx_t_4)) {
3162 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_slocal_can_t_be_smaller_than_d);
3163 __PYX_ERR(0, 179, __pyx_L1_error)
3166 #endif
3168 /* "MACS2/PeakDetect.pyx":178
3170 * # prepare d_s for control data
3171 * if self.sregion: # <<<<<<<<<<<<<<
3172 * assert self.d <= self.sregion, "slocal can't be smaller than d!"
3173 * if self.lregion:
3177 /* "MACS2/PeakDetect.pyx":180
3178 * if self.sregion:
3179 * assert self.d <= self.sregion, "slocal can't be smaller than d!"
3180 * if self.lregion: # <<<<<<<<<<<<<<
3181 * assert self.d <= self.lregion , "llocal can't be smaller than d!"
3182 * assert self.sregion <= self.lregion , "llocal can't be smaller than slocal!"
3184 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
3185 __Pyx_GOTREF(__pyx_t_2);
3186 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
3187 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3188 if (__pyx_t_4) {
3190 /* "MACS2/PeakDetect.pyx":181
3191 * assert self.d <= self.sregion, "slocal can't be smaller than d!"
3192 * if self.lregion:
3193 * assert self.d <= self.lregion , "llocal can't be smaller than d!" # <<<<<<<<<<<<<<
3194 * assert self.sregion <= self.lregion , "llocal can't be smaller than slocal!"
3197 #ifndef CYTHON_WITHOUT_ASSERTIONS
3198 if (unlikely(!Py_OptimizeFlag)) {
3199 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
3200 __Pyx_GOTREF(__pyx_t_2);
3201 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error)
3202 __Pyx_GOTREF(__pyx_t_6);
3203 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
3204 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3205 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3206 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
3207 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3208 if (unlikely(!__pyx_t_4)) {
3209 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_llocal_can_t_be_smaller_than_d);
3210 __PYX_ERR(0, 181, __pyx_L1_error)
3213 #endif
3215 /* "MACS2/PeakDetect.pyx":182
3216 * if self.lregion:
3217 * assert self.d <= self.lregion , "llocal can't be smaller than d!"
3218 * assert self.sregion <= self.lregion , "llocal can't be smaller than slocal!" # <<<<<<<<<<<<<<
3220 * # Now prepare a list of extension sizes
3222 #ifndef CYTHON_WITHOUT_ASSERTIONS
3223 if (unlikely(!Py_OptimizeFlag)) {
3224 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
3225 __Pyx_GOTREF(__pyx_t_1);
3226 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error)
3227 __Pyx_GOTREF(__pyx_t_6);
3228 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
3229 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3230 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3231 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 182, __pyx_L1_error)
3232 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3233 if (unlikely(!__pyx_t_4)) {
3234 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_u_llocal_can_t_be_smaller_than_slo);
3235 __PYX_ERR(0, 182, __pyx_L1_error)
3238 #endif
3240 /* "MACS2/PeakDetect.pyx":180
3241 * if self.sregion:
3242 * assert self.d <= self.sregion, "slocal can't be smaller than d!"
3243 * if self.lregion: # <<<<<<<<<<<<<<
3244 * assert self.d <= self.lregion , "llocal can't be smaller than d!"
3245 * assert self.sregion <= self.lregion , "llocal can't be smaller than slocal!"
3249 /* "MACS2/PeakDetect.pyx":185
3251 * # Now prepare a list of extension sizes
3252 * ctrl_d_s = [ self.d ] # note, d doesn't make sense in PE mode. # <<<<<<<<<<<<<<
3253 * # And a list of scaling factors for control
3254 * ctrl_scale_s = []
3256 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
3257 __Pyx_GOTREF(__pyx_t_2);
3258 __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error)
3259 __Pyx_GOTREF(__pyx_t_6);
3260 __Pyx_GIVEREF(__pyx_t_2);
3261 PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
3262 __pyx_t_2 = 0;
3263 __pyx_v_ctrl_d_s = ((PyObject*)__pyx_t_6);
3264 __pyx_t_6 = 0;
3266 /* "MACS2/PeakDetect.pyx":187
3267 * ctrl_d_s = [ self.d ] # note, d doesn't make sense in PE mode.
3268 * # And a list of scaling factors for control
3269 * ctrl_scale_s = [] # <<<<<<<<<<<<<<
3271 * # d
3273 __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error)
3274 __Pyx_GOTREF(__pyx_t_6);
3275 __pyx_v_ctrl_scale_s = ((PyObject*)__pyx_t_6);
3276 __pyx_t_6 = 0;
3278 /* "MACS2/PeakDetect.pyx":190
3280 * # d
3281 * if not self.opt.tocontrol: # <<<<<<<<<<<<<<
3282 * # if user wants to scale everything to ChIP data
3283 * tmp_v = self.ratio_treat2control
3285 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error)
3286 __Pyx_GOTREF(__pyx_t_6);
3287 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_tocontrol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
3288 __Pyx_GOTREF(__pyx_t_2);
3289 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3290 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 190, __pyx_L1_error)
3291 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3292 __pyx_t_7 = ((!__pyx_t_4) != 0);
3293 if (__pyx_t_7) {
3295 /* "MACS2/PeakDetect.pyx":192
3296 * if not self.opt.tocontrol:
3297 * # if user wants to scale everything to ChIP data
3298 * tmp_v = self.ratio_treat2control # <<<<<<<<<<<<<<
3299 * else:
3300 * tmp_v = 1.0
3302 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
3303 __Pyx_GOTREF(__pyx_t_2);
3304 __pyx_v_tmp_v = __pyx_t_2;
3305 __pyx_t_2 = 0;
3307 /* "MACS2/PeakDetect.pyx":190
3309 * # d
3310 * if not self.opt.tocontrol: # <<<<<<<<<<<<<<
3311 * # if user wants to scale everything to ChIP data
3312 * tmp_v = self.ratio_treat2control
3314 goto __pyx_L8;
3317 /* "MACS2/PeakDetect.pyx":194
3318 * tmp_v = self.ratio_treat2control
3319 * else:
3320 * tmp_v = 1.0 # <<<<<<<<<<<<<<
3321 * ctrl_scale_s.append( tmp_v )
3324 /*else*/ {
3325 __Pyx_INCREF(__pyx_float_1_0);
3326 __pyx_v_tmp_v = __pyx_float_1_0;
3328 __pyx_L8:;
3330 /* "MACS2/PeakDetect.pyx":195
3331 * else:
3332 * tmp_v = 1.0
3333 * ctrl_scale_s.append( tmp_v ) # <<<<<<<<<<<<<<
3335 * # slocal size local
3337 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ctrl_scale_s, __pyx_v_tmp_v); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 195, __pyx_L1_error)
3339 /* "MACS2/PeakDetect.pyx":198
3341 * # slocal size local
3342 * if self.sregion: # <<<<<<<<<<<<<<
3343 * ctrl_d_s.append( self.sregion )
3344 * if not self.opt.tocontrol:
3346 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
3347 __Pyx_GOTREF(__pyx_t_2);
3348 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 198, __pyx_L1_error)
3349 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3350 if (__pyx_t_7) {
3352 /* "MACS2/PeakDetect.pyx":199
3353 * # slocal size local
3354 * if self.sregion:
3355 * ctrl_d_s.append( self.sregion ) # <<<<<<<<<<<<<<
3356 * if not self.opt.tocontrol:
3357 * # if user want to scale everything to ChIP data
3359 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
3360 __Pyx_GOTREF(__pyx_t_2);
3361 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ctrl_d_s, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 199, __pyx_L1_error)
3362 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3364 /* "MACS2/PeakDetect.pyx":200
3365 * if self.sregion:
3366 * ctrl_d_s.append( self.sregion )
3367 * if not self.opt.tocontrol: # <<<<<<<<<<<<<<
3368 * # if user want to scale everything to ChIP data
3369 * tmp_v = float(self.d)/self.sregion*self.ratio_treat2control
3371 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error)
3372 __Pyx_GOTREF(__pyx_t_2);
3373 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tocontrol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error)
3374 __Pyx_GOTREF(__pyx_t_6);
3375 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3376 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 200, __pyx_L1_error)
3377 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3378 __pyx_t_4 = ((!__pyx_t_7) != 0);
3379 if (__pyx_t_4) {
3381 /* "MACS2/PeakDetect.pyx":202
3382 * if not self.opt.tocontrol:
3383 * # if user want to scale everything to ChIP data
3384 * tmp_v = float(self.d)/self.sregion*self.ratio_treat2control # <<<<<<<<<<<<<<
3385 * else:
3386 * tmp_v = float(self.d)/self.sregion
3388 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
3389 __Pyx_GOTREF(__pyx_t_6);
3390 __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
3391 __Pyx_GOTREF(__pyx_t_2);
3392 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3393 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
3394 __Pyx_GOTREF(__pyx_t_6);
3395 __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
3396 __Pyx_GOTREF(__pyx_t_1);
3397 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3398 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3399 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
3400 __Pyx_GOTREF(__pyx_t_6);
3401 __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
3402 __Pyx_GOTREF(__pyx_t_2);
3403 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3404 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3405 __Pyx_DECREF_SET(__pyx_v_tmp_v, __pyx_t_2);
3406 __pyx_t_2 = 0;
3408 /* "MACS2/PeakDetect.pyx":200
3409 * if self.sregion:
3410 * ctrl_d_s.append( self.sregion )
3411 * if not self.opt.tocontrol: # <<<<<<<<<<<<<<
3412 * # if user want to scale everything to ChIP data
3413 * tmp_v = float(self.d)/self.sregion*self.ratio_treat2control
3415 goto __pyx_L10;
3418 /* "MACS2/PeakDetect.pyx":204
3419 * tmp_v = float(self.d)/self.sregion*self.ratio_treat2control
3420 * else:
3421 * tmp_v = float(self.d)/self.sregion # <<<<<<<<<<<<<<
3422 * ctrl_scale_s.append( tmp_v )
3425 /*else*/ {
3426 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
3427 __Pyx_GOTREF(__pyx_t_2);
3428 __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error)
3429 __Pyx_GOTREF(__pyx_t_6);
3430 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3431 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
3432 __Pyx_GOTREF(__pyx_t_2);
3433 __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
3434 __Pyx_GOTREF(__pyx_t_1);
3435 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3436 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3437 __Pyx_DECREF_SET(__pyx_v_tmp_v, __pyx_t_1);
3438 __pyx_t_1 = 0;
3440 __pyx_L10:;
3442 /* "MACS2/PeakDetect.pyx":205
3443 * else:
3444 * tmp_v = float(self.d)/self.sregion
3445 * ctrl_scale_s.append( tmp_v ) # <<<<<<<<<<<<<<
3447 * # llocal size local
3449 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ctrl_scale_s, __pyx_v_tmp_v); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 205, __pyx_L1_error)
3451 /* "MACS2/PeakDetect.pyx":198
3453 * # slocal size local
3454 * if self.sregion: # <<<<<<<<<<<<<<
3455 * ctrl_d_s.append( self.sregion )
3456 * if not self.opt.tocontrol:
3460 /* "MACS2/PeakDetect.pyx":208
3462 * # llocal size local
3463 * if self.lregion and self.lregion > self.sregion: # <<<<<<<<<<<<<<
3464 * ctrl_d_s.append( self.lregion )
3465 * if not self.opt.tocontrol:
3467 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
3468 __Pyx_GOTREF(__pyx_t_1);
3469 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
3470 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3471 if (__pyx_t_7) {
3472 } else {
3473 __pyx_t_4 = __pyx_t_7;
3474 goto __pyx_L12_bool_binop_done;
3476 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
3477 __Pyx_GOTREF(__pyx_t_1);
3478 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
3479 __Pyx_GOTREF(__pyx_t_2);
3480 __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error)
3481 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3482 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3483 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
3484 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3485 __pyx_t_4 = __pyx_t_7;
3486 __pyx_L12_bool_binop_done:;
3487 if (__pyx_t_4) {
3489 /* "MACS2/PeakDetect.pyx":209
3490 * # llocal size local
3491 * if self.lregion and self.lregion > self.sregion:
3492 * ctrl_d_s.append( self.lregion ) # <<<<<<<<<<<<<<
3493 * if not self.opt.tocontrol:
3494 * # if user want to scale everything to ChIP data
3496 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 209, __pyx_L1_error)
3497 __Pyx_GOTREF(__pyx_t_6);
3498 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ctrl_d_s, __pyx_t_6); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 209, __pyx_L1_error)
3499 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3501 /* "MACS2/PeakDetect.pyx":210
3502 * if self.lregion and self.lregion > self.sregion:
3503 * ctrl_d_s.append( self.lregion )
3504 * if not self.opt.tocontrol: # <<<<<<<<<<<<<<
3505 * # if user want to scale everything to ChIP data
3506 * tmp_v = float(self.d)/self.lregion*self.ratio_treat2control
3508 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error)
3509 __Pyx_GOTREF(__pyx_t_6);
3510 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_tocontrol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
3511 __Pyx_GOTREF(__pyx_t_2);
3512 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3513 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
3514 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3515 __pyx_t_7 = ((!__pyx_t_4) != 0);
3516 if (__pyx_t_7) {
3518 /* "MACS2/PeakDetect.pyx":212
3519 * if not self.opt.tocontrol:
3520 * # if user want to scale everything to ChIP data
3521 * tmp_v = float(self.d)/self.lregion*self.ratio_treat2control # <<<<<<<<<<<<<<
3522 * else:
3523 * tmp_v = float(self.d)/self.lregion
3525 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
3526 __Pyx_GOTREF(__pyx_t_2);
3527 __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error)
3528 __Pyx_GOTREF(__pyx_t_6);
3529 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3530 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
3531 __Pyx_GOTREF(__pyx_t_2);
3532 __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
3533 __Pyx_GOTREF(__pyx_t_1);
3534 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3535 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3536 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ratio_treat2control); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
3537 __Pyx_GOTREF(__pyx_t_2);
3538 __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error)
3539 __Pyx_GOTREF(__pyx_t_6);
3540 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3541 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3542 __Pyx_DECREF_SET(__pyx_v_tmp_v, __pyx_t_6);
3543 __pyx_t_6 = 0;
3545 /* "MACS2/PeakDetect.pyx":210
3546 * if self.lregion and self.lregion > self.sregion:
3547 * ctrl_d_s.append( self.lregion )
3548 * if not self.opt.tocontrol: # <<<<<<<<<<<<<<
3549 * # if user want to scale everything to ChIP data
3550 * tmp_v = float(self.d)/self.lregion*self.ratio_treat2control
3552 goto __pyx_L14;
3555 /* "MACS2/PeakDetect.pyx":214
3556 * tmp_v = float(self.d)/self.lregion*self.ratio_treat2control
3557 * else:
3558 * tmp_v = float(self.d)/self.lregion # <<<<<<<<<<<<<<
3559 * ctrl_scale_s.append( tmp_v )
3562 /*else*/ {
3563 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error)
3564 __Pyx_GOTREF(__pyx_t_6);
3565 __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error)
3566 __Pyx_GOTREF(__pyx_t_2);
3567 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3568 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error)
3569 __Pyx_GOTREF(__pyx_t_6);
3570 __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error)
3571 __Pyx_GOTREF(__pyx_t_1);
3572 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3573 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3574 __Pyx_DECREF_SET(__pyx_v_tmp_v, __pyx_t_1);
3575 __pyx_t_1 = 0;
3577 __pyx_L14:;
3579 /* "MACS2/PeakDetect.pyx":215
3580 * else:
3581 * tmp_v = float(self.d)/self.lregion
3582 * ctrl_scale_s.append( tmp_v ) # <<<<<<<<<<<<<<
3584 * #if self.PE_MODE: # first d/scale are useless in PE mode
3586 __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ctrl_scale_s, __pyx_v_tmp_v); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 215, __pyx_L1_error)
3588 /* "MACS2/PeakDetect.pyx":208
3590 * # llocal size local
3591 * if self.lregion and self.lregion > self.sregion: # <<<<<<<<<<<<<<
3592 * ctrl_d_s.append( self.lregion )
3593 * if not self.opt.tocontrol:
3597 /* "MACS2/PeakDetect.pyx":222
3598 * # print ctrl_d_s
3599 * # print ctrl_scale_s
3600 * if self.nolambda: # <<<<<<<<<<<<<<
3601 * ctrl_d_s = []
3602 * ctrl_scale_s = []
3604 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nolambda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
3605 __Pyx_GOTREF(__pyx_t_1);
3606 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
3607 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3608 if (__pyx_t_7) {
3610 /* "MACS2/PeakDetect.pyx":223
3611 * # print ctrl_scale_s
3612 * if self.nolambda:
3613 * ctrl_d_s = [] # <<<<<<<<<<<<<<
3614 * ctrl_scale_s = []
3617 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
3618 __Pyx_GOTREF(__pyx_t_1);
3619 __Pyx_DECREF_SET(__pyx_v_ctrl_d_s, ((PyObject*)__pyx_t_1));
3620 __pyx_t_1 = 0;
3622 /* "MACS2/PeakDetect.pyx":224
3623 * if self.nolambda:
3624 * ctrl_d_s = []
3625 * ctrl_scale_s = [] # <<<<<<<<<<<<<<
3627 * scorecalculator = CallerFromAlignments( self.treat, self.control,
3629 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
3630 __Pyx_GOTREF(__pyx_t_1);
3631 __Pyx_DECREF_SET(__pyx_v_ctrl_scale_s, ((PyObject*)__pyx_t_1));
3632 __pyx_t_1 = 0;
3634 /* "MACS2/PeakDetect.pyx":222
3635 * # print ctrl_d_s
3636 * # print ctrl_scale_s
3637 * if self.nolambda: # <<<<<<<<<<<<<<
3638 * ctrl_d_s = []
3639 * ctrl_scale_s = []
3643 /* "MACS2/PeakDetect.pyx":226
3644 * ctrl_scale_s = []
3646 * scorecalculator = CallerFromAlignments( self.treat, self.control, # <<<<<<<<<<<<<<
3647 * d = d, ctrl_d_s = ctrl_d_s,
3648 * treat_scaling_factor = treat_scale,
3650 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_CallerFromAlignments); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error)
3651 __Pyx_GOTREF(__pyx_t_1);
3652 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error)
3653 __Pyx_GOTREF(__pyx_t_6);
3654 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_control); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
3655 __Pyx_GOTREF(__pyx_t_2);
3656 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 226, __pyx_L1_error)
3657 __Pyx_GOTREF(__pyx_t_9);
3658 __Pyx_GIVEREF(__pyx_t_6);
3659 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
3660 __Pyx_GIVEREF(__pyx_t_2);
3661 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
3662 __pyx_t_6 = 0;
3663 __pyx_t_2 = 0;
3665 /* "MACS2/PeakDetect.pyx":227
3667 * scorecalculator = CallerFromAlignments( self.treat, self.control,
3668 * d = d, ctrl_d_s = ctrl_d_s, # <<<<<<<<<<<<<<
3669 * treat_scaling_factor = treat_scale,
3670 * ctrl_scaling_factor_s = ctrl_scale_s,
3672 __pyx_t_2 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
3673 __Pyx_GOTREF(__pyx_t_2);
3674 __pyx_t_6 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
3675 __Pyx_GOTREF(__pyx_t_6);
3676 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_d, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3677 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3678 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ctrl_d_s, __pyx_v_ctrl_d_s) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3680 /* "MACS2/PeakDetect.pyx":228
3681 * scorecalculator = CallerFromAlignments( self.treat, self.control,
3682 * d = d, ctrl_d_s = ctrl_d_s,
3683 * treat_scaling_factor = treat_scale, # <<<<<<<<<<<<<<
3684 * ctrl_scaling_factor_s = ctrl_scale_s,
3685 * end_shift = self.end_shift,
3687 __pyx_t_6 = PyFloat_FromDouble(__pyx_v_treat_scale); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 228, __pyx_L1_error)
3688 __Pyx_GOTREF(__pyx_t_6);
3689 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_treat_scaling_factor, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3690 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3692 /* "MACS2/PeakDetect.pyx":229
3693 * d = d, ctrl_d_s = ctrl_d_s,
3694 * treat_scaling_factor = treat_scale,
3695 * ctrl_scaling_factor_s = ctrl_scale_s, # <<<<<<<<<<<<<<
3696 * end_shift = self.end_shift,
3697 * lambda_bg = lambda_bg,
3699 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ctrl_scaling_factor_s, __pyx_v_ctrl_scale_s) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3701 /* "MACS2/PeakDetect.pyx":230
3702 * treat_scaling_factor = treat_scale,
3703 * ctrl_scaling_factor_s = ctrl_scale_s,
3704 * end_shift = self.end_shift, # <<<<<<<<<<<<<<
3705 * lambda_bg = lambda_bg,
3706 * save_bedGraph = self.opt.store_bdg,
3708 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_end_shift); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
3709 __Pyx_GOTREF(__pyx_t_6);
3710 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end_shift, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3711 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3713 /* "MACS2/PeakDetect.pyx":231
3714 * ctrl_scaling_factor_s = ctrl_scale_s,
3715 * end_shift = self.end_shift,
3716 * lambda_bg = lambda_bg, # <<<<<<<<<<<<<<
3717 * save_bedGraph = self.opt.store_bdg,
3718 * bedGraph_filename_prefix = self.opt.name,
3720 __pyx_t_6 = PyFloat_FromDouble(__pyx_v_lambda_bg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 231, __pyx_L1_error)
3721 __Pyx_GOTREF(__pyx_t_6);
3722 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_lambda_bg, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3723 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3725 /* "MACS2/PeakDetect.pyx":232
3726 * end_shift = self.end_shift,
3727 * lambda_bg = lambda_bg,
3728 * save_bedGraph = self.opt.store_bdg, # <<<<<<<<<<<<<<
3729 * bedGraph_filename_prefix = self.opt.name,
3730 * bedGraph_treat_filename = self.opt.bdg_treat,
3732 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error)
3733 __Pyx_GOTREF(__pyx_t_6);
3734 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_store_bdg); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 232, __pyx_L1_error)
3735 __Pyx_GOTREF(__pyx_t_10);
3736 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3737 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_save_bedGraph, __pyx_t_10) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3738 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3740 /* "MACS2/PeakDetect.pyx":233
3741 * lambda_bg = lambda_bg,
3742 * save_bedGraph = self.opt.store_bdg,
3743 * bedGraph_filename_prefix = self.opt.name, # <<<<<<<<<<<<<<
3744 * bedGraph_treat_filename = self.opt.bdg_treat,
3745 * bedGraph_control_filename = self.opt.bdg_control,
3747 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 233, __pyx_L1_error)
3748 __Pyx_GOTREF(__pyx_t_10);
3749 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error)
3750 __Pyx_GOTREF(__pyx_t_6);
3751 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3752 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bedGraph_filename_prefix, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3753 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3755 /* "MACS2/PeakDetect.pyx":234
3756 * save_bedGraph = self.opt.store_bdg,
3757 * bedGraph_filename_prefix = self.opt.name,
3758 * bedGraph_treat_filename = self.opt.bdg_treat, # <<<<<<<<<<<<<<
3759 * bedGraph_control_filename = self.opt.bdg_control,
3760 * save_SPMR = self.opt.do_SPMR,
3762 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
3763 __Pyx_GOTREF(__pyx_t_6);
3764 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_bdg_treat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 234, __pyx_L1_error)
3765 __Pyx_GOTREF(__pyx_t_10);
3766 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3767 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bedGraph_treat_filename, __pyx_t_10) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3768 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3770 /* "MACS2/PeakDetect.pyx":235
3771 * bedGraph_filename_prefix = self.opt.name,
3772 * bedGraph_treat_filename = self.opt.bdg_treat,
3773 * bedGraph_control_filename = self.opt.bdg_control, # <<<<<<<<<<<<<<
3774 * save_SPMR = self.opt.do_SPMR,
3775 * cutoff_analysis_filename = self.opt.cutoff_analysis_file )
3777 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L1_error)
3778 __Pyx_GOTREF(__pyx_t_10);
3779 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_bdg_control); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
3780 __Pyx_GOTREF(__pyx_t_6);
3781 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3782 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_bedGraph_control_filename, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3783 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3785 /* "MACS2/PeakDetect.pyx":236
3786 * bedGraph_treat_filename = self.opt.bdg_treat,
3787 * bedGraph_control_filename = self.opt.bdg_control,
3788 * save_SPMR = self.opt.do_SPMR, # <<<<<<<<<<<<<<
3789 * cutoff_analysis_filename = self.opt.cutoff_analysis_file )
3792 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error)
3793 __Pyx_GOTREF(__pyx_t_6);
3794 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_do_SPMR); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 236, __pyx_L1_error)
3795 __Pyx_GOTREF(__pyx_t_10);
3796 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3797 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_save_SPMR, __pyx_t_10) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3798 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3800 /* "MACS2/PeakDetect.pyx":237
3801 * bedGraph_control_filename = self.opt.bdg_control,
3802 * save_SPMR = self.opt.do_SPMR,
3803 * cutoff_analysis_filename = self.opt.cutoff_analysis_file ) # <<<<<<<<<<<<<<
3805 * if self.opt.trackline: scorecalculator.enable_trackline()
3807 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 237, __pyx_L1_error)
3808 __Pyx_GOTREF(__pyx_t_10);
3809 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_cutoff_analysis_file); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 237, __pyx_L1_error)
3810 __Pyx_GOTREF(__pyx_t_6);
3811 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3812 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cutoff_analysis_filename, __pyx_t_6) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
3813 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3815 /* "MACS2/PeakDetect.pyx":226
3816 * ctrl_scale_s = []
3818 * scorecalculator = CallerFromAlignments( self.treat, self.control, # <<<<<<<<<<<<<<
3819 * d = d, ctrl_d_s = ctrl_d_s,
3820 * treat_scaling_factor = treat_scale,
3822 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error)
3823 __Pyx_GOTREF(__pyx_t_6);
3824 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3825 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3826 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3827 __pyx_v_scorecalculator = __pyx_t_6;
3828 __pyx_t_6 = 0;
3830 /* "MACS2/PeakDetect.pyx":239
3831 * cutoff_analysis_filename = self.opt.cutoff_analysis_file )
3833 * if self.opt.trackline: scorecalculator.enable_trackline() # <<<<<<<<<<<<<<
3835 * # call peaks
3837 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 239, __pyx_L1_error)
3838 __Pyx_GOTREF(__pyx_t_6);
3839 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_trackline); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
3840 __Pyx_GOTREF(__pyx_t_2);
3841 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3842 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
3843 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3844 if (__pyx_t_7) {
3845 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_enable_trackline); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 239, __pyx_L1_error)
3846 __Pyx_GOTREF(__pyx_t_6);
3847 __pyx_t_9 = NULL;
3848 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
3849 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
3850 if (likely(__pyx_t_9)) {
3851 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
3852 __Pyx_INCREF(__pyx_t_9);
3853 __Pyx_INCREF(function);
3854 __Pyx_DECREF_SET(__pyx_t_6, function);
3857 __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
3858 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3859 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
3860 __Pyx_GOTREF(__pyx_t_2);
3861 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3862 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3865 /* "MACS2/PeakDetect.pyx":242
3867 * # call peaks
3868 * call_summits = self.opt.call_summits # <<<<<<<<<<<<<<
3869 * if call_summits: self.info("#3 Going to call summits inside each peak ...")
3872 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
3873 __Pyx_GOTREF(__pyx_t_2);
3874 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_call_summits); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error)
3875 __Pyx_GOTREF(__pyx_t_6);
3876 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3877 __pyx_v_call_summits = __pyx_t_6;
3878 __pyx_t_6 = 0;
3880 /* "MACS2/PeakDetect.pyx":243
3881 * # call peaks
3882 * call_summits = self.opt.call_summits
3883 * if call_summits: self.info("#3 Going to call summits inside each peak ...") # <<<<<<<<<<<<<<
3885 * if self.log_pvalue != None:
3887 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_call_summits); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 243, __pyx_L1_error)
3888 if (__pyx_t_7) {
3889 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
3890 __Pyx_GOTREF(__pyx_t_2);
3891 __pyx_t_9 = NULL;
3892 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3893 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
3894 if (likely(__pyx_t_9)) {
3895 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3896 __Pyx_INCREF(__pyx_t_9);
3897 __Pyx_INCREF(function);
3898 __Pyx_DECREF_SET(__pyx_t_2, function);
3901 __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_kp_u_3_Going_to_call_summits_inside) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_3_Going_to_call_summits_inside);
3902 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3903 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __pyx_L1_error)
3904 __Pyx_GOTREF(__pyx_t_6);
3905 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3906 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3909 /* "MACS2/PeakDetect.pyx":245
3910 * if call_summits: self.info("#3 Going to call summits inside each peak ...")
3912 * if self.log_pvalue != None: # <<<<<<<<<<<<<<
3913 * if self.opt.broad:
3914 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
3916 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error)
3917 __Pyx_GOTREF(__pyx_t_6);
3918 __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error)
3919 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3920 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 245, __pyx_L1_error)
3921 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3922 if (__pyx_t_7) {
3924 /* "MACS2/PeakDetect.pyx":246
3926 * if self.log_pvalue != None:
3927 * if self.opt.broad: # <<<<<<<<<<<<<<
3928 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
3929 * peaks = scorecalculator.call_broadpeaks(['p',],
3931 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
3932 __Pyx_GOTREF(__pyx_t_2);
3933 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_broad); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __pyx_L1_error)
3934 __Pyx_GOTREF(__pyx_t_6);
3935 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3936 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 246, __pyx_L1_error)
3937 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3938 if (__pyx_t_7) {
3940 /* "MACS2/PeakDetect.pyx":247
3941 * if self.log_pvalue != None:
3942 * if self.opt.broad:
3943 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) ) # <<<<<<<<<<<<<<
3944 * peaks = scorecalculator.call_broadpeaks(['p',],
3945 * lvl1_cutoff_s=[self.log_pvalue,],
3947 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
3948 __Pyx_GOTREF(__pyx_t_2);
3949 __pyx_t_9 = PyTuple_New(5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 247, __pyx_L1_error)
3950 __Pyx_GOTREF(__pyx_t_9);
3951 __pyx_t_11 = 0;
3952 __pyx_t_12 = 127;
3953 __Pyx_INCREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l);
3954 __pyx_t_11 += 70;
3955 __Pyx_GIVEREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l);
3956 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_3_Call_broad_peaks_with_given_l);
3957 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
3958 __Pyx_GOTREF(__pyx_t_1);
3959 __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_kp_u_5f); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 247, __pyx_L1_error)
3960 __Pyx_GOTREF(__pyx_t_10);
3961 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3962 __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_12;
3963 __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
3964 __Pyx_GIVEREF(__pyx_t_10);
3965 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
3966 __pyx_t_10 = 0;
3967 __Pyx_INCREF(__pyx_kp_u__4);
3968 __pyx_t_11 += 2;
3969 __Pyx_GIVEREF(__pyx_kp_u__4);
3970 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u__4);
3971 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 247, __pyx_L1_error)
3972 __Pyx_GOTREF(__pyx_t_10);
3973 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
3974 __Pyx_GOTREF(__pyx_t_1);
3975 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3976 __pyx_t_10 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_kp_u_5f); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 247, __pyx_L1_error)
3977 __Pyx_GOTREF(__pyx_t_10);
3978 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3979 __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_12;
3980 __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
3981 __Pyx_GIVEREF(__pyx_t_10);
3982 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_10);
3983 __pyx_t_10 = 0;
3984 __Pyx_INCREF(__pyx_kp_u__5);
3985 __pyx_t_11 += 3;
3986 __Pyx_GIVEREF(__pyx_kp_u__5);
3987 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_kp_u__5);
3988 __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_9, 5, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 247, __pyx_L1_error)
3989 __Pyx_GOTREF(__pyx_t_10);
3990 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3991 __pyx_t_9 = NULL;
3992 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3993 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
3994 if (likely(__pyx_t_9)) {
3995 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3996 __Pyx_INCREF(__pyx_t_9);
3997 __Pyx_INCREF(function);
3998 __Pyx_DECREF_SET(__pyx_t_2, function);
4001 __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_10);
4002 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4003 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4004 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error)
4005 __Pyx_GOTREF(__pyx_t_6);
4006 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4007 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4009 /* "MACS2/PeakDetect.pyx":248
4010 * if self.opt.broad:
4011 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
4012 * peaks = scorecalculator.call_broadpeaks(['p',], # <<<<<<<<<<<<<<
4013 * lvl1_cutoff_s=[self.log_pvalue,],
4014 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4016 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_broadpeaks); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
4017 __Pyx_GOTREF(__pyx_t_6);
4018 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
4019 __Pyx_GOTREF(__pyx_t_2);
4020 __Pyx_INCREF(__pyx_n_u_p);
4021 __Pyx_GIVEREF(__pyx_n_u_p);
4022 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_p);
4023 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 248, __pyx_L1_error)
4024 __Pyx_GOTREF(__pyx_t_10);
4025 __Pyx_GIVEREF(__pyx_t_2);
4026 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
4027 __pyx_t_2 = 0;
4029 /* "MACS2/PeakDetect.pyx":249
4030 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
4031 * peaks = scorecalculator.call_broadpeaks(['p',],
4032 * lvl1_cutoff_s=[self.log_pvalue,], # <<<<<<<<<<<<<<
4033 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4034 * min_length=self.minlen,
4036 __pyx_t_2 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
4037 __Pyx_GOTREF(__pyx_t_2);
4038 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 249, __pyx_L1_error)
4039 __Pyx_GOTREF(__pyx_t_9);
4040 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
4041 __Pyx_GOTREF(__pyx_t_1);
4042 __Pyx_GIVEREF(__pyx_t_9);
4043 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
4044 __pyx_t_9 = 0;
4045 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_lvl1_cutoff_s, __pyx_t_1) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
4046 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4048 /* "MACS2/PeakDetect.pyx":250
4049 * peaks = scorecalculator.call_broadpeaks(['p',],
4050 * lvl1_cutoff_s=[self.log_pvalue,],
4051 * lvl2_cutoff_s=[self.opt.log_broadcutoff,], # <<<<<<<<<<<<<<
4052 * min_length=self.minlen,
4053 * lvl1_max_gap=self.maxgap,
4055 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
4056 __Pyx_GOTREF(__pyx_t_1);
4057 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 250, __pyx_L1_error)
4058 __Pyx_GOTREF(__pyx_t_9);
4059 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4060 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
4061 __Pyx_GOTREF(__pyx_t_1);
4062 __Pyx_GIVEREF(__pyx_t_9);
4063 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
4064 __pyx_t_9 = 0;
4065 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_lvl2_cutoff_s, __pyx_t_1) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
4066 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4068 /* "MACS2/PeakDetect.pyx":251
4069 * lvl1_cutoff_s=[self.log_pvalue,],
4070 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4071 * min_length=self.minlen, # <<<<<<<<<<<<<<
4072 * lvl1_max_gap=self.maxgap,
4073 * lvl2_max_gap=self.maxgap*4,
4075 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
4076 __Pyx_GOTREF(__pyx_t_1);
4077 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_min_length, __pyx_t_1) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
4078 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4080 /* "MACS2/PeakDetect.pyx":252
4081 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4082 * min_length=self.minlen,
4083 * lvl1_max_gap=self.maxgap, # <<<<<<<<<<<<<<
4084 * lvl2_max_gap=self.maxgap*4,
4085 * cutoff_analysis=self.opt.cutoff_analysis )
4087 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
4088 __Pyx_GOTREF(__pyx_t_1);
4089 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_lvl1_max_gap, __pyx_t_1) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
4090 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4092 /* "MACS2/PeakDetect.pyx":253
4093 * min_length=self.minlen,
4094 * lvl1_max_gap=self.maxgap,
4095 * lvl2_max_gap=self.maxgap*4, # <<<<<<<<<<<<<<
4096 * cutoff_analysis=self.opt.cutoff_analysis )
4097 * else:
4099 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
4100 __Pyx_GOTREF(__pyx_t_1);
4101 __pyx_t_9 = PyNumber_Multiply(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 253, __pyx_L1_error)
4102 __Pyx_GOTREF(__pyx_t_9);
4103 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4104 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_lvl2_max_gap, __pyx_t_9) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
4105 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4107 /* "MACS2/PeakDetect.pyx":254
4108 * lvl1_max_gap=self.maxgap,
4109 * lvl2_max_gap=self.maxgap*4,
4110 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
4111 * else:
4112 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
4114 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 254, __pyx_L1_error)
4115 __Pyx_GOTREF(__pyx_t_9);
4116 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
4117 __Pyx_GOTREF(__pyx_t_1);
4118 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4119 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cutoff_analysis, __pyx_t_1) < 0) __PYX_ERR(0, 249, __pyx_L1_error)
4120 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4122 /* "MACS2/PeakDetect.pyx":248
4123 * if self.opt.broad:
4124 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
4125 * peaks = scorecalculator.call_broadpeaks(['p',], # <<<<<<<<<<<<<<
4126 * lvl1_cutoff_s=[self.log_pvalue,],
4127 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4129 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
4130 __Pyx_GOTREF(__pyx_t_1);
4131 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4132 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4133 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4134 __pyx_v_peaks = __pyx_t_1;
4135 __pyx_t_1 = 0;
4137 /* "MACS2/PeakDetect.pyx":246
4139 * if self.log_pvalue != None:
4140 * if self.opt.broad: # <<<<<<<<<<<<<<
4141 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
4142 * peaks = scorecalculator.call_broadpeaks(['p',],
4144 goto __pyx_L19;
4147 /* "MACS2/PeakDetect.pyx":256
4148 * cutoff_analysis=self.opt.cutoff_analysis )
4149 * else:
4150 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue) # <<<<<<<<<<<<<<
4151 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,],
4152 * min_length=self.minlen,
4154 /*else*/ {
4155 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L1_error)
4156 __Pyx_GOTREF(__pyx_t_2);
4157 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 256, __pyx_L1_error)
4158 __Pyx_GOTREF(__pyx_t_10);
4159 __pyx_t_6 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_3_Call_peaks_with_given_log10pv, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error)
4160 __Pyx_GOTREF(__pyx_t_6);
4161 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4162 __pyx_t_10 = NULL;
4163 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4164 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
4165 if (likely(__pyx_t_10)) {
4166 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4167 __Pyx_INCREF(__pyx_t_10);
4168 __Pyx_INCREF(function);
4169 __Pyx_DECREF_SET(__pyx_t_2, function);
4172 __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6);
4173 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4174 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4175 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
4176 __Pyx_GOTREF(__pyx_t_1);
4177 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4178 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4180 /* "MACS2/PeakDetect.pyx":257
4181 * else:
4182 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
4183 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,], # <<<<<<<<<<<<<<
4184 * min_length=self.minlen,
4185 * max_gap=self.maxgap,
4187 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_peaks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
4188 __Pyx_GOTREF(__pyx_t_1);
4189 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
4190 __Pyx_GOTREF(__pyx_t_2);
4191 __Pyx_INCREF(__pyx_n_u_p);
4192 __Pyx_GIVEREF(__pyx_n_u_p);
4193 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_p);
4194 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error)
4195 __Pyx_GOTREF(__pyx_t_6);
4196 __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error)
4197 __Pyx_GOTREF(__pyx_t_10);
4198 __Pyx_GIVEREF(__pyx_t_6);
4199 PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
4200 __pyx_t_6 = 0;
4201 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error)
4202 __Pyx_GOTREF(__pyx_t_6);
4203 __Pyx_GIVEREF(__pyx_t_2);
4204 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
4205 __Pyx_GIVEREF(__pyx_t_10);
4206 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_10);
4207 __pyx_t_2 = 0;
4208 __pyx_t_10 = 0;
4210 /* "MACS2/PeakDetect.pyx":258
4211 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
4212 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,],
4213 * min_length=self.minlen, # <<<<<<<<<<<<<<
4214 * max_gap=self.maxgap,
4215 * call_summits=call_summits,
4217 __pyx_t_10 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 258, __pyx_L1_error)
4218 __Pyx_GOTREF(__pyx_t_10);
4219 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
4220 __Pyx_GOTREF(__pyx_t_2);
4221 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_min_length, __pyx_t_2) < 0) __PYX_ERR(0, 258, __pyx_L1_error)
4222 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4224 /* "MACS2/PeakDetect.pyx":259
4225 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,],
4226 * min_length=self.minlen,
4227 * max_gap=self.maxgap, # <<<<<<<<<<<<<<
4228 * call_summits=call_summits,
4229 * cutoff_analysis=self.opt.cutoff_analysis )
4231 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
4232 __Pyx_GOTREF(__pyx_t_2);
4233 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_max_gap, __pyx_t_2) < 0) __PYX_ERR(0, 258, __pyx_L1_error)
4234 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4236 /* "MACS2/PeakDetect.pyx":260
4237 * min_length=self.minlen,
4238 * max_gap=self.maxgap,
4239 * call_summits=call_summits, # <<<<<<<<<<<<<<
4240 * cutoff_analysis=self.opt.cutoff_analysis )
4241 * elif self.log_qvalue != None:
4243 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_call_summits, __pyx_v_call_summits) < 0) __PYX_ERR(0, 258, __pyx_L1_error)
4245 /* "MACS2/PeakDetect.pyx":261
4246 * max_gap=self.maxgap,
4247 * call_summits=call_summits,
4248 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
4249 * elif self.log_qvalue != None:
4250 * if self.opt.broad:
4252 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error)
4253 __Pyx_GOTREF(__pyx_t_2);
4254 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 261, __pyx_L1_error)
4255 __Pyx_GOTREF(__pyx_t_9);
4256 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4257 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_cutoff_analysis, __pyx_t_9) < 0) __PYX_ERR(0, 258, __pyx_L1_error)
4258 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4260 /* "MACS2/PeakDetect.pyx":257
4261 * else:
4262 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
4263 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,], # <<<<<<<<<<<<<<
4264 * min_length=self.minlen,
4265 * max_gap=self.maxgap,
4267 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 257, __pyx_L1_error)
4268 __Pyx_GOTREF(__pyx_t_9);
4269 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4270 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4271 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4272 __pyx_v_peaks = __pyx_t_9;
4273 __pyx_t_9 = 0;
4275 __pyx_L19:;
4277 /* "MACS2/PeakDetect.pyx":245
4278 * if call_summits: self.info("#3 Going to call summits inside each peak ...")
4280 * if self.log_pvalue != None: # <<<<<<<<<<<<<<
4281 * if self.opt.broad:
4282 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
4284 goto __pyx_L18;
4287 /* "MACS2/PeakDetect.pyx":262
4288 * call_summits=call_summits,
4289 * cutoff_analysis=self.opt.cutoff_analysis )
4290 * elif self.log_qvalue != None: # <<<<<<<<<<<<<<
4291 * if self.opt.broad:
4292 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4294 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 262, __pyx_L1_error)
4295 __Pyx_GOTREF(__pyx_t_9);
4296 __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 262, __pyx_L1_error)
4297 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4298 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
4299 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4300 if (__pyx_t_7) {
4302 /* "MACS2/PeakDetect.pyx":263
4303 * cutoff_analysis=self.opt.cutoff_analysis )
4304 * elif self.log_qvalue != None:
4305 * if self.opt.broad: # <<<<<<<<<<<<<<
4306 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4307 * peaks = scorecalculator.call_broadpeaks(['q',],
4309 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 263, __pyx_L1_error)
4310 __Pyx_GOTREF(__pyx_t_10);
4311 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_broad); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error)
4312 __Pyx_GOTREF(__pyx_t_9);
4313 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4314 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
4315 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4316 if (__pyx_t_7) {
4318 /* "MACS2/PeakDetect.pyx":264
4319 * elif self.log_qvalue != None:
4320 * if self.opt.broad:
4321 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) ) # <<<<<<<<<<<<<<
4322 * peaks = scorecalculator.call_broadpeaks(['q',],
4323 * lvl1_cutoff_s=[self.log_qvalue,],
4325 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 264, __pyx_L1_error)
4326 __Pyx_GOTREF(__pyx_t_10);
4327 __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 264, __pyx_L1_error)
4328 __Pyx_GOTREF(__pyx_t_6);
4329 __pyx_t_11 = 0;
4330 __pyx_t_12 = 127;
4331 __Pyx_INCREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l_2);
4332 __pyx_t_11 += 70;
4333 __Pyx_GIVEREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l_2);
4334 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_3_Call_broad_peaks_with_given_l_2);
4335 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
4336 __Pyx_GOTREF(__pyx_t_1);
4337 __pyx_t_2 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_n_u_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
4338 __Pyx_GOTREF(__pyx_t_2);
4339 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4340 __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
4341 __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
4342 __Pyx_GIVEREF(__pyx_t_2);
4343 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
4344 __pyx_t_2 = 0;
4345 __Pyx_INCREF(__pyx_kp_u__4);
4346 __pyx_t_11 += 2;
4347 __Pyx_GIVEREF(__pyx_kp_u__4);
4348 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__4);
4349 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
4350 __Pyx_GOTREF(__pyx_t_2);
4351 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
4352 __Pyx_GOTREF(__pyx_t_1);
4353 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4354 __pyx_t_2 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_n_u_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
4355 __Pyx_GOTREF(__pyx_t_2);
4356 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4357 __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
4358 __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
4359 __Pyx_GIVEREF(__pyx_t_2);
4360 PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2);
4361 __pyx_t_2 = 0;
4362 __Pyx_INCREF(__pyx_kp_u__5);
4363 __pyx_t_11 += 3;
4364 __Pyx_GIVEREF(__pyx_kp_u__5);
4365 PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_kp_u__5);
4366 __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
4367 __Pyx_GOTREF(__pyx_t_2);
4368 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4369 __pyx_t_6 = NULL;
4370 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
4371 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10);
4372 if (likely(__pyx_t_6)) {
4373 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4374 __Pyx_INCREF(__pyx_t_6);
4375 __Pyx_INCREF(function);
4376 __Pyx_DECREF_SET(__pyx_t_10, function);
4379 __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
4380 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4381 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4382 if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 264, __pyx_L1_error)
4383 __Pyx_GOTREF(__pyx_t_9);
4384 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4385 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4387 /* "MACS2/PeakDetect.pyx":265
4388 * if self.opt.broad:
4389 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4390 * peaks = scorecalculator.call_broadpeaks(['q',], # <<<<<<<<<<<<<<
4391 * lvl1_cutoff_s=[self.log_qvalue,],
4392 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4394 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_broadpeaks); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 265, __pyx_L1_error)
4395 __Pyx_GOTREF(__pyx_t_9);
4396 __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 265, __pyx_L1_error)
4397 __Pyx_GOTREF(__pyx_t_10);
4398 __Pyx_INCREF(__pyx_n_u_q);
4399 __Pyx_GIVEREF(__pyx_n_u_q);
4400 PyList_SET_ITEM(__pyx_t_10, 0, __pyx_n_u_q);
4401 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
4402 __Pyx_GOTREF(__pyx_t_2);
4403 __Pyx_GIVEREF(__pyx_t_10);
4404 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
4405 __pyx_t_10 = 0;
4407 /* "MACS2/PeakDetect.pyx":266
4408 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4409 * peaks = scorecalculator.call_broadpeaks(['q',],
4410 * lvl1_cutoff_s=[self.log_qvalue,], # <<<<<<<<<<<<<<
4411 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4412 * min_length=self.minlen,
4414 __pyx_t_10 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 266, __pyx_L1_error)
4415 __Pyx_GOTREF(__pyx_t_10);
4416 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 266, __pyx_L1_error)
4417 __Pyx_GOTREF(__pyx_t_6);
4418 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
4419 __Pyx_GOTREF(__pyx_t_1);
4420 __Pyx_GIVEREF(__pyx_t_6);
4421 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
4422 __pyx_t_6 = 0;
4423 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_lvl1_cutoff_s, __pyx_t_1) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4424 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4426 /* "MACS2/PeakDetect.pyx":267
4427 * peaks = scorecalculator.call_broadpeaks(['q',],
4428 * lvl1_cutoff_s=[self.log_qvalue,],
4429 * lvl2_cutoff_s=[self.opt.log_broadcutoff,], # <<<<<<<<<<<<<<
4430 * min_length=self.minlen,
4431 * lvl1_max_gap=self.maxgap,
4433 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
4434 __Pyx_GOTREF(__pyx_t_1);
4435 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 267, __pyx_L1_error)
4436 __Pyx_GOTREF(__pyx_t_6);
4437 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4438 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
4439 __Pyx_GOTREF(__pyx_t_1);
4440 __Pyx_GIVEREF(__pyx_t_6);
4441 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
4442 __pyx_t_6 = 0;
4443 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_lvl2_cutoff_s, __pyx_t_1) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4446 /* "MACS2/PeakDetect.pyx":268
4447 * lvl1_cutoff_s=[self.log_qvalue,],
4448 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4449 * min_length=self.minlen, # <<<<<<<<<<<<<<
4450 * lvl1_max_gap=self.maxgap,
4451 * lvl2_max_gap=self.maxgap*4,
4453 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
4454 __Pyx_GOTREF(__pyx_t_1);
4455 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_min_length, __pyx_t_1) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4456 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4458 /* "MACS2/PeakDetect.pyx":269
4459 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4460 * min_length=self.minlen,
4461 * lvl1_max_gap=self.maxgap, # <<<<<<<<<<<<<<
4462 * lvl2_max_gap=self.maxgap*4,
4463 * cutoff_analysis=self.opt.cutoff_analysis )
4465 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
4466 __Pyx_GOTREF(__pyx_t_1);
4467 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_lvl1_max_gap, __pyx_t_1) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4468 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4470 /* "MACS2/PeakDetect.pyx":270
4471 * min_length=self.minlen,
4472 * lvl1_max_gap=self.maxgap,
4473 * lvl2_max_gap=self.maxgap*4, # <<<<<<<<<<<<<<
4474 * cutoff_analysis=self.opt.cutoff_analysis )
4475 * else:
4477 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
4478 __Pyx_GOTREF(__pyx_t_1);
4479 __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error)
4480 __Pyx_GOTREF(__pyx_t_6);
4481 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4482 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_lvl2_max_gap, __pyx_t_6) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4483 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4485 /* "MACS2/PeakDetect.pyx":271
4486 * lvl1_max_gap=self.maxgap,
4487 * lvl2_max_gap=self.maxgap*4,
4488 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
4489 * else:
4490 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,],
4492 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 271, __pyx_L1_error)
4493 __Pyx_GOTREF(__pyx_t_6);
4494 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
4495 __Pyx_GOTREF(__pyx_t_1);
4496 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4497 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_cutoff_analysis, __pyx_t_1) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4498 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4500 /* "MACS2/PeakDetect.pyx":265
4501 * if self.opt.broad:
4502 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4503 * peaks = scorecalculator.call_broadpeaks(['q',], # <<<<<<<<<<<<<<
4504 * lvl1_cutoff_s=[self.log_qvalue,],
4505 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
4507 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
4508 __Pyx_GOTREF(__pyx_t_1);
4509 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4510 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4511 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4512 __pyx_v_peaks = __pyx_t_1;
4513 __pyx_t_1 = 0;
4515 /* "MACS2/PeakDetect.pyx":263
4516 * cutoff_analysis=self.opt.cutoff_analysis )
4517 * elif self.log_qvalue != None:
4518 * if self.opt.broad: # <<<<<<<<<<<<<<
4519 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4520 * peaks = scorecalculator.call_broadpeaks(['q',],
4522 goto __pyx_L20;
4525 /* "MACS2/PeakDetect.pyx":273
4526 * cutoff_analysis=self.opt.cutoff_analysis )
4527 * else:
4528 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,], # <<<<<<<<<<<<<<
4529 * min_length=self.minlen,
4530 * max_gap=self.maxgap,
4532 /*else*/ {
4533 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_peaks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
4534 __Pyx_GOTREF(__pyx_t_1);
4535 __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 273, __pyx_L1_error)
4536 __Pyx_GOTREF(__pyx_t_10);
4537 __Pyx_INCREF(__pyx_n_u_q);
4538 __Pyx_GIVEREF(__pyx_n_u_q);
4539 PyList_SET_ITEM(__pyx_t_10, 0, __pyx_n_u_q);
4540 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error)
4541 __Pyx_GOTREF(__pyx_t_2);
4542 __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 273, __pyx_L1_error)
4543 __Pyx_GOTREF(__pyx_t_9);
4544 __Pyx_GIVEREF(__pyx_t_2);
4545 PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
4546 __pyx_t_2 = 0;
4547 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error)
4548 __Pyx_GOTREF(__pyx_t_2);
4549 __Pyx_GIVEREF(__pyx_t_10);
4550 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
4551 __Pyx_GIVEREF(__pyx_t_9);
4552 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
4553 __pyx_t_10 = 0;
4554 __pyx_t_9 = 0;
4556 /* "MACS2/PeakDetect.pyx":274
4557 * else:
4558 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,],
4559 * min_length=self.minlen, # <<<<<<<<<<<<<<
4560 * max_gap=self.maxgap,
4561 * call_summits=call_summits,
4563 __pyx_t_9 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 274, __pyx_L1_error)
4564 __Pyx_GOTREF(__pyx_t_9);
4565 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 274, __pyx_L1_error)
4566 __Pyx_GOTREF(__pyx_t_10);
4567 if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_min_length, __pyx_t_10) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
4568 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4570 /* "MACS2/PeakDetect.pyx":275
4571 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,],
4572 * min_length=self.minlen,
4573 * max_gap=self.maxgap, # <<<<<<<<<<<<<<
4574 * call_summits=call_summits,
4575 * cutoff_analysis=self.opt.cutoff_analysis )
4577 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 275, __pyx_L1_error)
4578 __Pyx_GOTREF(__pyx_t_10);
4579 if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_max_gap, __pyx_t_10) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
4580 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4582 /* "MACS2/PeakDetect.pyx":276
4583 * min_length=self.minlen,
4584 * max_gap=self.maxgap,
4585 * call_summits=call_summits, # <<<<<<<<<<<<<<
4586 * cutoff_analysis=self.opt.cutoff_analysis )
4587 * scorecalculator.destroy()
4589 if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_call_summits, __pyx_v_call_summits) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
4591 /* "MACS2/PeakDetect.pyx":277
4592 * max_gap=self.maxgap,
4593 * call_summits=call_summits,
4594 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
4595 * scorecalculator.destroy()
4596 * return peaks
4598 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 277, __pyx_L1_error)
4599 __Pyx_GOTREF(__pyx_t_10);
4600 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 277, __pyx_L1_error)
4601 __Pyx_GOTREF(__pyx_t_6);
4602 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4603 if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_cutoff_analysis, __pyx_t_6) < 0) __PYX_ERR(0, 274, __pyx_L1_error)
4604 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4606 /* "MACS2/PeakDetect.pyx":273
4607 * cutoff_analysis=self.opt.cutoff_analysis )
4608 * else:
4609 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,], # <<<<<<<<<<<<<<
4610 * min_length=self.minlen,
4611 * max_gap=self.maxgap,
4613 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 273, __pyx_L1_error)
4614 __Pyx_GOTREF(__pyx_t_6);
4615 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4616 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4617 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4618 __pyx_v_peaks = __pyx_t_6;
4619 __pyx_t_6 = 0;
4621 __pyx_L20:;
4623 /* "MACS2/PeakDetect.pyx":262
4624 * call_summits=call_summits,
4625 * cutoff_analysis=self.opt.cutoff_analysis )
4626 * elif self.log_qvalue != None: # <<<<<<<<<<<<<<
4627 * if self.opt.broad:
4628 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
4631 __pyx_L18:;
4633 /* "MACS2/PeakDetect.pyx":278
4634 * call_summits=call_summits,
4635 * cutoff_analysis=self.opt.cutoff_analysis )
4636 * scorecalculator.destroy() # <<<<<<<<<<<<<<
4637 * return peaks
4640 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_destroy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error)
4641 __Pyx_GOTREF(__pyx_t_9);
4642 __pyx_t_2 = NULL;
4643 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
4644 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
4645 if (likely(__pyx_t_2)) {
4646 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
4647 __Pyx_INCREF(__pyx_t_2);
4648 __Pyx_INCREF(function);
4649 __Pyx_DECREF_SET(__pyx_t_9, function);
4652 __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
4653 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4654 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 278, __pyx_L1_error)
4655 __Pyx_GOTREF(__pyx_t_6);
4656 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4657 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4659 /* "MACS2/PeakDetect.pyx":279
4660 * cutoff_analysis=self.opt.cutoff_analysis )
4661 * scorecalculator.destroy()
4662 * return peaks # <<<<<<<<<<<<<<
4664 * def __call_peaks_wo_control (self):
4666 __Pyx_XDECREF(__pyx_r);
4667 if (unlikely(!__pyx_v_peaks)) { __Pyx_RaiseUnboundLocalError("peaks"); __PYX_ERR(0, 279, __pyx_L1_error) }
4668 __Pyx_INCREF(__pyx_v_peaks);
4669 __pyx_r = __pyx_v_peaks;
4670 goto __pyx_L0;
4672 /* "MACS2/PeakDetect.pyx":115
4673 * return self.peaks
4675 * def __call_peaks_w_control (self): # <<<<<<<<<<<<<<
4676 * """To call peaks with control data.
4680 /* function exit code */
4681 __pyx_L1_error:;
4682 __Pyx_XDECREF(__pyx_t_1);
4683 __Pyx_XDECREF(__pyx_t_2);
4684 __Pyx_XDECREF(__pyx_t_6);
4685 __Pyx_XDECREF(__pyx_t_9);
4686 __Pyx_XDECREF(__pyx_t_10);
4687 __Pyx_AddTraceback("MACS2.PeakDetect.PeakDetect.__call_peaks_w_control", __pyx_clineno, __pyx_lineno, __pyx_filename);
4688 __pyx_r = NULL;
4689 __pyx_L0:;
4690 __Pyx_XDECREF(__pyx_v_ctrl_scale_s);
4691 __Pyx_XDECREF(__pyx_v_ctrl_d_s);
4692 __Pyx_XDECREF(__pyx_v_tmp_v);
4693 __Pyx_XDECREF(__pyx_v_scorecalculator);
4694 __Pyx_XDECREF(__pyx_v_call_summits);
4695 __Pyx_XDECREF(__pyx_v_peaks);
4696 __Pyx_XGIVEREF(__pyx_r);
4697 __Pyx_TraceReturn(__pyx_r, 0);
4698 __Pyx_RefNannyFinishContext();
4699 return __pyx_r;
4702 /* "MACS2/PeakDetect.pyx":281
4703 * return peaks
4705 * def __call_peaks_wo_control (self): # <<<<<<<<<<<<<<
4706 * """To call peaks without control data.
4710 /* Python wrapper */
4711 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_7__call_peaks_wo_control(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4712 static char __pyx_doc_5MACS2_10PeakDetect_10PeakDetect_6__call_peaks_wo_control[] = "To call peaks without control data.\n\n A peak info type is a: dictionary\n\n key value: chromosome\n\n items: (peak start,peak end, peak length, peak summit, peak\n height, number of tags in peak region, peak pvalue, peak\n fold_enrichment) <-- tuple type\n\n While calculating pvalue:\n\n First, t and c will be adjusted by the ratio between total\n reads in treatment and total reads in control, depending on\n --to-small option.\n\n Then, t and c will be multiplied by the smallest peak size --\n self.d.\n\n Finally, a poisson CDF is applied to calculate one-side pvalue\n for enrichment.\n ";
4713 static PyMethodDef __pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_7__call_peaks_wo_control = {"__call_peaks_wo_control", (PyCFunction)__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_7__call_peaks_wo_control, METH_O, __pyx_doc_5MACS2_10PeakDetect_10PeakDetect_6__call_peaks_wo_control};
4714 static PyObject *__pyx_pw_5MACS2_10PeakDetect_10PeakDetect_7__call_peaks_wo_control(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4715 PyObject *__pyx_r = 0;
4716 __Pyx_RefNannyDeclarations
4717 __Pyx_RefNannySetupContext("__call_peaks_wo_control (wrapper)", 0);
4718 __pyx_r = __pyx_pf_5MACS2_10PeakDetect_10PeakDetect_6__call_peaks_wo_control(__pyx_self, ((PyObject *)__pyx_v_self));
4720 /* function exit code */
4721 __Pyx_RefNannyFinishContext();
4722 return __pyx_r;
4725 static PyObject *__pyx_pf_5MACS2_10PeakDetect_10PeakDetect_6__call_peaks_wo_control(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
4726 float __pyx_v_lambda_bg;
4727 CYTHON_UNUSED float __pyx_v_effective_depth_in_million;
4728 float __pyx_v_treat_scale;
4729 float __pyx_v_d;
4730 PyObject *__pyx_v_ctrl_scale_s = 0;
4731 PyObject *__pyx_v_ctrl_d_s = 0;
4732 PyObject *__pyx_v_treat_length = NULL;
4733 PyObject *__pyx_v_treat_total = NULL;
4734 PyObject *__pyx_v_scorecalculator = NULL;
4735 PyObject *__pyx_v_call_summits = NULL;
4736 PyObject *__pyx_v_peaks = NULL;
4737 PyObject *__pyx_r = NULL;
4738 __Pyx_TraceDeclarations
4739 __Pyx_RefNannyDeclarations
4740 PyObject *__pyx_t_1 = NULL;
4741 int __pyx_t_2;
4742 float __pyx_t_3;
4743 PyObject *__pyx_t_4 = NULL;
4744 PyObject *__pyx_t_5 = NULL;
4745 int __pyx_t_6;
4746 PyObject *__pyx_t_7 = NULL;
4747 PyObject *__pyx_t_8 = NULL;
4748 Py_ssize_t __pyx_t_9;
4749 Py_UCS4 __pyx_t_10;
4750 __Pyx_TraceFrameInit(__pyx_codeobj__6)
4751 __Pyx_RefNannySetupContext("__call_peaks_wo_control", 0);
4752 __Pyx_TraceCall("__call_peaks_wo_control", __pyx_f[0], 281, 0, __PYX_ERR(0, 281, __pyx_L1_error));
4754 /* "MACS2/PeakDetect.pyx":305
4755 * """
4756 * cdef float lambda_bg, effective_depth_in_million
4757 * cdef float treat_scale = 1 # <<<<<<<<<<<<<<
4758 * cdef float d
4759 * cdef list ctrl_scale_s, ctrl_d_s
4761 __pyx_v_treat_scale = 1.0;
4763 /* "MACS2/PeakDetect.pyx":309
4764 * cdef list ctrl_scale_s, ctrl_d_s
4766 * if self.PE_MODE: d = 0 # <<<<<<<<<<<<<<
4767 * else: d = self.d
4768 * treat_length = self.treat.length
4770 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PE_MODE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
4771 __Pyx_GOTREF(__pyx_t_1);
4772 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 309, __pyx_L1_error)
4773 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4774 if (__pyx_t_2) {
4775 __pyx_v_d = 0.0;
4776 goto __pyx_L3;
4779 /* "MACS2/PeakDetect.pyx":310
4781 * if self.PE_MODE: d = 0
4782 * else: d = self.d # <<<<<<<<<<<<<<
4783 * treat_length = self.treat.length
4784 * treat_total = self.treat.total
4786 /*else*/ {
4787 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
4788 __Pyx_GOTREF(__pyx_t_1);
4789 __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L1_error)
4790 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4791 __pyx_v_d = __pyx_t_3;
4793 __pyx_L3:;
4795 /* "MACS2/PeakDetect.pyx":311
4796 * if self.PE_MODE: d = 0
4797 * else: d = self.d
4798 * treat_length = self.treat.length # <<<<<<<<<<<<<<
4799 * treat_total = self.treat.total
4802 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
4803 __Pyx_GOTREF(__pyx_t_1);
4804 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error)
4805 __Pyx_GOTREF(__pyx_t_4);
4806 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4807 __pyx_v_treat_length = __pyx_t_4;
4808 __pyx_t_4 = 0;
4810 /* "MACS2/PeakDetect.pyx":312
4811 * else: d = self.d
4812 * treat_length = self.treat.length
4813 * treat_total = self.treat.total # <<<<<<<<<<<<<<
4815 * effective_depth_in_million = treat_total / 1000000.0
4817 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L1_error)
4818 __Pyx_GOTREF(__pyx_t_4);
4819 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_total); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
4820 __Pyx_GOTREF(__pyx_t_1);
4821 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4822 __pyx_v_treat_total = __pyx_t_1;
4823 __pyx_t_1 = 0;
4825 /* "MACS2/PeakDetect.pyx":314
4826 * treat_total = self.treat.total
4828 * effective_depth_in_million = treat_total / 1000000.0 # <<<<<<<<<<<<<<
4830 * # global lambda
4832 __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_treat_total, __pyx_float_1000000_0, 1000000.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
4833 __Pyx_GOTREF(__pyx_t_1);
4834 __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 314, __pyx_L1_error)
4835 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4836 __pyx_v_effective_depth_in_million = __pyx_t_3;
4838 /* "MACS2/PeakDetect.pyx":317
4840 * # global lambda
4841 * if self.PE_MODE: # <<<<<<<<<<<<<<
4842 * # # this an estimator, we should maybe test it for accuracy?
4843 * lambda_bg = treat_length / self.gsize
4845 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PE_MODE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
4846 __Pyx_GOTREF(__pyx_t_1);
4847 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 317, __pyx_L1_error)
4848 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4849 if (__pyx_t_2) {
4851 /* "MACS2/PeakDetect.pyx":319
4852 * if self.PE_MODE:
4853 * # # this an estimator, we should maybe test it for accuracy?
4854 * lambda_bg = treat_length / self.gsize # <<<<<<<<<<<<<<
4855 * else:
4856 * lambda_bg = float(d) * treat_total / self.gsize
4858 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
4859 __Pyx_GOTREF(__pyx_t_1);
4860 __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_v_treat_length, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
4861 __Pyx_GOTREF(__pyx_t_4);
4862 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4863 __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error)
4864 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4865 __pyx_v_lambda_bg = __pyx_t_3;
4867 /* "MACS2/PeakDetect.pyx":317
4869 * # global lambda
4870 * if self.PE_MODE: # <<<<<<<<<<<<<<
4871 * # # this an estimator, we should maybe test it for accuracy?
4872 * lambda_bg = treat_length / self.gsize
4874 goto __pyx_L4;
4877 /* "MACS2/PeakDetect.pyx":321
4878 * lambda_bg = treat_length / self.gsize
4879 * else:
4880 * lambda_bg = float(d) * treat_total / self.gsize # <<<<<<<<<<<<<<
4881 * treat_scale = 1.0
4884 /*else*/ {
4885 __pyx_t_4 = PyFloat_FromDouble(((double)__pyx_v_d)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
4886 __Pyx_GOTREF(__pyx_t_4);
4887 __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_v_treat_total); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
4888 __Pyx_GOTREF(__pyx_t_1);
4889 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4890 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
4891 __Pyx_GOTREF(__pyx_t_4);
4892 __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 321, __pyx_L1_error)
4893 __Pyx_GOTREF(__pyx_t_5);
4894 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4895 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4896 __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_5); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error)
4897 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4898 __pyx_v_lambda_bg = __pyx_t_3;
4900 __pyx_L4:;
4902 /* "MACS2/PeakDetect.pyx":322
4903 * else:
4904 * lambda_bg = float(d) * treat_total / self.gsize
4905 * treat_scale = 1.0 # <<<<<<<<<<<<<<
4907 * # slocal and d-size local bias are not calculated!
4909 __pyx_v_treat_scale = 1.0;
4911 /* "MACS2/PeakDetect.pyx":327
4912 * # nothing done here. should this match w control??
4914 * if not self.nolambda: # <<<<<<<<<<<<<<
4915 * if self.PE_MODE:
4916 * ctrl_scale_s = [ float(treat_length) / (self.lregion*treat_total*2), ]
4918 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nolambda); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
4919 __Pyx_GOTREF(__pyx_t_5);
4920 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 327, __pyx_L1_error)
4921 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4922 __pyx_t_6 = ((!__pyx_t_2) != 0);
4923 if (__pyx_t_6) {
4925 /* "MACS2/PeakDetect.pyx":328
4927 * if not self.nolambda:
4928 * if self.PE_MODE: # <<<<<<<<<<<<<<
4929 * ctrl_scale_s = [ float(treat_length) / (self.lregion*treat_total*2), ]
4930 * else:
4932 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_PE_MODE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
4933 __Pyx_GOTREF(__pyx_t_5);
4934 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 328, __pyx_L1_error)
4935 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4936 if (__pyx_t_6) {
4938 /* "MACS2/PeakDetect.pyx":329
4939 * if not self.nolambda:
4940 * if self.PE_MODE:
4941 * ctrl_scale_s = [ float(treat_length) / (self.lregion*treat_total*2), ] # <<<<<<<<<<<<<<
4942 * else:
4943 * ctrl_scale_s = [ float(self.d) / self.lregion, ]
4945 __pyx_t_5 = __Pyx_PyNumber_Float(__pyx_v_treat_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 329, __pyx_L1_error)
4946 __Pyx_GOTREF(__pyx_t_5);
4947 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
4948 __Pyx_GOTREF(__pyx_t_4);
4949 __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_v_treat_total); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
4950 __Pyx_GOTREF(__pyx_t_1);
4951 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4952 __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
4953 __Pyx_GOTREF(__pyx_t_4);
4954 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4955 __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
4956 __Pyx_GOTREF(__pyx_t_1);
4957 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4958 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4959 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)
4960 __Pyx_GOTREF(__pyx_t_4);
4961 __Pyx_GIVEREF(__pyx_t_1);
4962 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
4963 __pyx_t_1 = 0;
4964 __pyx_v_ctrl_scale_s = ((PyObject*)__pyx_t_4);
4965 __pyx_t_4 = 0;
4967 /* "MACS2/PeakDetect.pyx":328
4969 * if not self.nolambda:
4970 * if self.PE_MODE: # <<<<<<<<<<<<<<
4971 * ctrl_scale_s = [ float(treat_length) / (self.lregion*treat_total*2), ]
4972 * else:
4974 goto __pyx_L6;
4977 /* "MACS2/PeakDetect.pyx":331
4978 * ctrl_scale_s = [ float(treat_length) / (self.lregion*treat_total*2), ]
4979 * else:
4980 * ctrl_scale_s = [ float(self.d) / self.lregion, ] # <<<<<<<<<<<<<<
4981 * ctrl_d_s = [ self.lregion, ]
4982 * else:
4984 /*else*/ {
4985 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
4986 __Pyx_GOTREF(__pyx_t_4);
4987 __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
4988 __Pyx_GOTREF(__pyx_t_1);
4989 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4990 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
4991 __Pyx_GOTREF(__pyx_t_4);
4992 __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
4993 __Pyx_GOTREF(__pyx_t_5);
4994 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4995 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4996 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
4997 __Pyx_GOTREF(__pyx_t_4);
4998 __Pyx_GIVEREF(__pyx_t_5);
4999 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
5000 __pyx_t_5 = 0;
5001 __pyx_v_ctrl_scale_s = ((PyObject*)__pyx_t_4);
5002 __pyx_t_4 = 0;
5004 __pyx_L6:;
5006 /* "MACS2/PeakDetect.pyx":332
5007 * else:
5008 * ctrl_scale_s = [ float(self.d) / self.lregion, ]
5009 * ctrl_d_s = [ self.lregion, ] # <<<<<<<<<<<<<<
5010 * else:
5011 * ctrl_scale_s = []
5013 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lregion); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error)
5014 __Pyx_GOTREF(__pyx_t_4);
5015 __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
5016 __Pyx_GOTREF(__pyx_t_5);
5017 __Pyx_GIVEREF(__pyx_t_4);
5018 PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
5019 __pyx_t_4 = 0;
5020 __pyx_v_ctrl_d_s = ((PyObject*)__pyx_t_5);
5021 __pyx_t_5 = 0;
5023 /* "MACS2/PeakDetect.pyx":327
5024 * # nothing done here. should this match w control??
5026 * if not self.nolambda: # <<<<<<<<<<<<<<
5027 * if self.PE_MODE:
5028 * ctrl_scale_s = [ float(treat_length) / (self.lregion*treat_total*2), ]
5030 goto __pyx_L5;
5033 /* "MACS2/PeakDetect.pyx":334
5034 * ctrl_d_s = [ self.lregion, ]
5035 * else:
5036 * ctrl_scale_s = [] # <<<<<<<<<<<<<<
5037 * ctrl_d_s = []
5040 /*else*/ {
5041 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error)
5042 __Pyx_GOTREF(__pyx_t_5);
5043 __pyx_v_ctrl_scale_s = ((PyObject*)__pyx_t_5);
5044 __pyx_t_5 = 0;
5046 /* "MACS2/PeakDetect.pyx":335
5047 * else:
5048 * ctrl_scale_s = []
5049 * ctrl_d_s = [] # <<<<<<<<<<<<<<
5051 * scorecalculator = CallerFromAlignments( self.treat, None,
5053 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
5054 __Pyx_GOTREF(__pyx_t_5);
5055 __pyx_v_ctrl_d_s = ((PyObject*)__pyx_t_5);
5056 __pyx_t_5 = 0;
5058 __pyx_L5:;
5060 /* "MACS2/PeakDetect.pyx":337
5061 * ctrl_d_s = []
5063 * scorecalculator = CallerFromAlignments( self.treat, None, # <<<<<<<<<<<<<<
5064 * d = d, ctrl_d_s = ctrl_d_s,
5065 * treat_scaling_factor = treat_scale,
5067 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CallerFromAlignments); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
5068 __Pyx_GOTREF(__pyx_t_5);
5069 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_treat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
5070 __Pyx_GOTREF(__pyx_t_4);
5071 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
5072 __Pyx_GOTREF(__pyx_t_1);
5073 __Pyx_GIVEREF(__pyx_t_4);
5074 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
5075 __Pyx_INCREF(Py_None);
5076 __Pyx_GIVEREF(Py_None);
5077 PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
5078 __pyx_t_4 = 0;
5080 /* "MACS2/PeakDetect.pyx":338
5082 * scorecalculator = CallerFromAlignments( self.treat, None,
5083 * d = d, ctrl_d_s = ctrl_d_s, # <<<<<<<<<<<<<<
5084 * treat_scaling_factor = treat_scale,
5085 * ctrl_scaling_factor_s = ctrl_scale_s,
5087 __pyx_t_4 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
5088 __Pyx_GOTREF(__pyx_t_4);
5089 __pyx_t_7 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 338, __pyx_L1_error)
5090 __Pyx_GOTREF(__pyx_t_7);
5091 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_d, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5092 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5093 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ctrl_d_s, __pyx_v_ctrl_d_s) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5095 /* "MACS2/PeakDetect.pyx":339
5096 * scorecalculator = CallerFromAlignments( self.treat, None,
5097 * d = d, ctrl_d_s = ctrl_d_s,
5098 * treat_scaling_factor = treat_scale, # <<<<<<<<<<<<<<
5099 * ctrl_scaling_factor_s = ctrl_scale_s,
5100 * end_shift = self.end_shift,
5102 __pyx_t_7 = PyFloat_FromDouble(__pyx_v_treat_scale); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 339, __pyx_L1_error)
5103 __Pyx_GOTREF(__pyx_t_7);
5104 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_treat_scaling_factor, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5105 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5107 /* "MACS2/PeakDetect.pyx":340
5108 * d = d, ctrl_d_s = ctrl_d_s,
5109 * treat_scaling_factor = treat_scale,
5110 * ctrl_scaling_factor_s = ctrl_scale_s, # <<<<<<<<<<<<<<
5111 * end_shift = self.end_shift,
5112 * lambda_bg = lambda_bg,
5114 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ctrl_scaling_factor_s, __pyx_v_ctrl_scale_s) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5116 /* "MACS2/PeakDetect.pyx":341
5117 * treat_scaling_factor = treat_scale,
5118 * ctrl_scaling_factor_s = ctrl_scale_s,
5119 * end_shift = self.end_shift, # <<<<<<<<<<<<<<
5120 * lambda_bg = lambda_bg,
5121 * save_bedGraph = self.opt.store_bdg,
5123 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_end_shift); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error)
5124 __Pyx_GOTREF(__pyx_t_7);
5125 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_end_shift, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5126 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5128 /* "MACS2/PeakDetect.pyx":342
5129 * ctrl_scaling_factor_s = ctrl_scale_s,
5130 * end_shift = self.end_shift,
5131 * lambda_bg = lambda_bg, # <<<<<<<<<<<<<<
5132 * save_bedGraph = self.opt.store_bdg,
5133 * bedGraph_filename_prefix = self.opt.name,
5135 __pyx_t_7 = PyFloat_FromDouble(__pyx_v_lambda_bg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error)
5136 __Pyx_GOTREF(__pyx_t_7);
5137 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_lambda_bg, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5138 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5140 /* "MACS2/PeakDetect.pyx":343
5141 * end_shift = self.end_shift,
5142 * lambda_bg = lambda_bg,
5143 * save_bedGraph = self.opt.store_bdg, # <<<<<<<<<<<<<<
5144 * bedGraph_filename_prefix = self.opt.name,
5145 * bedGraph_treat_filename = self.opt.bdg_treat,
5147 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error)
5148 __Pyx_GOTREF(__pyx_t_7);
5149 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_store_bdg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error)
5150 __Pyx_GOTREF(__pyx_t_8);
5151 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5152 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_save_bedGraph, __pyx_t_8) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5153 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5155 /* "MACS2/PeakDetect.pyx":344
5156 * lambda_bg = lambda_bg,
5157 * save_bedGraph = self.opt.store_bdg,
5158 * bedGraph_filename_prefix = self.opt.name, # <<<<<<<<<<<<<<
5159 * bedGraph_treat_filename = self.opt.bdg_treat,
5160 * bedGraph_control_filename = self.opt.bdg_control,
5162 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L1_error)
5163 __Pyx_GOTREF(__pyx_t_8);
5164 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L1_error)
5165 __Pyx_GOTREF(__pyx_t_7);
5166 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5167 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_bedGraph_filename_prefix, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5168 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5170 /* "MACS2/PeakDetect.pyx":345
5171 * save_bedGraph = self.opt.store_bdg,
5172 * bedGraph_filename_prefix = self.opt.name,
5173 * bedGraph_treat_filename = self.opt.bdg_treat, # <<<<<<<<<<<<<<
5174 * bedGraph_control_filename = self.opt.bdg_control,
5175 * save_SPMR = self.opt.do_SPMR,
5177 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
5178 __Pyx_GOTREF(__pyx_t_7);
5179 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_bdg_treat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error)
5180 __Pyx_GOTREF(__pyx_t_8);
5181 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5182 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_bedGraph_treat_filename, __pyx_t_8) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5183 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5185 /* "MACS2/PeakDetect.pyx":346
5186 * bedGraph_filename_prefix = self.opt.name,
5187 * bedGraph_treat_filename = self.opt.bdg_treat,
5188 * bedGraph_control_filename = self.opt.bdg_control, # <<<<<<<<<<<<<<
5189 * save_SPMR = self.opt.do_SPMR,
5190 * cutoff_analysis_filename = self.opt.cutoff_analysis_file )
5192 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error)
5193 __Pyx_GOTREF(__pyx_t_8);
5194 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_bdg_control); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 346, __pyx_L1_error)
5195 __Pyx_GOTREF(__pyx_t_7);
5196 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5197 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_bedGraph_control_filename, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5198 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5200 /* "MACS2/PeakDetect.pyx":347
5201 * bedGraph_treat_filename = self.opt.bdg_treat,
5202 * bedGraph_control_filename = self.opt.bdg_control,
5203 * save_SPMR = self.opt.do_SPMR, # <<<<<<<<<<<<<<
5204 * cutoff_analysis_filename = self.opt.cutoff_analysis_file )
5207 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 347, __pyx_L1_error)
5208 __Pyx_GOTREF(__pyx_t_7);
5209 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_do_SPMR); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error)
5210 __Pyx_GOTREF(__pyx_t_8);
5211 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5212 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_save_SPMR, __pyx_t_8) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5213 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5215 /* "MACS2/PeakDetect.pyx":348
5216 * bedGraph_control_filename = self.opt.bdg_control,
5217 * save_SPMR = self.opt.do_SPMR,
5218 * cutoff_analysis_filename = self.opt.cutoff_analysis_file ) # <<<<<<<<<<<<<<
5220 * if self.opt.trackline: scorecalculator.enable_trackline()
5222 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error)
5223 __Pyx_GOTREF(__pyx_t_8);
5224 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_cutoff_analysis_file); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 348, __pyx_L1_error)
5225 __Pyx_GOTREF(__pyx_t_7);
5226 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5227 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cutoff_analysis_filename, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
5228 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5230 /* "MACS2/PeakDetect.pyx":337
5231 * ctrl_d_s = []
5233 * scorecalculator = CallerFromAlignments( self.treat, None, # <<<<<<<<<<<<<<
5234 * d = d, ctrl_d_s = ctrl_d_s,
5235 * treat_scaling_factor = treat_scale,
5237 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error)
5238 __Pyx_GOTREF(__pyx_t_7);
5239 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5240 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5241 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5242 __pyx_v_scorecalculator = __pyx_t_7;
5243 __pyx_t_7 = 0;
5245 /* "MACS2/PeakDetect.pyx":350
5246 * cutoff_analysis_filename = self.opt.cutoff_analysis_file )
5248 * if self.opt.trackline: scorecalculator.enable_trackline() # <<<<<<<<<<<<<<
5250 * # call peaks
5252 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
5253 __Pyx_GOTREF(__pyx_t_7);
5254 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_trackline); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error)
5255 __Pyx_GOTREF(__pyx_t_4);
5256 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5257 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 350, __pyx_L1_error)
5258 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5259 if (__pyx_t_6) {
5260 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_enable_trackline); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
5261 __Pyx_GOTREF(__pyx_t_7);
5262 __pyx_t_1 = NULL;
5263 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
5264 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
5265 if (likely(__pyx_t_1)) {
5266 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
5267 __Pyx_INCREF(__pyx_t_1);
5268 __Pyx_INCREF(function);
5269 __Pyx_DECREF_SET(__pyx_t_7, function);
5272 __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
5273 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5274 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error)
5275 __Pyx_GOTREF(__pyx_t_4);
5276 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5277 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5280 /* "MACS2/PeakDetect.pyx":353
5282 * # call peaks
5283 * call_summits = self.opt.call_summits # <<<<<<<<<<<<<<
5284 * if call_summits: self.info("#3 Going to call summits inside each peak ...")
5287 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
5288 __Pyx_GOTREF(__pyx_t_4);
5289 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_call_summits); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error)
5290 __Pyx_GOTREF(__pyx_t_7);
5291 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5292 __pyx_v_call_summits = __pyx_t_7;
5293 __pyx_t_7 = 0;
5295 /* "MACS2/PeakDetect.pyx":354
5296 * # call peaks
5297 * call_summits = self.opt.call_summits
5298 * if call_summits: self.info("#3 Going to call summits inside each peak ...") # <<<<<<<<<<<<<<
5300 * if self.log_pvalue != None:
5302 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_call_summits); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 354, __pyx_L1_error)
5303 if (__pyx_t_6) {
5304 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error)
5305 __Pyx_GOTREF(__pyx_t_4);
5306 __pyx_t_1 = NULL;
5307 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5308 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
5309 if (likely(__pyx_t_1)) {
5310 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5311 __Pyx_INCREF(__pyx_t_1);
5312 __Pyx_INCREF(function);
5313 __Pyx_DECREF_SET(__pyx_t_4, function);
5316 __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_u_3_Going_to_call_summits_inside) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_3_Going_to_call_summits_inside);
5317 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5318 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error)
5319 __Pyx_GOTREF(__pyx_t_7);
5320 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5321 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5324 /* "MACS2/PeakDetect.pyx":356
5325 * if call_summits: self.info("#3 Going to call summits inside each peak ...")
5327 * if self.log_pvalue != None: # <<<<<<<<<<<<<<
5328 * if self.opt.broad:
5329 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5331 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
5332 __Pyx_GOTREF(__pyx_t_7);
5333 __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
5334 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5335 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
5336 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5337 if (__pyx_t_6) {
5339 /* "MACS2/PeakDetect.pyx":357
5341 * if self.log_pvalue != None:
5342 * if self.opt.broad: # <<<<<<<<<<<<<<
5343 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5344 * peaks = scorecalculator.call_broadpeaks(['p',],
5346 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error)
5347 __Pyx_GOTREF(__pyx_t_4);
5348 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_broad); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 357, __pyx_L1_error)
5349 __Pyx_GOTREF(__pyx_t_7);
5350 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5351 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 357, __pyx_L1_error)
5352 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5353 if (__pyx_t_6) {
5355 /* "MACS2/PeakDetect.pyx":358
5356 * if self.log_pvalue != None:
5357 * if self.opt.broad:
5358 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) ) # <<<<<<<<<<<<<<
5359 * peaks = scorecalculator.call_broadpeaks(['p',],
5360 * lvl1_cutoff_s=[self.log_pvalue,],
5362 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
5363 __Pyx_GOTREF(__pyx_t_4);
5364 __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
5365 __Pyx_GOTREF(__pyx_t_1);
5366 __pyx_t_9 = 0;
5367 __pyx_t_10 = 127;
5368 __Pyx_INCREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l);
5369 __pyx_t_9 += 70;
5370 __Pyx_GIVEREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l);
5371 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_3_Call_broad_peaks_with_given_l);
5372 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
5373 __Pyx_GOTREF(__pyx_t_5);
5374 __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_kp_u_5f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
5375 __Pyx_GOTREF(__pyx_t_8);
5376 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5377 __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_10;
5378 __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
5379 __Pyx_GIVEREF(__pyx_t_8);
5380 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
5381 __pyx_t_8 = 0;
5382 __Pyx_INCREF(__pyx_kp_u__4);
5383 __pyx_t_9 += 2;
5384 __Pyx_GIVEREF(__pyx_kp_u__4);
5385 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__4);
5386 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
5387 __Pyx_GOTREF(__pyx_t_8);
5388 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
5389 __Pyx_GOTREF(__pyx_t_5);
5390 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5391 __pyx_t_8 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_kp_u_5f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
5392 __Pyx_GOTREF(__pyx_t_8);
5393 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5394 __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_10;
5395 __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
5396 __Pyx_GIVEREF(__pyx_t_8);
5397 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_8);
5398 __pyx_t_8 = 0;
5399 __Pyx_INCREF(__pyx_kp_u__5);
5400 __pyx_t_9 += 3;
5401 __Pyx_GIVEREF(__pyx_kp_u__5);
5402 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__5);
5403 __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
5404 __Pyx_GOTREF(__pyx_t_8);
5405 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5406 __pyx_t_1 = NULL;
5407 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5408 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
5409 if (likely(__pyx_t_1)) {
5410 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5411 __Pyx_INCREF(__pyx_t_1);
5412 __Pyx_INCREF(function);
5413 __Pyx_DECREF_SET(__pyx_t_4, function);
5416 __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8);
5417 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5418 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5419 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 358, __pyx_L1_error)
5420 __Pyx_GOTREF(__pyx_t_7);
5421 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5422 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5424 /* "MACS2/PeakDetect.pyx":359
5425 * if self.opt.broad:
5426 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5427 * peaks = scorecalculator.call_broadpeaks(['p',], # <<<<<<<<<<<<<<
5428 * lvl1_cutoff_s=[self.log_pvalue,],
5429 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5431 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_broadpeaks); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 359, __pyx_L1_error)
5432 __Pyx_GOTREF(__pyx_t_7);
5433 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error)
5434 __Pyx_GOTREF(__pyx_t_4);
5435 __Pyx_INCREF(__pyx_n_u_p);
5436 __Pyx_GIVEREF(__pyx_n_u_p);
5437 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_u_p);
5438 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error)
5439 __Pyx_GOTREF(__pyx_t_8);
5440 __Pyx_GIVEREF(__pyx_t_4);
5441 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
5442 __pyx_t_4 = 0;
5444 /* "MACS2/PeakDetect.pyx":360
5445 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5446 * peaks = scorecalculator.call_broadpeaks(['p',],
5447 * lvl1_cutoff_s=[self.log_pvalue,], # <<<<<<<<<<<<<<
5448 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5449 * min_length=self.minlen,
5451 __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
5452 __Pyx_GOTREF(__pyx_t_4);
5453 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
5454 __Pyx_GOTREF(__pyx_t_1);
5455 __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error)
5456 __Pyx_GOTREF(__pyx_t_5);
5457 __Pyx_GIVEREF(__pyx_t_1);
5458 PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
5459 __pyx_t_1 = 0;
5460 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_lvl1_cutoff_s, __pyx_t_5) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
5461 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5463 /* "MACS2/PeakDetect.pyx":361
5464 * peaks = scorecalculator.call_broadpeaks(['p',],
5465 * lvl1_cutoff_s=[self.log_pvalue,],
5466 * lvl2_cutoff_s=[self.opt.log_broadcutoff,], # <<<<<<<<<<<<<<
5467 * min_length=self.minlen,
5468 * lvl1_max_gap=self.maxgap,
5470 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 361, __pyx_L1_error)
5471 __Pyx_GOTREF(__pyx_t_5);
5472 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
5473 __Pyx_GOTREF(__pyx_t_1);
5474 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5475 __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 361, __pyx_L1_error)
5476 __Pyx_GOTREF(__pyx_t_5);
5477 __Pyx_GIVEREF(__pyx_t_1);
5478 PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
5479 __pyx_t_1 = 0;
5480 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_lvl2_cutoff_s, __pyx_t_5) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
5481 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5483 /* "MACS2/PeakDetect.pyx":362
5484 * lvl1_cutoff_s=[self.log_pvalue,],
5485 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5486 * min_length=self.minlen, # <<<<<<<<<<<<<<
5487 * lvl1_max_gap=self.maxgap,
5488 * lvl2_max_gap=self.maxgap*4,
5490 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error)
5491 __Pyx_GOTREF(__pyx_t_5);
5492 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_min_length, __pyx_t_5) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
5493 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5495 /* "MACS2/PeakDetect.pyx":363
5496 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5497 * min_length=self.minlen,
5498 * lvl1_max_gap=self.maxgap, # <<<<<<<<<<<<<<
5499 * lvl2_max_gap=self.maxgap*4,
5500 * cutoff_analysis=self.opt.cutoff_analysis )
5502 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 363, __pyx_L1_error)
5503 __Pyx_GOTREF(__pyx_t_5);
5504 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_lvl1_max_gap, __pyx_t_5) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
5505 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5507 /* "MACS2/PeakDetect.pyx":364
5508 * min_length=self.minlen,
5509 * lvl1_max_gap=self.maxgap,
5510 * lvl2_max_gap=self.maxgap*4, # <<<<<<<<<<<<<<
5511 * cutoff_analysis=self.opt.cutoff_analysis )
5512 * else:
5514 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error)
5515 __Pyx_GOTREF(__pyx_t_5);
5516 __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_int_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
5517 __Pyx_GOTREF(__pyx_t_1);
5518 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5519 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_lvl2_max_gap, __pyx_t_1) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
5520 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5522 /* "MACS2/PeakDetect.pyx":365
5523 * lvl1_max_gap=self.maxgap,
5524 * lvl2_max_gap=self.maxgap*4,
5525 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
5526 * else:
5527 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
5529 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
5530 __Pyx_GOTREF(__pyx_t_1);
5531 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error)
5532 __Pyx_GOTREF(__pyx_t_5);
5533 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5534 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cutoff_analysis, __pyx_t_5) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
5535 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5537 /* "MACS2/PeakDetect.pyx":359
5538 * if self.opt.broad:
5539 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5540 * peaks = scorecalculator.call_broadpeaks(['p',], # <<<<<<<<<<<<<<
5541 * lvl1_cutoff_s=[self.log_pvalue,],
5542 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5544 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error)
5545 __Pyx_GOTREF(__pyx_t_5);
5546 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5547 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5548 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5549 __pyx_v_peaks = __pyx_t_5;
5550 __pyx_t_5 = 0;
5552 /* "MACS2/PeakDetect.pyx":357
5554 * if self.log_pvalue != None:
5555 * if self.opt.broad: # <<<<<<<<<<<<<<
5556 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5557 * peaks = scorecalculator.call_broadpeaks(['p',],
5559 goto __pyx_L10;
5562 /* "MACS2/PeakDetect.pyx":367
5563 * cutoff_analysis=self.opt.cutoff_analysis )
5564 * else:
5565 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue) # <<<<<<<<<<<<<<
5566 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,],
5567 * min_length=self.minlen,
5569 /*else*/ {
5570 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 367, __pyx_L1_error)
5571 __Pyx_GOTREF(__pyx_t_4);
5572 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 367, __pyx_L1_error)
5573 __Pyx_GOTREF(__pyx_t_8);
5574 __pyx_t_7 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_3_Call_peaks_with_given_log10pv, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error)
5575 __Pyx_GOTREF(__pyx_t_7);
5576 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5577 __pyx_t_8 = NULL;
5578 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5579 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
5580 if (likely(__pyx_t_8)) {
5581 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5582 __Pyx_INCREF(__pyx_t_8);
5583 __Pyx_INCREF(function);
5584 __Pyx_DECREF_SET(__pyx_t_4, function);
5587 __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7);
5588 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5589 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5590 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error)
5591 __Pyx_GOTREF(__pyx_t_5);
5592 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5593 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5595 /* "MACS2/PeakDetect.pyx":368
5596 * else:
5597 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
5598 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,], # <<<<<<<<<<<<<<
5599 * min_length=self.minlen,
5600 * max_gap=self.maxgap,
5602 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_peaks); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 368, __pyx_L1_error)
5603 __Pyx_GOTREF(__pyx_t_5);
5604 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error)
5605 __Pyx_GOTREF(__pyx_t_4);
5606 __Pyx_INCREF(__pyx_n_u_p);
5607 __Pyx_GIVEREF(__pyx_n_u_p);
5608 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_u_p);
5609 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_pvalue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 368, __pyx_L1_error)
5610 __Pyx_GOTREF(__pyx_t_7);
5611 __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 368, __pyx_L1_error)
5612 __Pyx_GOTREF(__pyx_t_8);
5613 __Pyx_GIVEREF(__pyx_t_7);
5614 PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
5615 __pyx_t_7 = 0;
5616 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 368, __pyx_L1_error)
5617 __Pyx_GOTREF(__pyx_t_7);
5618 __Pyx_GIVEREF(__pyx_t_4);
5619 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
5620 __Pyx_GIVEREF(__pyx_t_8);
5621 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
5622 __pyx_t_4 = 0;
5623 __pyx_t_8 = 0;
5625 /* "MACS2/PeakDetect.pyx":369
5626 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
5627 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,],
5628 * min_length=self.minlen, # <<<<<<<<<<<<<<
5629 * max_gap=self.maxgap,
5630 * call_summits=call_summits,
5632 __pyx_t_8 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 369, __pyx_L1_error)
5633 __Pyx_GOTREF(__pyx_t_8);
5634 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error)
5635 __Pyx_GOTREF(__pyx_t_4);
5636 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_min_length, __pyx_t_4) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
5637 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5639 /* "MACS2/PeakDetect.pyx":370
5640 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,],
5641 * min_length=self.minlen,
5642 * max_gap=self.maxgap, # <<<<<<<<<<<<<<
5643 * call_summits=call_summits,
5644 * cutoff_analysis=self.opt.cutoff_analysis )
5646 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error)
5647 __Pyx_GOTREF(__pyx_t_4);
5648 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_max_gap, __pyx_t_4) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
5649 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5651 /* "MACS2/PeakDetect.pyx":371
5652 * min_length=self.minlen,
5653 * max_gap=self.maxgap,
5654 * call_summits=call_summits, # <<<<<<<<<<<<<<
5655 * cutoff_analysis=self.opt.cutoff_analysis )
5656 * elif self.log_qvalue != None:
5658 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_call_summits, __pyx_v_call_summits) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
5660 /* "MACS2/PeakDetect.pyx":372
5661 * max_gap=self.maxgap,
5662 * call_summits=call_summits,
5663 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
5664 * elif self.log_qvalue != None:
5665 * if self.opt.broad:
5667 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error)
5668 __Pyx_GOTREF(__pyx_t_4);
5669 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
5670 __Pyx_GOTREF(__pyx_t_1);
5671 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5672 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_cutoff_analysis, __pyx_t_1) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
5673 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5675 /* "MACS2/PeakDetect.pyx":368
5676 * else:
5677 * self.info("#3 Call peaks with given -log10pvalue cutoff: %.5f ..." % self.log_pvalue)
5678 * peaks = scorecalculator.call_peaks( ['p',], [self.log_pvalue,], # <<<<<<<<<<<<<<
5679 * min_length=self.minlen,
5680 * max_gap=self.maxgap,
5682 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
5683 __Pyx_GOTREF(__pyx_t_1);
5684 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5685 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5686 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5687 __pyx_v_peaks = __pyx_t_1;
5688 __pyx_t_1 = 0;
5690 __pyx_L10:;
5692 /* "MACS2/PeakDetect.pyx":356
5693 * if call_summits: self.info("#3 Going to call summits inside each peak ...")
5695 * if self.log_pvalue != None: # <<<<<<<<<<<<<<
5696 * if self.opt.broad:
5697 * self.info("#3 Call broad peaks with given level1 -log10pvalue cutoff and level2: %.5f, %.5f..." % (self.log_pvalue,self.opt.log_broadcutoff) )
5699 goto __pyx_L9;
5702 /* "MACS2/PeakDetect.pyx":373
5703 * call_summits=call_summits,
5704 * cutoff_analysis=self.opt.cutoff_analysis )
5705 * elif self.log_qvalue != None: # <<<<<<<<<<<<<<
5706 * if self.opt.broad:
5707 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
5709 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
5710 __Pyx_GOTREF(__pyx_t_1);
5711 __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error)
5712 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5713 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 373, __pyx_L1_error)
5714 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5715 if (__pyx_t_6) {
5717 /* "MACS2/PeakDetect.pyx":374
5718 * cutoff_analysis=self.opt.cutoff_analysis )
5719 * elif self.log_qvalue != None:
5720 * if self.opt.broad: # <<<<<<<<<<<<<<
5721 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
5722 * peaks = scorecalculator.call_broadpeaks(['q',],
5724 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 374, __pyx_L1_error)
5725 __Pyx_GOTREF(__pyx_t_8);
5726 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_broad); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
5727 __Pyx_GOTREF(__pyx_t_1);
5728 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5729 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 374, __pyx_L1_error)
5730 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5731 if (__pyx_t_6) {
5733 /* "MACS2/PeakDetect.pyx":375
5734 * elif self.log_qvalue != None:
5735 * if self.opt.broad:
5736 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) ) # <<<<<<<<<<<<<<
5737 * peaks = scorecalculator.call_broadpeaks(['q',],
5738 * lvl1_cutoff_s=[self.log_qvalue,],
5740 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_info); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 375, __pyx_L1_error)
5741 __Pyx_GOTREF(__pyx_t_8);
5742 __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error)
5743 __Pyx_GOTREF(__pyx_t_7);
5744 __pyx_t_9 = 0;
5745 __pyx_t_10 = 127;
5746 __Pyx_INCREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l_2);
5747 __pyx_t_9 += 70;
5748 __Pyx_GIVEREF(__pyx_kp_u_3_Call_broad_peaks_with_given_l_2);
5749 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_3_Call_broad_peaks_with_given_l_2);
5750 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error)
5751 __Pyx_GOTREF(__pyx_t_5);
5752 __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error)
5753 __Pyx_GOTREF(__pyx_t_4);
5754 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5755 __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_10;
5756 __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
5757 __Pyx_GIVEREF(__pyx_t_4);
5758 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
5759 __pyx_t_4 = 0;
5760 __Pyx_INCREF(__pyx_kp_u__4);
5761 __pyx_t_9 += 2;
5762 __Pyx_GIVEREF(__pyx_kp_u__4);
5763 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__4);
5764 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error)
5765 __Pyx_GOTREF(__pyx_t_4);
5766 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error)
5767 __Pyx_GOTREF(__pyx_t_5);
5768 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5769 __pyx_t_4 = __Pyx_PyObject_Format(__pyx_t_5, __pyx_n_u_f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error)
5770 __Pyx_GOTREF(__pyx_t_4);
5771 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5772 __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_10;
5773 __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
5774 __Pyx_GIVEREF(__pyx_t_4);
5775 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
5776 __pyx_t_4 = 0;
5777 __Pyx_INCREF(__pyx_kp_u__5);
5778 __pyx_t_9 += 3;
5779 __Pyx_GIVEREF(__pyx_kp_u__5);
5780 PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_kp_u__5);
5781 __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_7, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error)
5782 __Pyx_GOTREF(__pyx_t_4);
5783 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5784 __pyx_t_7 = NULL;
5785 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
5786 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
5787 if (likely(__pyx_t_7)) {
5788 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5789 __Pyx_INCREF(__pyx_t_7);
5790 __Pyx_INCREF(function);
5791 __Pyx_DECREF_SET(__pyx_t_8, function);
5794 __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4);
5795 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5796 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5797 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error)
5798 __Pyx_GOTREF(__pyx_t_1);
5799 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5800 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5802 /* "MACS2/PeakDetect.pyx":376
5803 * if self.opt.broad:
5804 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
5805 * peaks = scorecalculator.call_broadpeaks(['q',], # <<<<<<<<<<<<<<
5806 * lvl1_cutoff_s=[self.log_qvalue,],
5807 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5809 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_broadpeaks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
5810 __Pyx_GOTREF(__pyx_t_1);
5811 __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 376, __pyx_L1_error)
5812 __Pyx_GOTREF(__pyx_t_8);
5813 __Pyx_INCREF(__pyx_n_u_q);
5814 __Pyx_GIVEREF(__pyx_n_u_q);
5815 PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_q);
5816 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error)
5817 __Pyx_GOTREF(__pyx_t_4);
5818 __Pyx_GIVEREF(__pyx_t_8);
5819 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
5820 __pyx_t_8 = 0;
5822 /* "MACS2/PeakDetect.pyx":377
5823 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
5824 * peaks = scorecalculator.call_broadpeaks(['q',],
5825 * lvl1_cutoff_s=[self.log_qvalue,], # <<<<<<<<<<<<<<
5826 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5827 * min_length=self.minlen,
5829 __pyx_t_8 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 377, __pyx_L1_error)
5830 __Pyx_GOTREF(__pyx_t_8);
5831 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L1_error)
5832 __Pyx_GOTREF(__pyx_t_7);
5833 __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error)
5834 __Pyx_GOTREF(__pyx_t_5);
5835 __Pyx_GIVEREF(__pyx_t_7);
5836 PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
5837 __pyx_t_7 = 0;
5838 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_lvl1_cutoff_s, __pyx_t_5) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
5839 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5841 /* "MACS2/PeakDetect.pyx":378
5842 * peaks = scorecalculator.call_broadpeaks(['q',],
5843 * lvl1_cutoff_s=[self.log_qvalue,],
5844 * lvl2_cutoff_s=[self.opt.log_broadcutoff,], # <<<<<<<<<<<<<<
5845 * min_length=self.minlen,
5846 * lvl1_max_gap=self.maxgap,
5848 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
5849 __Pyx_GOTREF(__pyx_t_5);
5850 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log_broadcutoff); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L1_error)
5851 __Pyx_GOTREF(__pyx_t_7);
5852 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5853 __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
5854 __Pyx_GOTREF(__pyx_t_5);
5855 __Pyx_GIVEREF(__pyx_t_7);
5856 PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
5857 __pyx_t_7 = 0;
5858 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_lvl2_cutoff_s, __pyx_t_5) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
5859 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5861 /* "MACS2/PeakDetect.pyx":379
5862 * lvl1_cutoff_s=[self.log_qvalue,],
5863 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5864 * min_length=self.minlen, # <<<<<<<<<<<<<<
5865 * lvl1_max_gap=self.maxgap,
5866 * lvl2_max_gap=self.maxgap*4,
5868 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error)
5869 __Pyx_GOTREF(__pyx_t_5);
5870 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_min_length, __pyx_t_5) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
5871 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5873 /* "MACS2/PeakDetect.pyx":380
5874 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5875 * min_length=self.minlen,
5876 * lvl1_max_gap=self.maxgap, # <<<<<<<<<<<<<<
5877 * lvl2_max_gap=self.maxgap*4,
5878 * cutoff_analysis=self.opt.cutoff_analysis )
5880 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error)
5881 __Pyx_GOTREF(__pyx_t_5);
5882 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_lvl1_max_gap, __pyx_t_5) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
5883 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5885 /* "MACS2/PeakDetect.pyx":381
5886 * min_length=self.minlen,
5887 * lvl1_max_gap=self.maxgap,
5888 * lvl2_max_gap=self.maxgap*4, # <<<<<<<<<<<<<<
5889 * cutoff_analysis=self.opt.cutoff_analysis )
5890 * else:
5892 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 381, __pyx_L1_error)
5893 __Pyx_GOTREF(__pyx_t_5);
5894 __pyx_t_7 = PyNumber_Multiply(__pyx_t_5, __pyx_int_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 381, __pyx_L1_error)
5895 __Pyx_GOTREF(__pyx_t_7);
5896 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5897 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_lvl2_max_gap, __pyx_t_7) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
5898 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5900 /* "MACS2/PeakDetect.pyx":382
5901 * lvl1_max_gap=self.maxgap,
5902 * lvl2_max_gap=self.maxgap*4,
5903 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
5904 * else:
5905 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,],
5907 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 382, __pyx_L1_error)
5908 __Pyx_GOTREF(__pyx_t_7);
5909 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 382, __pyx_L1_error)
5910 __Pyx_GOTREF(__pyx_t_5);
5911 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5912 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_cutoff_analysis, __pyx_t_5) < 0) __PYX_ERR(0, 377, __pyx_L1_error)
5913 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5915 /* "MACS2/PeakDetect.pyx":376
5916 * if self.opt.broad:
5917 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
5918 * peaks = scorecalculator.call_broadpeaks(['q',], # <<<<<<<<<<<<<<
5919 * lvl1_cutoff_s=[self.log_qvalue,],
5920 * lvl2_cutoff_s=[self.opt.log_broadcutoff,],
5922 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error)
5923 __Pyx_GOTREF(__pyx_t_5);
5924 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5925 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5926 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5927 __pyx_v_peaks = __pyx_t_5;
5928 __pyx_t_5 = 0;
5930 /* "MACS2/PeakDetect.pyx":374
5931 * cutoff_analysis=self.opt.cutoff_analysis )
5932 * elif self.log_qvalue != None:
5933 * if self.opt.broad: # <<<<<<<<<<<<<<
5934 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
5935 * peaks = scorecalculator.call_broadpeaks(['q',],
5937 goto __pyx_L11;
5940 /* "MACS2/PeakDetect.pyx":384
5941 * cutoff_analysis=self.opt.cutoff_analysis )
5942 * else:
5943 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,], # <<<<<<<<<<<<<<
5944 * min_length=self.minlen,
5945 * max_gap=self.maxgap,
5947 /*else*/ {
5948 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_call_peaks); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
5949 __Pyx_GOTREF(__pyx_t_5);
5950 __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 384, __pyx_L1_error)
5951 __Pyx_GOTREF(__pyx_t_8);
5952 __Pyx_INCREF(__pyx_n_u_q);
5953 __Pyx_GIVEREF(__pyx_n_u_q);
5954 PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_q);
5955 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_log_qvalue); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
5956 __Pyx_GOTREF(__pyx_t_4);
5957 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
5958 __Pyx_GOTREF(__pyx_t_1);
5959 __Pyx_GIVEREF(__pyx_t_4);
5960 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
5961 __pyx_t_4 = 0;
5962 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
5963 __Pyx_GOTREF(__pyx_t_4);
5964 __Pyx_GIVEREF(__pyx_t_8);
5965 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
5966 __Pyx_GIVEREF(__pyx_t_1);
5967 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
5968 __pyx_t_8 = 0;
5969 __pyx_t_1 = 0;
5971 /* "MACS2/PeakDetect.pyx":385
5972 * else:
5973 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,],
5974 * min_length=self.minlen, # <<<<<<<<<<<<<<
5975 * max_gap=self.maxgap,
5976 * call_summits=call_summits,
5978 __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error)
5979 __Pyx_GOTREF(__pyx_t_1);
5980 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_minlen); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 385, __pyx_L1_error)
5981 __Pyx_GOTREF(__pyx_t_8);
5982 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_min_length, __pyx_t_8) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
5983 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5985 /* "MACS2/PeakDetect.pyx":386
5986 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,],
5987 * min_length=self.minlen,
5988 * max_gap=self.maxgap, # <<<<<<<<<<<<<<
5989 * call_summits=call_summits,
5990 * cutoff_analysis=self.opt.cutoff_analysis )
5992 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_maxgap); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 386, __pyx_L1_error)
5993 __Pyx_GOTREF(__pyx_t_8);
5994 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_gap, __pyx_t_8) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
5995 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5997 /* "MACS2/PeakDetect.pyx":387
5998 * min_length=self.minlen,
5999 * max_gap=self.maxgap,
6000 * call_summits=call_summits, # <<<<<<<<<<<<<<
6001 * cutoff_analysis=self.opt.cutoff_analysis )
6002 * scorecalculator.destroy()
6004 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_call_summits, __pyx_v_call_summits) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
6006 /* "MACS2/PeakDetect.pyx":388
6007 * max_gap=self.maxgap,
6008 * call_summits=call_summits,
6009 * cutoff_analysis=self.opt.cutoff_analysis ) # <<<<<<<<<<<<<<
6010 * scorecalculator.destroy()
6011 * return peaks
6013 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_opt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 388, __pyx_L1_error)
6014 __Pyx_GOTREF(__pyx_t_8);
6015 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_cutoff_analysis); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 388, __pyx_L1_error)
6016 __Pyx_GOTREF(__pyx_t_7);
6017 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6018 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cutoff_analysis, __pyx_t_7) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
6019 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6021 /* "MACS2/PeakDetect.pyx":384
6022 * cutoff_analysis=self.opt.cutoff_analysis )
6023 * else:
6024 * peaks = scorecalculator.call_peaks( ['q',], [self.log_qvalue,], # <<<<<<<<<<<<<<
6025 * min_length=self.minlen,
6026 * max_gap=self.maxgap,
6028 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 384, __pyx_L1_error)
6029 __Pyx_GOTREF(__pyx_t_7);
6030 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6031 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6032 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6033 __pyx_v_peaks = __pyx_t_7;
6034 __pyx_t_7 = 0;
6036 __pyx_L11:;
6038 /* "MACS2/PeakDetect.pyx":373
6039 * call_summits=call_summits,
6040 * cutoff_analysis=self.opt.cutoff_analysis )
6041 * elif self.log_qvalue != None: # <<<<<<<<<<<<<<
6042 * if self.opt.broad:
6043 * self.info("#3 Call broad peaks with given level1 -log10qvalue cutoff and level2: %f, %f..." % (self.log_qvalue,self.opt.log_broadcutoff) )
6046 __pyx_L9:;
6048 /* "MACS2/PeakDetect.pyx":389
6049 * call_summits=call_summits,
6050 * cutoff_analysis=self.opt.cutoff_analysis )
6051 * scorecalculator.destroy() # <<<<<<<<<<<<<<
6052 * return peaks
6055 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scorecalculator, __pyx_n_s_destroy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
6056 __Pyx_GOTREF(__pyx_t_1);
6057 __pyx_t_4 = NULL;
6058 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6059 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
6060 if (likely(__pyx_t_4)) {
6061 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6062 __Pyx_INCREF(__pyx_t_4);
6063 __Pyx_INCREF(function);
6064 __Pyx_DECREF_SET(__pyx_t_1, function);
6067 __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
6068 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6069 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L1_error)
6070 __Pyx_GOTREF(__pyx_t_7);
6071 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6072 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6074 /* "MACS2/PeakDetect.pyx":390
6075 * cutoff_analysis=self.opt.cutoff_analysis )
6076 * scorecalculator.destroy()
6077 * return peaks # <<<<<<<<<<<<<<
6079 * # def __diag_w_control (self):
6081 __Pyx_XDECREF(__pyx_r);
6082 if (unlikely(!__pyx_v_peaks)) { __Pyx_RaiseUnboundLocalError("peaks"); __PYX_ERR(0, 390, __pyx_L1_error) }
6083 __Pyx_INCREF(__pyx_v_peaks);
6084 __pyx_r = __pyx_v_peaks;
6085 goto __pyx_L0;
6087 /* "MACS2/PeakDetect.pyx":281
6088 * return peaks
6090 * def __call_peaks_wo_control (self): # <<<<<<<<<<<<<<
6091 * """To call peaks without control data.
6095 /* function exit code */
6096 __pyx_L1_error:;
6097 __Pyx_XDECREF(__pyx_t_1);
6098 __Pyx_XDECREF(__pyx_t_4);
6099 __Pyx_XDECREF(__pyx_t_5);
6100 __Pyx_XDECREF(__pyx_t_7);
6101 __Pyx_XDECREF(__pyx_t_8);
6102 __Pyx_AddTraceback("MACS2.PeakDetect.PeakDetect.__call_peaks_wo_control", __pyx_clineno, __pyx_lineno, __pyx_filename);
6103 __pyx_r = NULL;
6104 __pyx_L0:;
6105 __Pyx_XDECREF(__pyx_v_ctrl_scale_s);
6106 __Pyx_XDECREF(__pyx_v_ctrl_d_s);
6107 __Pyx_XDECREF(__pyx_v_treat_length);
6108 __Pyx_XDECREF(__pyx_v_treat_total);
6109 __Pyx_XDECREF(__pyx_v_scorecalculator);
6110 __Pyx_XDECREF(__pyx_v_call_summits);
6111 __Pyx_XDECREF(__pyx_v_peaks);
6112 __Pyx_XGIVEREF(__pyx_r);
6113 __Pyx_TraceReturn(__pyx_r, 0);
6114 __Pyx_RefNannyFinishContext();
6115 return __pyx_r;
6118 static PyMethodDef __pyx_methods[] = {
6119 {0, 0, 0, 0}
6122 static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) {
6123 static const char* internal_type_names[] = {
6124 "__pyx_ctuple_float",
6125 "__pyx_ctuple_float_struct",
6126 "__pyx_ctuple_long",
6127 "__pyx_ctuple_long_struct",
6130 const char** type_name = internal_type_names;
6131 while (*type_name) {
6132 if (__Pyx_StrEq(name, *type_name)) {
6133 PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
6134 goto bad;
6136 type_name++;
6138 if (0);
6139 else {
6140 if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
6142 return 0;
6143 bad:
6144 return -1;
6147 static int
6148 __Pyx_import_all_from(PyObject *locals, PyObject *v)
6150 PyObject *all = PyObject_GetAttrString(v, "__all__");
6151 PyObject *dict, *name, *value;
6152 int skip_leading_underscores = 0;
6153 int pos, err;
6154 if (all == NULL) {
6155 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
6156 return -1;
6157 PyErr_Clear();
6158 dict = PyObject_GetAttrString(v, "__dict__");
6159 if (dict == NULL) {
6160 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
6161 return -1;
6162 PyErr_SetString(PyExc_ImportError,
6163 "from-import-* object has no __dict__ and no __all__");
6164 return -1;
6166 #if PY_MAJOR_VERSION < 3
6167 all = PyObject_CallMethod(dict, (char *)"keys", NULL);
6168 #else
6169 all = PyMapping_Keys(dict);
6170 #endif
6171 Py_DECREF(dict);
6172 if (all == NULL)
6173 return -1;
6174 skip_leading_underscores = 1;
6176 for (pos = 0, err = 0; ; pos++) {
6177 name = PySequence_GetItem(all, pos);
6178 if (name == NULL) {
6179 if (!PyErr_ExceptionMatches(PyExc_IndexError))
6180 err = -1;
6181 else
6182 PyErr_Clear();
6183 break;
6185 if (skip_leading_underscores &&
6186 #if PY_MAJOR_VERSION < 3
6187 PyString_Check(name) &&
6188 PyString_AS_STRING(name)[0] == '_')
6189 #else
6190 PyUnicode_Check(name) &&
6191 PyUnicode_AS_UNICODE(name)[0] == '_')
6192 #endif
6194 Py_DECREF(name);
6195 continue;
6197 value = PyObject_GetAttr(v, name);
6198 if (value == NULL)
6199 err = -1;
6200 else if (PyDict_CheckExact(locals))
6201 err = PyDict_SetItem(locals, name, value);
6202 else
6203 err = PyObject_SetItem(locals, name, value);
6204 Py_DECREF(name);
6205 Py_XDECREF(value);
6206 if (err != 0)
6207 break;
6209 Py_DECREF(all);
6210 return err;
6212 static int __pyx_import_star(PyObject* m) {
6213 int i;
6214 int ret = -1;
6215 char* s;
6216 PyObject *locals = 0;
6217 PyObject *list = 0;
6218 #if PY_MAJOR_VERSION >= 3
6219 PyObject *utf8_name = 0;
6220 #endif
6221 PyObject *name;
6222 PyObject *item;
6223 locals = PyDict_New(); if (!locals) goto bad;
6224 if (__Pyx_import_all_from(locals, m) < 0) goto bad;
6225 list = PyDict_Items(locals); if (!list) goto bad;
6226 for(i=0; i<PyList_GET_SIZE(list); i++) {
6227 name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);
6228 item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);
6229 #if PY_MAJOR_VERSION >= 3
6230 utf8_name = PyUnicode_AsUTF8String(name);
6231 if (!utf8_name) goto bad;
6232 s = PyBytes_AS_STRING(utf8_name);
6233 if (__pyx_import_star_set(item, name, s) < 0) goto bad;
6234 Py_DECREF(utf8_name); utf8_name = 0;
6235 #else
6236 s = PyString_AsString(name);
6237 if (!s) goto bad;
6238 if (__pyx_import_star_set(item, name, s) < 0) goto bad;
6239 #endif
6241 ret = 0;
6242 bad:
6243 Py_XDECREF(locals);
6244 Py_XDECREF(list);
6245 #if PY_MAJOR_VERSION >= 3
6246 Py_XDECREF(utf8_name);
6247 #endif
6248 return ret;
6253 #if PY_MAJOR_VERSION >= 3
6254 #if CYTHON_PEP489_MULTI_PHASE_INIT
6255 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
6256 static int __pyx_pymod_exec_PeakDetect(PyObject* module); /*proto*/
6257 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
6258 {Py_mod_create, (void*)__pyx_pymod_create},
6259 {Py_mod_exec, (void*)__pyx_pymod_exec_PeakDetect},
6260 {0, NULL}
6262 #endif
6264 static struct PyModuleDef __pyx_moduledef = {
6265 PyModuleDef_HEAD_INIT,
6266 "PeakDetect",
6267 __pyx_k_Module_Description_Detect_peaks, /* m_doc */
6268 #if CYTHON_PEP489_MULTI_PHASE_INIT
6269 0, /* m_size */
6270 #else
6271 -1, /* m_size */
6272 #endif
6273 __pyx_methods /* m_methods */,
6274 #if CYTHON_PEP489_MULTI_PHASE_INIT
6275 __pyx_moduledef_slots, /* m_slots */
6276 #else
6277 NULL, /* m_reload */
6278 #endif
6279 NULL, /* m_traverse */
6280 NULL, /* m_clear */
6281 NULL /* m_free */
6283 #endif
6284 #ifndef CYTHON_SMALL_CODE
6285 #if defined(__clang__)
6286 #define CYTHON_SMALL_CODE
6287 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
6288 #define CYTHON_SMALL_CODE __attribute__((cold))
6289 #else
6290 #define CYTHON_SMALL_CODE
6291 #endif
6292 #endif
6294 static __Pyx_StringTabEntry __pyx_string_tab[] = {
6295 {&__pyx_kp_u_3_Call_broad_peaks_with_given_l, __pyx_k_3_Call_broad_peaks_with_given_l, sizeof(__pyx_k_3_Call_broad_peaks_with_given_l), 0, 1, 0, 0},
6296 {&__pyx_kp_u_3_Call_broad_peaks_with_given_l_2, __pyx_k_3_Call_broad_peaks_with_given_l_2, sizeof(__pyx_k_3_Call_broad_peaks_with_given_l_2), 0, 1, 0, 0},
6297 {&__pyx_kp_u_3_Call_peaks_with_given_log10pv, __pyx_k_3_Call_peaks_with_given_log10pv, sizeof(__pyx_k_3_Call_peaks_with_given_log10pv), 0, 1, 0, 0},
6298 {&__pyx_kp_u_3_DYNAMIC_LAMBDA_IS_DISABLED, __pyx_k_3_DYNAMIC_LAMBDA_IS_DISABLED, sizeof(__pyx_k_3_DYNAMIC_LAMBDA_IS_DISABLED), 0, 1, 0, 0},
6299 {&__pyx_kp_u_3_Going_to_call_summits_inside, __pyx_k_3_Going_to_call_summits_inside, sizeof(__pyx_k_3_Going_to_call_summits_inside), 0, 1, 0, 0},
6300 {&__pyx_kp_u_5f, __pyx_k_5f, sizeof(__pyx_k_5f), 0, 1, 0, 0},
6301 {&__pyx_n_s_CallerFromAlignments, __pyx_k_CallerFromAlignments, sizeof(__pyx_k_CallerFromAlignments), 0, 0, 1, 1},
6302 {&__pyx_kp_s_Class_to_do_the_peak_calling_e_g, __pyx_k_Class_to_do_the_peak_calling_e_g, sizeof(__pyx_k_Class_to_do_the_peak_calling_e_g), 0, 0, 1, 0},
6303 {&__pyx_n_s_MACS2_Constants, __pyx_k_MACS2_Constants, sizeof(__pyx_k_MACS2_Constants), 0, 0, 1, 1},
6304 {&__pyx_n_s_MACS2_IO_BedGraphIO, __pyx_k_MACS2_IO_BedGraphIO, sizeof(__pyx_k_MACS2_IO_BedGraphIO), 0, 0, 1, 1},
6305 {&__pyx_n_s_MACS2_IO_CallPeakUnit, __pyx_k_MACS2_IO_CallPeakUnit, sizeof(__pyx_k_MACS2_IO_CallPeakUnit), 0, 0, 1, 1},
6306 {&__pyx_n_s_MACS2_IO_PeakIO, __pyx_k_MACS2_IO_PeakIO, sizeof(__pyx_k_MACS2_IO_PeakIO), 0, 0, 1, 1},
6307 {&__pyx_n_s_MACS2_PeakDetect, __pyx_k_MACS2_PeakDetect, sizeof(__pyx_k_MACS2_PeakDetect), 0, 0, 1, 1},
6308 {&__pyx_kp_s_MACS2_PeakDetect_pyx, __pyx_k_MACS2_PeakDetect_pyx, sizeof(__pyx_k_MACS2_PeakDetect_pyx), 0, 0, 1, 0},
6309 {&__pyx_n_s_PE_MODE, __pyx_k_PE_MODE, sizeof(__pyx_k_PE_MODE), 0, 0, 1, 1},
6310 {&__pyx_n_s_PeakDetect, __pyx_k_PeakDetect, sizeof(__pyx_k_PeakDetect), 0, 0, 1, 1},
6311 {&__pyx_n_s_PeakDetect___call_peaks_w_contro, __pyx_k_PeakDetect___call_peaks_w_contro, sizeof(__pyx_k_PeakDetect___call_peaks_w_contro), 0, 0, 1, 1},
6312 {&__pyx_n_s_PeakDetect___call_peaks_wo_contr, __pyx_k_PeakDetect___call_peaks_wo_contr, sizeof(__pyx_k_PeakDetect___call_peaks_wo_contr), 0, 0, 1, 1},
6313 {&__pyx_n_s_PeakDetect___init, __pyx_k_PeakDetect___init, sizeof(__pyx_k_PeakDetect___init), 0, 0, 1, 1},
6314 {&__pyx_n_s_PeakDetect__call_peaks_w_contro, __pyx_k_PeakDetect__call_peaks_w_contro, sizeof(__pyx_k_PeakDetect__call_peaks_w_contro), 0, 0, 1, 1},
6315 {&__pyx_n_s_PeakDetect__call_peaks_wo_contr, __pyx_k_PeakDetect__call_peaks_wo_contr, sizeof(__pyx_k_PeakDetect__call_peaks_wo_contr), 0, 0, 1, 1},
6316 {&__pyx_n_s_PeakDetect_call_peaks, __pyx_k_PeakDetect_call_peaks, sizeof(__pyx_k_PeakDetect_call_peaks), 0, 0, 1, 1},
6317 {&__pyx_n_s_PeakIO, __pyx_k_PeakIO, sizeof(__pyx_k_PeakIO), 0, 0, 1, 1},
6318 {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
6319 {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0},
6320 {&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1},
6321 {&__pyx_n_s_average_template_length, __pyx_k_average_template_length, sizeof(__pyx_k_average_template_length), 0, 0, 1, 1},
6322 {&__pyx_n_s_bdg_control, __pyx_k_bdg_control, sizeof(__pyx_k_bdg_control), 0, 0, 1, 1},
6323 {&__pyx_n_s_bdg_treat, __pyx_k_bdg_treat, sizeof(__pyx_k_bdg_treat), 0, 0, 1, 1},
6324 {&__pyx_n_s_bedGraphIO, __pyx_k_bedGraphIO, sizeof(__pyx_k_bedGraphIO), 0, 0, 1, 1},
6325 {&__pyx_n_s_bedGraph_control_filename, __pyx_k_bedGraph_control_filename, sizeof(__pyx_k_bedGraph_control_filename), 0, 0, 1, 1},
6326 {&__pyx_n_s_bedGraph_filename_prefix, __pyx_k_bedGraph_filename_prefix, sizeof(__pyx_k_bedGraph_filename_prefix), 0, 0, 1, 1},
6327 {&__pyx_n_s_bedGraph_treat_filename, __pyx_k_bedGraph_treat_filename, sizeof(__pyx_k_bedGraph_treat_filename), 0, 0, 1, 1},
6328 {&__pyx_n_s_broad, __pyx_k_broad, sizeof(__pyx_k_broad), 0, 0, 1, 1},
6329 {&__pyx_n_s_call_broadpeaks, __pyx_k_call_broadpeaks, sizeof(__pyx_k_call_broadpeaks), 0, 0, 1, 1},
6330 {&__pyx_n_s_call_peaks, __pyx_k_call_peaks, sizeof(__pyx_k_call_peaks), 0, 0, 1, 1},
6331 {&__pyx_n_s_call_peaks_w_control, __pyx_k_call_peaks_w_control, sizeof(__pyx_k_call_peaks_w_control), 0, 0, 1, 1},
6332 {&__pyx_n_s_call_peaks_wo_control, __pyx_k_call_peaks_wo_control, sizeof(__pyx_k_call_peaks_wo_control), 0, 0, 1, 1},
6333 {&__pyx_n_s_call_summits, __pyx_k_call_summits, sizeof(__pyx_k_call_summits), 0, 0, 1, 1},
6334 {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1},
6335 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
6336 {&__pyx_n_s_control, __pyx_k_control, sizeof(__pyx_k_control), 0, 0, 1, 1},
6337 {&__pyx_n_s_control_sum, __pyx_k_control_sum, sizeof(__pyx_k_control_sum), 0, 0, 1, 1},
6338 {&__pyx_n_s_control_total, __pyx_k_control_total, sizeof(__pyx_k_control_total), 0, 0, 1, 1},
6339 {&__pyx_n_s_ctrl_d_s, __pyx_k_ctrl_d_s, sizeof(__pyx_k_ctrl_d_s), 0, 0, 1, 1},
6340 {&__pyx_n_s_ctrl_scale_s, __pyx_k_ctrl_scale_s, sizeof(__pyx_k_ctrl_scale_s), 0, 0, 1, 1},
6341 {&__pyx_n_s_ctrl_scaling_factor_s, __pyx_k_ctrl_scaling_factor_s, sizeof(__pyx_k_ctrl_scaling_factor_s), 0, 0, 1, 1},
6342 {&__pyx_n_s_cutoff_analysis, __pyx_k_cutoff_analysis, sizeof(__pyx_k_cutoff_analysis), 0, 0, 1, 1},
6343 {&__pyx_n_s_cutoff_analysis_file, __pyx_k_cutoff_analysis_file, sizeof(__pyx_k_cutoff_analysis_file), 0, 0, 1, 1},
6344 {&__pyx_n_s_cutoff_analysis_filename, __pyx_k_cutoff_analysis_filename, sizeof(__pyx_k_cutoff_analysis_filename), 0, 0, 1, 1},
6345 {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
6346 {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
6347 {&__pyx_n_s_destroy, __pyx_k_destroy, sizeof(__pyx_k_destroy), 0, 0, 1, 1},
6348 {&__pyx_n_s_do_SPMR, __pyx_k_do_SPMR, sizeof(__pyx_k_do_SPMR), 0, 0, 1, 1},
6349 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
6350 {&__pyx_n_s_effective_depth_in_million, __pyx_k_effective_depth_in_million, sizeof(__pyx_k_effective_depth_in_million), 0, 0, 1, 1},
6351 {&__pyx_n_s_enable_trackline, __pyx_k_enable_trackline, sizeof(__pyx_k_enable_trackline), 0, 0, 1, 1},
6352 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
6353 {&__pyx_n_s_end_shift, __pyx_k_end_shift, sizeof(__pyx_k_end_shift), 0, 0, 1, 1},
6354 {&__pyx_n_u_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 1, 0, 1},
6355 {&__pyx_n_s_final_peaks, __pyx_k_final_peaks, sizeof(__pyx_k_final_peaks), 0, 0, 1, 1},
6356 {&__pyx_n_s_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 0, 1, 1},
6357 {&__pyx_n_s_groupby, __pyx_k_groupby, sizeof(__pyx_k_groupby), 0, 0, 1, 1},
6358 {&__pyx_n_s_gsize, __pyx_k_gsize, sizeof(__pyx_k_gsize), 0, 0, 1, 1},
6359 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
6360 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
6361 {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
6362 {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
6363 {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
6364 {&__pyx_n_s_itemgetter, __pyx_k_itemgetter, sizeof(__pyx_k_itemgetter), 0, 0, 1, 1},
6365 {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
6366 {&__pyx_n_s_lambda_bg, __pyx_k_lambda_bg, sizeof(__pyx_k_lambda_bg), 0, 0, 1, 1},
6367 {&__pyx_n_s_largelocal, __pyx_k_largelocal, sizeof(__pyx_k_largelocal), 0, 0, 1, 1},
6368 {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
6369 {&__pyx_n_s_llocal, __pyx_k_llocal, sizeof(__pyx_k_llocal), 0, 0, 1, 1},
6370 {&__pyx_kp_u_llocal_can_t_be_smaller_than_d, __pyx_k_llocal_can_t_be_smaller_than_d, sizeof(__pyx_k_llocal_can_t_be_smaller_than_d), 0, 1, 0, 0},
6371 {&__pyx_kp_u_llocal_can_t_be_smaller_than_slo, __pyx_k_llocal_can_t_be_smaller_than_slo, sizeof(__pyx_k_llocal_can_t_be_smaller_than_slo), 0, 1, 0, 0},
6372 {&__pyx_n_s_log_broadcutoff, __pyx_k_log_broadcutoff, sizeof(__pyx_k_log_broadcutoff), 0, 0, 1, 1},
6373 {&__pyx_n_s_log_pvalue, __pyx_k_log_pvalue, sizeof(__pyx_k_log_pvalue), 0, 0, 1, 1},
6374 {&__pyx_n_s_log_qvalue, __pyx_k_log_qvalue, sizeof(__pyx_k_log_qvalue), 0, 0, 1, 1},
6375 {&__pyx_n_s_lregion, __pyx_k_lregion, sizeof(__pyx_k_lregion), 0, 0, 1, 1},
6376 {&__pyx_n_s_lvl1_cutoff_s, __pyx_k_lvl1_cutoff_s, sizeof(__pyx_k_lvl1_cutoff_s), 0, 0, 1, 1},
6377 {&__pyx_n_s_lvl1_max_gap, __pyx_k_lvl1_max_gap, sizeof(__pyx_k_lvl1_max_gap), 0, 0, 1, 1},
6378 {&__pyx_n_s_lvl2_cutoff_s, __pyx_k_lvl2_cutoff_s, sizeof(__pyx_k_lvl2_cutoff_s), 0, 0, 1, 1},
6379 {&__pyx_n_s_lvl2_max_gap, __pyx_k_lvl2_max_gap, sizeof(__pyx_k_lvl2_max_gap), 0, 0, 1, 1},
6380 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
6381 {&__pyx_n_s_max_gap, __pyx_k_max_gap, sizeof(__pyx_k_max_gap), 0, 0, 1, 1},
6382 {&__pyx_n_s_maxgap, __pyx_k_maxgap, sizeof(__pyx_k_maxgap), 0, 0, 1, 1},
6383 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
6384 {&__pyx_n_s_min_length, __pyx_k_min_length, sizeof(__pyx_k_min_length), 0, 0, 1, 1},
6385 {&__pyx_n_s_minlen, __pyx_k_minlen, sizeof(__pyx_k_minlen), 0, 0, 1, 1},
6386 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
6387 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
6388 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
6389 {&__pyx_n_s_nolambda, __pyx_k_nolambda, sizeof(__pyx_k_nolambda), 0, 0, 1, 1},
6390 {&__pyx_n_s_operator, __pyx_k_operator, sizeof(__pyx_k_operator), 0, 0, 1, 1},
6391 {&__pyx_n_s_opt, __pyx_k_opt, sizeof(__pyx_k_opt), 0, 0, 1, 1},
6392 {&__pyx_n_u_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 1, 0, 1},
6393 {&__pyx_n_s_peaks, __pyx_k_peaks, sizeof(__pyx_k_peaks), 0, 0, 1, 1},
6394 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
6395 {&__pyx_n_u_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 1, 0, 1},
6396 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
6397 {&__pyx_n_s_ratio, __pyx_k_ratio, sizeof(__pyx_k_ratio), 0, 0, 1, 1},
6398 {&__pyx_n_s_ratio_treat2control, __pyx_k_ratio_treat2control, sizeof(__pyx_k_ratio_treat2control), 0, 0, 1, 1},
6399 {&__pyx_n_s_save_SPMR, __pyx_k_save_SPMR, sizeof(__pyx_k_save_SPMR), 0, 0, 1, 1},
6400 {&__pyx_n_s_save_bedGraph, __pyx_k_save_bedGraph, sizeof(__pyx_k_save_bedGraph), 0, 0, 1, 1},
6401 {&__pyx_n_s_scorecalculator, __pyx_k_scorecalculator, sizeof(__pyx_k_scorecalculator), 0, 0, 1, 1},
6402 {&__pyx_n_s_scoretrack, __pyx_k_scoretrack, sizeof(__pyx_k_scoretrack), 0, 0, 1, 1},
6403 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
6404 {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1},
6405 {&__pyx_n_s_slocal, __pyx_k_slocal, sizeof(__pyx_k_slocal), 0, 0, 1, 1},
6406 {&__pyx_kp_u_slocal_can_t_be_smaller_than_d, __pyx_k_slocal_can_t_be_smaller_than_d, sizeof(__pyx_k_slocal_can_t_be_smaller_than_d), 0, 1, 0, 0},
6407 {&__pyx_n_s_smalllocal, __pyx_k_smalllocal, sizeof(__pyx_k_smalllocal), 0, 0, 1, 1},
6408 {&__pyx_n_s_sregion, __pyx_k_sregion, sizeof(__pyx_k_sregion), 0, 0, 1, 1},
6409 {&__pyx_n_s_store_bdg, __pyx_k_store_bdg, sizeof(__pyx_k_store_bdg), 0, 0, 1, 1},
6410 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
6411 {&__pyx_n_s_tmp_v, __pyx_k_tmp_v, sizeof(__pyx_k_tmp_v), 0, 0, 1, 1},
6412 {&__pyx_n_s_tocontrol, __pyx_k_tocontrol, sizeof(__pyx_k_tocontrol), 0, 0, 1, 1},
6413 {&__pyx_n_s_total, __pyx_k_total, sizeof(__pyx_k_total), 0, 0, 1, 1},
6414 {&__pyx_n_s_trackline, __pyx_k_trackline, sizeof(__pyx_k_trackline), 0, 0, 1, 1},
6415 {&__pyx_n_s_treat, __pyx_k_treat, sizeof(__pyx_k_treat), 0, 0, 1, 1},
6416 {&__pyx_n_s_treat_length, __pyx_k_treat_length, sizeof(__pyx_k_treat_length), 0, 0, 1, 1},
6417 {&__pyx_n_s_treat_scale, __pyx_k_treat_scale, sizeof(__pyx_k_treat_scale), 0, 0, 1, 1},
6418 {&__pyx_n_s_treat_scaling_factor, __pyx_k_treat_scaling_factor, sizeof(__pyx_k_treat_scaling_factor), 0, 0, 1, 1},
6419 {&__pyx_n_s_treat_sum, __pyx_k_treat_sum, sizeof(__pyx_k_treat_sum), 0, 0, 1, 1},
6420 {&__pyx_n_s_treat_total, __pyx_k_treat_total, sizeof(__pyx_k_treat_total), 0, 0, 1, 1},
6421 {&__pyx_n_s_tsize, __pyx_k_tsize, sizeof(__pyx_k_tsize), 0, 0, 1, 1},
6422 {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
6423 {0, 0, 0, 0, 0, 0, 0}
6425 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
6426 __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 24, __pyx_L1_error)
6427 return 0;
6428 __pyx_L1_error:;
6429 return -1;
6432 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
6433 __Pyx_RefNannyDeclarations
6434 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
6436 /* "MACS2/PeakDetect.pyx":36
6437 * >>> pd.call_peaks()
6438 * """
6439 * def __init__ (self,opt = None,treat = None, control = None, d = None, # <<<<<<<<<<<<<<
6440 * maxgap = None, minlen = None, slocal = None, llocal = None):
6441 * """Initialize the PeakDetect object.
6443 __pyx_tuple__8 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_opt, __pyx_n_s_treat, __pyx_n_s_control, __pyx_n_s_d, __pyx_n_s_maxgap, __pyx_n_s_minlen, __pyx_n_s_slocal, __pyx_n_s_llocal); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 36, __pyx_L1_error)
6444 __Pyx_GOTREF(__pyx_tuple__8);
6445 __Pyx_GIVEREF(__pyx_tuple__8);
6446 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_MACS2_PeakDetect_pyx, __pyx_n_s_init, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 36, __pyx_L1_error)
6447 __pyx_tuple__9 = PyTuple_Pack(8, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 36, __pyx_L1_error)
6448 __Pyx_GOTREF(__pyx_tuple__9);
6449 __Pyx_GIVEREF(__pyx_tuple__9);
6451 /* "MACS2/PeakDetect.pyx":97
6452 * #self.zwig_ctl= opt.zwig_ctl
6454 * def call_peaks (self): # <<<<<<<<<<<<<<
6455 * """Call peaks function.
6458 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 97, __pyx_L1_error)
6459 __Pyx_GOTREF(__pyx_tuple__10);
6460 __Pyx_GIVEREF(__pyx_tuple__10);
6461 __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_MACS2_PeakDetect_pyx, __pyx_n_s_call_peaks, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 97, __pyx_L1_error)
6463 /* "MACS2/PeakDetect.pyx":115
6464 * return self.peaks
6466 * def __call_peaks_w_control (self): # <<<<<<<<<<<<<<
6467 * """To call peaks with control data.
6470 __pyx_tuple__11 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_i, __pyx_n_s_lambda_bg, __pyx_n_s_effective_depth_in_million, __pyx_n_s_treat_scale, __pyx_n_s_d, __pyx_n_s_ctrl_scale_s, __pyx_n_s_ctrl_d_s, __pyx_n_s_treat_total, __pyx_n_s_control_total, __pyx_n_s_treat_sum, __pyx_n_s_control_sum, __pyx_n_s_tmp_v, __pyx_n_s_scorecalculator, __pyx_n_s_call_summits, __pyx_n_s_peaks); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 115, __pyx_L1_error)
6471 __Pyx_GOTREF(__pyx_tuple__11);
6472 __Pyx_GIVEREF(__pyx_tuple__11);
6473 __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_MACS2_PeakDetect_pyx, __pyx_n_s_call_peaks_w_control, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 115, __pyx_L1_error)
6475 /* "MACS2/PeakDetect.pyx":281
6476 * return peaks
6478 * def __call_peaks_wo_control (self): # <<<<<<<<<<<<<<
6479 * """To call peaks without control data.
6482 __pyx_tuple__12 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_lambda_bg, __pyx_n_s_effective_depth_in_million, __pyx_n_s_treat_scale, __pyx_n_s_d, __pyx_n_s_ctrl_scale_s, __pyx_n_s_ctrl_d_s, __pyx_n_s_treat_length, __pyx_n_s_treat_total, __pyx_n_s_scorecalculator, __pyx_n_s_call_summits, __pyx_n_s_peaks); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 281, __pyx_L1_error)
6483 __Pyx_GOTREF(__pyx_tuple__12);
6484 __Pyx_GIVEREF(__pyx_tuple__12);
6485 __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_MACS2_PeakDetect_pyx, __pyx_n_s_call_peaks_wo_control, 281, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 281, __pyx_L1_error)
6486 __Pyx_RefNannyFinishContext();
6487 return 0;
6488 __pyx_L1_error:;
6489 __Pyx_RefNannyFinishContext();
6490 return -1;
6493 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
6494 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6495 __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
6496 __pyx_float_1000000_0 = PyFloat_FromDouble(1000000.0); if (unlikely(!__pyx_float_1000000_0)) __PYX_ERR(0, 1, __pyx_L1_error)
6497 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
6498 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
6499 __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
6500 return 0;
6501 __pyx_L1_error:;
6502 return -1;
6505 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
6506 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
6507 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
6508 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
6509 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
6510 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
6511 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
6513 static int __Pyx_modinit_global_init_code(void) {
6514 __Pyx_RefNannyDeclarations
6515 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
6516 /*--- Global init code ---*/
6517 __Pyx_RefNannyFinishContext();
6518 return 0;
6521 static int __Pyx_modinit_variable_export_code(void) {
6522 __Pyx_RefNannyDeclarations
6523 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
6524 /*--- Variable export code ---*/
6525 __Pyx_RefNannyFinishContext();
6526 return 0;
6529 static int __Pyx_modinit_function_export_code(void) {
6530 __Pyx_RefNannyDeclarations
6531 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
6532 /*--- Function export code ---*/
6533 __Pyx_RefNannyFinishContext();
6534 return 0;
6537 static int __Pyx_modinit_type_init_code(void) {
6538 __Pyx_RefNannyDeclarations
6539 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
6540 /*--- Type init code ---*/
6541 __Pyx_RefNannyFinishContext();
6542 return 0;
6545 static int __Pyx_modinit_type_import_code(void) {
6546 __Pyx_RefNannyDeclarations
6547 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
6548 /*--- Type import code ---*/
6549 __Pyx_RefNannyFinishContext();
6550 return 0;
6553 static int __Pyx_modinit_variable_import_code(void) {
6554 __Pyx_RefNannyDeclarations
6555 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
6556 /*--- Variable import code ---*/
6557 __Pyx_RefNannyFinishContext();
6558 return 0;
6561 static int __Pyx_modinit_function_import_code(void) {
6562 __Pyx_RefNannyDeclarations
6563 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
6564 /*--- Function import code ---*/
6565 __Pyx_RefNannyFinishContext();
6566 return 0;
6570 #if PY_MAJOR_VERSION < 3
6571 #ifdef CYTHON_NO_PYINIT_EXPORT
6572 #define __Pyx_PyMODINIT_FUNC void
6573 #else
6574 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
6575 #endif
6576 #else
6577 #ifdef CYTHON_NO_PYINIT_EXPORT
6578 #define __Pyx_PyMODINIT_FUNC PyObject *
6579 #else
6580 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
6581 #endif
6582 #endif
6585 #if PY_MAJOR_VERSION < 3
6586 __Pyx_PyMODINIT_FUNC initPeakDetect(void) CYTHON_SMALL_CODE; /*proto*/
6587 __Pyx_PyMODINIT_FUNC initPeakDetect(void)
6588 #else
6589 __Pyx_PyMODINIT_FUNC PyInit_PeakDetect(void) CYTHON_SMALL_CODE; /*proto*/
6590 __Pyx_PyMODINIT_FUNC PyInit_PeakDetect(void)
6591 #if CYTHON_PEP489_MULTI_PHASE_INIT
6593 return PyModuleDef_Init(&__pyx_moduledef);
6595 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
6596 #if PY_VERSION_HEX >= 0x030700A1
6597 static PY_INT64_T main_interpreter_id = -1;
6598 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
6599 if (main_interpreter_id == -1) {
6600 main_interpreter_id = current_id;
6601 return (unlikely(current_id == -1)) ? -1 : 0;
6602 } else if (unlikely(main_interpreter_id != current_id))
6603 #else
6604 static PyInterpreterState *main_interpreter = NULL;
6605 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
6606 if (!main_interpreter) {
6607 main_interpreter = current_interpreter;
6608 } else if (unlikely(main_interpreter != current_interpreter))
6609 #endif
6611 PyErr_SetString(
6612 PyExc_ImportError,
6613 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
6614 return -1;
6616 return 0;
6618 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
6619 PyObject *value = PyObject_GetAttrString(spec, from_name);
6620 int result = 0;
6621 if (likely(value)) {
6622 if (allow_none || value != Py_None) {
6623 result = PyDict_SetItemString(moddict, to_name, value);
6625 Py_DECREF(value);
6626 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
6627 PyErr_Clear();
6628 } else {
6629 result = -1;
6631 return result;
6633 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
6634 PyObject *module = NULL, *moddict, *modname;
6635 if (__Pyx_check_single_interpreter())
6636 return NULL;
6637 if (__pyx_m)
6638 return __Pyx_NewRef(__pyx_m);
6639 modname = PyObject_GetAttrString(spec, "name");
6640 if (unlikely(!modname)) goto bad;
6641 module = PyModule_NewObject(modname);
6642 Py_DECREF(modname);
6643 if (unlikely(!module)) goto bad;
6644 moddict = PyModule_GetDict(module);
6645 if (unlikely(!moddict)) goto bad;
6646 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
6647 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
6648 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
6649 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
6650 return module;
6651 bad:
6652 Py_XDECREF(module);
6653 return NULL;
6657 static CYTHON_SMALL_CODE int __pyx_pymod_exec_PeakDetect(PyObject *__pyx_pyinit_module)
6658 #endif
6659 #endif
6661 __Pyx_TraceDeclarations
6662 PyObject *__pyx_t_1 = NULL;
6663 PyObject *__pyx_t_2 = NULL;
6664 __Pyx_RefNannyDeclarations
6665 #if CYTHON_PEP489_MULTI_PHASE_INIT
6666 if (__pyx_m) {
6667 if (__pyx_m == __pyx_pyinit_module) return 0;
6668 PyErr_SetString(PyExc_RuntimeError, "Module 'PeakDetect' has already been imported. Re-initialisation is not supported.");
6669 return -1;
6671 #elif PY_MAJOR_VERSION >= 3
6672 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
6673 #endif
6674 #if CYTHON_REFNANNY
6675 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
6676 if (!__Pyx_RefNanny) {
6677 PyErr_Clear();
6678 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
6679 if (!__Pyx_RefNanny)
6680 Py_FatalError("failed to import 'refnanny' module");
6682 #endif
6683 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_PeakDetect(void)", 0);
6684 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6685 #ifdef __Pxy_PyFrame_Initialize_Offsets
6686 __Pxy_PyFrame_Initialize_Offsets();
6687 #endif
6688 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
6689 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
6690 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
6691 #ifdef __Pyx_CyFunction_USED
6692 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6693 #endif
6694 #ifdef __Pyx_FusedFunction_USED
6695 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6696 #endif
6697 #ifdef __Pyx_Coroutine_USED
6698 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6699 #endif
6700 #ifdef __Pyx_Generator_USED
6701 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6702 #endif
6703 #ifdef __Pyx_AsyncGen_USED
6704 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6705 #endif
6706 #ifdef __Pyx_StopAsyncIteration_USED
6707 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6708 #endif
6709 /*--- Library function declarations ---*/
6710 /*--- Threads initialization code ---*/
6711 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
6712 #ifdef WITH_THREAD /* Python build with threading support? */
6713 PyEval_InitThreads();
6714 #endif
6715 #endif
6716 /*--- Module creation code ---*/
6717 #if CYTHON_PEP489_MULTI_PHASE_INIT
6718 __pyx_m = __pyx_pyinit_module;
6719 Py_INCREF(__pyx_m);
6720 #else
6721 #if PY_MAJOR_VERSION < 3
6722 __pyx_m = Py_InitModule4("PeakDetect", __pyx_methods, __pyx_k_Module_Description_Detect_peaks, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
6723 #else
6724 __pyx_m = PyModule_Create(&__pyx_moduledef);
6725 #endif
6726 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
6727 #endif
6728 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
6729 Py_INCREF(__pyx_d);
6730 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
6731 Py_INCREF(__pyx_b);
6732 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
6733 Py_INCREF(__pyx_cython_runtime);
6734 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6735 /*--- Initialize various global constants etc. ---*/
6736 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6737 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
6738 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6739 #endif
6740 if (__pyx_module_is_main_MACS2__PeakDetect) {
6741 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6743 #if PY_MAJOR_VERSION >= 3
6745 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
6746 if (!PyDict_GetItemString(modules, "MACS2.PeakDetect")) {
6747 if (unlikely(PyDict_SetItemString(modules, "MACS2.PeakDetect", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6750 #endif
6751 /*--- Builtin init code ---*/
6752 if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
6753 /*--- Constants init code ---*/
6754 if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
6755 /*--- Global type/function init code ---*/
6756 (void)__Pyx_modinit_global_init_code();
6757 (void)__Pyx_modinit_variable_export_code();
6758 (void)__Pyx_modinit_function_export_code();
6759 (void)__Pyx_modinit_type_init_code();
6760 (void)__Pyx_modinit_type_import_code();
6761 (void)__Pyx_modinit_variable_import_code();
6762 (void)__Pyx_modinit_function_import_code();
6763 /*--- Execution code ---*/
6764 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
6765 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6766 #endif
6767 __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_PeakDetect(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
6769 /* "MACS2/PeakDetect.pyx":12
6770 * """
6772 * from itertools import groupby # <<<<<<<<<<<<<<
6773 * from operator import itemgetter
6774 * import io
6776 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
6777 __Pyx_GOTREF(__pyx_t_1);
6778 __Pyx_INCREF(__pyx_n_s_groupby);
6779 __Pyx_GIVEREF(__pyx_n_s_groupby);
6780 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_groupby);
6781 __pyx_t_2 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
6782 __Pyx_GOTREF(__pyx_t_2);
6783 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6784 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_groupby); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
6785 __Pyx_GOTREF(__pyx_t_1);
6786 if (PyDict_SetItem(__pyx_d, __pyx_n_s_groupby, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
6787 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6788 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6790 /* "MACS2/PeakDetect.pyx":13
6792 * from itertools import groupby
6793 * from operator import itemgetter # <<<<<<<<<<<<<<
6794 * import io
6795 * import gc # use garbage collectior
6797 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
6798 __Pyx_GOTREF(__pyx_t_2);
6799 __Pyx_INCREF(__pyx_n_s_itemgetter);
6800 __Pyx_GIVEREF(__pyx_n_s_itemgetter);
6801 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_itemgetter);
6802 __pyx_t_1 = __Pyx_Import(__pyx_n_s_operator, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
6803 __Pyx_GOTREF(__pyx_t_1);
6804 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6805 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_itemgetter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
6806 __Pyx_GOTREF(__pyx_t_2);
6807 if (PyDict_SetItem(__pyx_d, __pyx_n_s_itemgetter, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
6808 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6809 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6811 /* "MACS2/PeakDetect.pyx":14
6812 * from itertools import groupby
6813 * from operator import itemgetter
6814 * import io # <<<<<<<<<<<<<<
6815 * import gc # use garbage collectior
6818 __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
6819 __Pyx_GOTREF(__pyx_t_1);
6820 if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
6821 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6823 /* "MACS2/PeakDetect.pyx":15
6824 * from operator import itemgetter
6825 * import io
6826 * import gc # use garbage collectior # <<<<<<<<<<<<<<
6828 * from MACS2.IO.PeakIO import PeakIO
6830 __pyx_t_1 = __Pyx_Import(__pyx_n_s_gc, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
6831 __Pyx_GOTREF(__pyx_t_1);
6832 if (PyDict_SetItem(__pyx_d, __pyx_n_s_gc, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
6833 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6835 /* "MACS2/PeakDetect.pyx":17
6836 * import gc # use garbage collectior
6838 * from MACS2.IO.PeakIO import PeakIO # <<<<<<<<<<<<<<
6839 * from MACS2.IO.BedGraphIO import bedGraphIO
6840 * from MACS2.Constants import *
6842 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
6843 __Pyx_GOTREF(__pyx_t_1);
6844 __Pyx_INCREF(__pyx_n_s_PeakIO);
6845 __Pyx_GIVEREF(__pyx_n_s_PeakIO);
6846 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PeakIO);
6847 __pyx_t_2 = __Pyx_Import(__pyx_n_s_MACS2_IO_PeakIO, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
6848 __Pyx_GOTREF(__pyx_t_2);
6849 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6850 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PeakIO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
6851 __Pyx_GOTREF(__pyx_t_1);
6852 if (PyDict_SetItem(__pyx_d, __pyx_n_s_PeakIO, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
6853 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6854 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6856 /* "MACS2/PeakDetect.pyx":18
6858 * from MACS2.IO.PeakIO import PeakIO
6859 * from MACS2.IO.BedGraphIO import bedGraphIO # <<<<<<<<<<<<<<
6860 * from MACS2.Constants import *
6861 * from MACS2.IO.CallPeakUnit import CallerFromAlignments
6863 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
6864 __Pyx_GOTREF(__pyx_t_2);
6865 __Pyx_INCREF(__pyx_n_s_bedGraphIO);
6866 __Pyx_GIVEREF(__pyx_n_s_bedGraphIO);
6867 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_bedGraphIO);
6868 __pyx_t_1 = __Pyx_Import(__pyx_n_s_MACS2_IO_BedGraphIO, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
6869 __Pyx_GOTREF(__pyx_t_1);
6870 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6871 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_bedGraphIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
6872 __Pyx_GOTREF(__pyx_t_2);
6873 if (PyDict_SetItem(__pyx_d, __pyx_n_s_bedGraphIO, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
6874 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6875 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6877 /* "MACS2/PeakDetect.pyx":19
6878 * from MACS2.IO.PeakIO import PeakIO
6879 * from MACS2.IO.BedGraphIO import bedGraphIO
6880 * from MACS2.Constants import * # <<<<<<<<<<<<<<
6881 * from MACS2.IO.CallPeakUnit import CallerFromAlignments
6884 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
6885 __Pyx_GOTREF(__pyx_t_1);
6886 __Pyx_INCREF(__pyx_n_s__7);
6887 __Pyx_GIVEREF(__pyx_n_s__7);
6888 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__7);
6889 __pyx_t_2 = __Pyx_Import(__pyx_n_s_MACS2_Constants, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
6890 __Pyx_GOTREF(__pyx_t_2);
6891 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6892 if (__pyx_import_star(__pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error);
6893 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6895 /* "MACS2/PeakDetect.pyx":20
6896 * from MACS2.IO.BedGraphIO import bedGraphIO
6897 * from MACS2.Constants import *
6898 * from MACS2.IO.CallPeakUnit import CallerFromAlignments # <<<<<<<<<<<<<<
6900 * cdef bytes subpeak_letters(short i):
6902 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
6903 __Pyx_GOTREF(__pyx_t_2);
6904 __Pyx_INCREF(__pyx_n_s_CallerFromAlignments);
6905 __Pyx_GIVEREF(__pyx_n_s_CallerFromAlignments);
6906 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_CallerFromAlignments);
6907 __pyx_t_1 = __Pyx_Import(__pyx_n_s_MACS2_IO_CallPeakUnit, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
6908 __Pyx_GOTREF(__pyx_t_1);
6909 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6910 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_CallerFromAlignments); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
6911 __Pyx_GOTREF(__pyx_t_2);
6912 if (PyDict_SetItem(__pyx_d, __pyx_n_s_CallerFromAlignments, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
6913 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6914 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6916 /* "MACS2/PeakDetect.pyx":28
6917 * return subpeak_letters(i // 26) + chr(97 + (i % 26)).encode()
6919 * class PeakDetect: # <<<<<<<<<<<<<<
6920 * """Class to do the peak calling.
6923 __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_PeakDetect, __pyx_n_s_PeakDetect, (PyObject *) NULL, __pyx_n_s_MACS2_PeakDetect, __pyx_kp_s_Class_to_do_the_peak_calling_e_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
6924 __Pyx_GOTREF(__pyx_t_1);
6926 /* "MACS2/PeakDetect.pyx":36
6927 * >>> pd.call_peaks()
6928 * """
6929 * def __init__ (self,opt = None,treat = None, control = None, d = None, # <<<<<<<<<<<<<<
6930 * maxgap = None, minlen = None, slocal = None, llocal = None):
6931 * """Initialize the PeakDetect object.
6933 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_1__init__, 0, __pyx_n_s_PeakDetect___init, NULL, __pyx_n_s_MACS2_PeakDetect, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
6934 __Pyx_GOTREF(__pyx_t_2);
6935 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__9);
6936 if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
6937 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6939 /* "MACS2/PeakDetect.pyx":97
6940 * #self.zwig_ctl= opt.zwig_ctl
6942 * def call_peaks (self): # <<<<<<<<<<<<<<
6943 * """Call peaks function.
6946 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_3call_peaks, 0, __pyx_n_s_PeakDetect_call_peaks, NULL, __pyx_n_s_MACS2_PeakDetect, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
6947 __Pyx_GOTREF(__pyx_t_2);
6948 if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_call_peaks, __pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
6949 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6951 /* "MACS2/PeakDetect.pyx":115
6952 * return self.peaks
6954 * def __call_peaks_w_control (self): # <<<<<<<<<<<<<<
6955 * """To call peaks with control data.
6958 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_5__call_peaks_w_control, 0, __pyx_n_s_PeakDetect___call_peaks_w_contro, NULL, __pyx_n_s_MACS2_PeakDetect, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
6959 __Pyx_GOTREF(__pyx_t_2);
6960 if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_PeakDetect__call_peaks_w_contro, __pyx_t_2) < 0) __PYX_ERR(0, 115, __pyx_L1_error)
6961 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6963 /* "MACS2/PeakDetect.pyx":281
6964 * return peaks
6966 * def __call_peaks_wo_control (self): # <<<<<<<<<<<<<<
6967 * """To call peaks without control data.
6970 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5MACS2_10PeakDetect_10PeakDetect_7__call_peaks_wo_control, 0, __pyx_n_s_PeakDetect___call_peaks_wo_contr, NULL, __pyx_n_s_MACS2_PeakDetect, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error)
6971 __Pyx_GOTREF(__pyx_t_2);
6972 if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_PeakDetect__call_peaks_wo_contr, __pyx_t_2) < 0) __PYX_ERR(0, 281, __pyx_L1_error)
6973 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6975 /* "MACS2/PeakDetect.pyx":28
6976 * return subpeak_letters(i // 26) + chr(97 + (i % 26)).encode()
6978 * class PeakDetect: # <<<<<<<<<<<<<<
6979 * """Class to do the peak calling.
6982 __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_PeakDetect, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
6983 __Pyx_GOTREF(__pyx_t_2);
6984 if (PyDict_SetItem(__pyx_d, __pyx_n_s_PeakDetect, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
6985 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6986 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6988 /* "MACS2/PeakDetect.pyx":1
6989 * # cython: language_level=3 # <<<<<<<<<<<<<<
6990 * # cython: profile=True
6991 * # Time-stamp: <2019-10-30 16:33:34 taoliu>
6993 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
6994 __Pyx_GOTREF(__pyx_t_1);
6995 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6996 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6997 __Pyx_TraceReturn(Py_None, 0);
6999 /*--- Wrapped vars code ---*/
7001 goto __pyx_L0;
7002 __pyx_L1_error:;
7003 __Pyx_XDECREF(__pyx_t_1);
7004 __Pyx_XDECREF(__pyx_t_2);
7005 if (__pyx_m) {
7006 if (__pyx_d) {
7007 __Pyx_AddTraceback("init MACS2.PeakDetect", __pyx_clineno, __pyx_lineno, __pyx_filename);
7009 Py_CLEAR(__pyx_m);
7010 } else if (!PyErr_Occurred()) {
7011 PyErr_SetString(PyExc_ImportError, "init MACS2.PeakDetect");
7013 __pyx_L0:;
7014 __Pyx_RefNannyFinishContext();
7015 #if CYTHON_PEP489_MULTI_PHASE_INIT
7016 return (__pyx_m != NULL) ? 0 : -1;
7017 #elif PY_MAJOR_VERSION >= 3
7018 return __pyx_m;
7019 #else
7020 return;
7021 #endif
7024 /* --- Runtime support code --- */
7025 /* Refnanny */
7026 #if CYTHON_REFNANNY
7027 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
7028 PyObject *m = NULL, *p = NULL;
7029 void *r = NULL;
7030 m = PyImport_ImportModule(modname);
7031 if (!m) goto end;
7032 p = PyObject_GetAttrString(m, "RefNannyAPI");
7033 if (!p) goto end;
7034 r = PyLong_AsVoidPtr(p);
7035 end:
7036 Py_XDECREF(p);
7037 Py_XDECREF(m);
7038 return (__Pyx_RefNannyAPIStruct *)r;
7040 #endif
7042 /* PyObjectGetAttrStr */
7043 #if CYTHON_USE_TYPE_SLOTS
7044 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
7045 PyTypeObject* tp = Py_TYPE(obj);
7046 if (likely(tp->tp_getattro))
7047 return tp->tp_getattro(obj, attr_name);
7048 #if PY_MAJOR_VERSION < 3
7049 if (likely(tp->tp_getattr))
7050 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
7051 #endif
7052 return PyObject_GetAttr(obj, attr_name);
7054 #endif
7056 /* GetBuiltinName */
7057 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
7058 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
7059 if (unlikely(!result)) {
7060 PyErr_Format(PyExc_NameError,
7061 #if PY_MAJOR_VERSION >= 3
7062 "name '%U' is not defined", name);
7063 #else
7064 "name '%.200s' is not defined", PyString_AS_STRING(name));
7065 #endif
7067 return result;
7070 /* PyErrFetchRestore */
7071 #if CYTHON_FAST_THREAD_STATE
7072 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
7073 PyObject *tmp_type, *tmp_value, *tmp_tb;
7074 tmp_type = tstate->curexc_type;
7075 tmp_value = tstate->curexc_value;
7076 tmp_tb = tstate->curexc_traceback;
7077 tstate->curexc_type = type;
7078 tstate->curexc_value = value;
7079 tstate->curexc_traceback = tb;
7080 Py_XDECREF(tmp_type);
7081 Py_XDECREF(tmp_value);
7082 Py_XDECREF(tmp_tb);
7084 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
7085 *type = tstate->curexc_type;
7086 *value = tstate->curexc_value;
7087 *tb = tstate->curexc_traceback;
7088 tstate->curexc_type = 0;
7089 tstate->curexc_value = 0;
7090 tstate->curexc_traceback = 0;
7092 #endif
7094 /* Profile */
7095 #if CYTHON_PROFILE
7096 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
7097 PyFrameObject** frame,
7098 PyThreadState* tstate,
7099 const char *funcname,
7100 const char *srcfile,
7101 int firstlineno) {
7102 PyObject *type, *value, *traceback;
7103 int retval;
7104 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
7105 if (*code == NULL) {
7106 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
7107 if (*code == NULL) return 0;
7109 *frame = PyFrame_New(
7110 tstate, /*PyThreadState *tstate*/
7111 *code, /*PyCodeObject *code*/
7112 __pyx_d, /*PyObject *globals*/
7113 0 /*PyObject *locals*/
7115 if (*frame == NULL) return 0;
7116 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
7117 Py_INCREF(Py_None);
7118 (*frame)->f_trace = Py_None;
7120 #if PY_VERSION_HEX < 0x030400B1
7121 } else {
7122 (*frame)->f_tstate = tstate;
7123 #endif
7125 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
7126 retval = 1;
7127 tstate->tracing++;
7128 tstate->use_tracing = 0;
7129 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
7130 #if CYTHON_TRACE
7131 if (tstate->c_tracefunc)
7132 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
7133 if (retval && tstate->c_profilefunc)
7134 #endif
7135 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
7136 tstate->use_tracing = (tstate->c_profilefunc ||
7137 (CYTHON_TRACE && tstate->c_tracefunc));
7138 tstate->tracing--;
7139 if (retval) {
7140 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
7141 return tstate->use_tracing && retval;
7142 } else {
7143 Py_XDECREF(type);
7144 Py_XDECREF(value);
7145 Py_XDECREF(traceback);
7146 return -1;
7149 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
7150 PyCodeObject *py_code = 0;
7151 #if PY_MAJOR_VERSION >= 3
7152 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
7153 if (likely(py_code)) {
7154 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
7156 #else
7157 PyObject *py_srcfile = 0;
7158 PyObject *py_funcname = 0;
7159 py_funcname = PyString_FromString(funcname);
7160 if (unlikely(!py_funcname)) goto bad;
7161 py_srcfile = PyString_FromString(srcfile);
7162 if (unlikely(!py_srcfile)) goto bad;
7163 py_code = PyCode_New(
7167 CO_OPTIMIZED | CO_NEWLOCALS,
7168 __pyx_empty_bytes, /*PyObject *code,*/
7169 __pyx_empty_tuple, /*PyObject *consts,*/
7170 __pyx_empty_tuple, /*PyObject *names,*/
7171 __pyx_empty_tuple, /*PyObject *varnames,*/
7172 __pyx_empty_tuple, /*PyObject *freevars,*/
7173 __pyx_empty_tuple, /*PyObject *cellvars,*/
7174 py_srcfile, /*PyObject *filename,*/
7175 py_funcname, /*PyObject *name,*/
7176 firstlineno,
7177 __pyx_empty_bytes /*PyObject *lnotab*/
7179 bad:
7180 Py_XDECREF(py_srcfile);
7181 Py_XDECREF(py_funcname);
7182 #endif
7183 return py_code;
7185 #endif
7187 /* PyCFunctionFastCall */
7188 #if CYTHON_FAST_PYCCALL
7189 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
7190 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
7191 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
7192 PyObject *self = PyCFunction_GET_SELF(func);
7193 int flags = PyCFunction_GET_FLAGS(func);
7194 assert(PyCFunction_Check(func));
7195 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
7196 assert(nargs >= 0);
7197 assert(nargs == 0 || args != NULL);
7198 /* _PyCFunction_FastCallDict() must not be called with an exception set,
7199 because it may clear it (directly or indirectly) and so the
7200 caller loses its exception */
7201 assert(!PyErr_Occurred());
7202 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
7203 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
7204 } else {
7205 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
7208 #endif
7210 /* PyFunctionFastCall */
7211 #if CYTHON_FAST_PYCALL
7212 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
7213 PyObject *globals) {
7214 PyFrameObject *f;
7215 PyThreadState *tstate = __Pyx_PyThreadState_Current;
7216 PyObject **fastlocals;
7217 Py_ssize_t i;
7218 PyObject *result;
7219 assert(globals != NULL);
7220 /* XXX Perhaps we should create a specialized
7221 PyFrame_New() that doesn't take locals, but does
7222 take builtins without sanity checking them.
7224 assert(tstate != NULL);
7225 f = PyFrame_New(tstate, co, globals, NULL);
7226 if (f == NULL) {
7227 return NULL;
7229 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
7230 for (i = 0; i < na; i++) {
7231 Py_INCREF(*args);
7232 fastlocals[i] = *args++;
7234 result = PyEval_EvalFrameEx(f,0);
7235 ++tstate->recursion_depth;
7236 Py_DECREF(f);
7237 --tstate->recursion_depth;
7238 return result;
7240 #if 1 || PY_VERSION_HEX < 0x030600B1
7241 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
7242 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
7243 PyObject *globals = PyFunction_GET_GLOBALS(func);
7244 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
7245 PyObject *closure;
7246 #if PY_MAJOR_VERSION >= 3
7247 PyObject *kwdefs;
7248 #endif
7249 PyObject *kwtuple, **k;
7250 PyObject **d;
7251 Py_ssize_t nd;
7252 Py_ssize_t nk;
7253 PyObject *result;
7254 assert(kwargs == NULL || PyDict_Check(kwargs));
7255 nk = kwargs ? PyDict_Size(kwargs) : 0;
7256 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
7257 return NULL;
7259 if (
7260 #if PY_MAJOR_VERSION >= 3
7261 co->co_kwonlyargcount == 0 &&
7262 #endif
7263 likely(kwargs == NULL || nk == 0) &&
7264 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
7265 if (argdefs == NULL && co->co_argcount == nargs) {
7266 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
7267 goto done;
7269 else if (nargs == 0 && argdefs != NULL
7270 && co->co_argcount == Py_SIZE(argdefs)) {
7271 /* function called with no arguments, but all parameters have
7272 a default value: use default values as arguments .*/
7273 args = &PyTuple_GET_ITEM(argdefs, 0);
7274 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
7275 goto done;
7278 if (kwargs != NULL) {
7279 Py_ssize_t pos, i;
7280 kwtuple = PyTuple_New(2 * nk);
7281 if (kwtuple == NULL) {
7282 result = NULL;
7283 goto done;
7285 k = &PyTuple_GET_ITEM(kwtuple, 0);
7286 pos = i = 0;
7287 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
7288 Py_INCREF(k[i]);
7289 Py_INCREF(k[i+1]);
7290 i += 2;
7292 nk = i / 2;
7294 else {
7295 kwtuple = NULL;
7296 k = NULL;
7298 closure = PyFunction_GET_CLOSURE(func);
7299 #if PY_MAJOR_VERSION >= 3
7300 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
7301 #endif
7302 if (argdefs != NULL) {
7303 d = &PyTuple_GET_ITEM(argdefs, 0);
7304 nd = Py_SIZE(argdefs);
7306 else {
7307 d = NULL;
7308 nd = 0;
7310 #if PY_MAJOR_VERSION >= 3
7311 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
7312 args, (int)nargs,
7313 k, (int)nk,
7314 d, (int)nd, kwdefs, closure);
7315 #else
7316 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
7317 args, (int)nargs,
7318 k, (int)nk,
7319 d, (int)nd, closure);
7320 #endif
7321 Py_XDECREF(kwtuple);
7322 done:
7323 Py_LeaveRecursiveCall();
7324 return result;
7326 #endif
7327 #endif
7329 /* PyObjectCall */
7330 #if CYTHON_COMPILING_IN_CPYTHON
7331 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
7332 PyObject *result;
7333 ternaryfunc call = func->ob_type->tp_call;
7334 if (unlikely(!call))
7335 return PyObject_Call(func, arg, kw);
7336 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7337 return NULL;
7338 result = (*call)(func, arg, kw);
7339 Py_LeaveRecursiveCall();
7340 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7341 PyErr_SetString(
7342 PyExc_SystemError,
7343 "NULL result without error in PyObject_Call");
7345 return result;
7347 #endif
7349 /* PyObjectCallMethO */
7350 #if CYTHON_COMPILING_IN_CPYTHON
7351 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
7352 PyObject *self, *result;
7353 PyCFunction cfunc;
7354 cfunc = PyCFunction_GET_FUNCTION(func);
7355 self = PyCFunction_GET_SELF(func);
7356 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7357 return NULL;
7358 result = cfunc(self, arg);
7359 Py_LeaveRecursiveCall();
7360 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7361 PyErr_SetString(
7362 PyExc_SystemError,
7363 "NULL result without error in PyObject_Call");
7365 return result;
7367 #endif
7369 /* PyObjectCallOneArg */
7370 #if CYTHON_COMPILING_IN_CPYTHON
7371 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7372 PyObject *result;
7373 PyObject *args = PyTuple_New(1);
7374 if (unlikely(!args)) return NULL;
7375 Py_INCREF(arg);
7376 PyTuple_SET_ITEM(args, 0, arg);
7377 result = __Pyx_PyObject_Call(func, args, NULL);
7378 Py_DECREF(args);
7379 return result;
7381 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7382 #if CYTHON_FAST_PYCALL
7383 if (PyFunction_Check(func)) {
7384 return __Pyx_PyFunction_FastCall(func, &arg, 1);
7386 #endif
7387 if (likely(PyCFunction_Check(func))) {
7388 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
7389 return __Pyx_PyObject_CallMethO(func, arg);
7390 #if CYTHON_FAST_PYCCALL
7391 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
7392 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
7393 #endif
7396 return __Pyx__PyObject_CallOneArg(func, arg);
7398 #else
7399 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7400 PyObject *result;
7401 PyObject *args = PyTuple_Pack(1, arg);
7402 if (unlikely(!args)) return NULL;
7403 result = __Pyx_PyObject_Call(func, args, NULL);
7404 Py_DECREF(args);
7405 return result;
7407 #endif
7409 /* PyObjectCallNoArg */
7410 #if CYTHON_COMPILING_IN_CPYTHON
7411 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
7412 #if CYTHON_FAST_PYCALL
7413 if (PyFunction_Check(func)) {
7414 return __Pyx_PyFunction_FastCall(func, NULL, 0);
7416 #endif
7417 #ifdef __Pyx_CyFunction_USED
7418 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
7419 #else
7420 if (likely(PyCFunction_Check(func)))
7421 #endif
7423 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
7424 return __Pyx_PyObject_CallMethO(func, NULL);
7427 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
7429 #endif
7431 /* None */
7432 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
7433 long q = a / b;
7434 long r = a - q*b;
7435 q -= ((r != 0) & ((r ^ b) < 0));
7436 return q;
7439 /* None */
7440 static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
7441 long r = a % b;
7442 r += ((r != 0) & ((r ^ b) < 0)) * b;
7443 return r;
7446 /* RaiseDoubleKeywords */
7447 static void __Pyx_RaiseDoubleKeywordsError(
7448 const char* func_name,
7449 PyObject* kw_name)
7451 PyErr_Format(PyExc_TypeError,
7452 #if PY_MAJOR_VERSION >= 3
7453 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
7454 #else
7455 "%s() got multiple values for keyword argument '%s'", func_name,
7456 PyString_AsString(kw_name));
7457 #endif
7460 /* ParseKeywords */
7461 static int __Pyx_ParseOptionalKeywords(
7462 PyObject *kwds,
7463 PyObject **argnames[],
7464 PyObject *kwds2,
7465 PyObject *values[],
7466 Py_ssize_t num_pos_args,
7467 const char* function_name)
7469 PyObject *key = 0, *value = 0;
7470 Py_ssize_t pos = 0;
7471 PyObject*** name;
7472 PyObject*** first_kw_arg = argnames + num_pos_args;
7473 while (PyDict_Next(kwds, &pos, &key, &value)) {
7474 name = first_kw_arg;
7475 while (*name && (**name != key)) name++;
7476 if (*name) {
7477 values[name-argnames] = value;
7478 continue;
7480 name = first_kw_arg;
7481 #if PY_MAJOR_VERSION < 3
7482 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
7483 while (*name) {
7484 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
7485 && _PyString_Eq(**name, key)) {
7486 values[name-argnames] = value;
7487 break;
7489 name++;
7491 if (*name) continue;
7492 else {
7493 PyObject*** argname = argnames;
7494 while (argname != first_kw_arg) {
7495 if ((**argname == key) || (
7496 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
7497 && _PyString_Eq(**argname, key))) {
7498 goto arg_passed_twice;
7500 argname++;
7503 } else
7504 #endif
7505 if (likely(PyUnicode_Check(key))) {
7506 while (*name) {
7507 int cmp = (**name == key) ? 0 :
7508 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7509 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
7510 #endif
7511 PyUnicode_Compare(**name, key);
7512 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7513 if (cmp == 0) {
7514 values[name-argnames] = value;
7515 break;
7517 name++;
7519 if (*name) continue;
7520 else {
7521 PyObject*** argname = argnames;
7522 while (argname != first_kw_arg) {
7523 int cmp = (**argname == key) ? 0 :
7524 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7525 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
7526 #endif
7527 PyUnicode_Compare(**argname, key);
7528 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7529 if (cmp == 0) goto arg_passed_twice;
7530 argname++;
7533 } else
7534 goto invalid_keyword_type;
7535 if (kwds2) {
7536 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
7537 } else {
7538 goto invalid_keyword;
7541 return 0;
7542 arg_passed_twice:
7543 __Pyx_RaiseDoubleKeywordsError(function_name, key);
7544 goto bad;
7545 invalid_keyword_type:
7546 PyErr_Format(PyExc_TypeError,
7547 "%.200s() keywords must be strings", function_name);
7548 goto bad;
7549 invalid_keyword:
7550 PyErr_Format(PyExc_TypeError,
7551 #if PY_MAJOR_VERSION < 3
7552 "%.200s() got an unexpected keyword argument '%.200s'",
7553 function_name, PyString_AsString(key));
7554 #else
7555 "%s() got an unexpected keyword argument '%U'",
7556 function_name, key);
7557 #endif
7558 bad:
7559 return -1;
7562 /* RaiseArgTupleInvalid */
7563 static void __Pyx_RaiseArgtupleInvalid(
7564 const char* func_name,
7565 int exact,
7566 Py_ssize_t num_min,
7567 Py_ssize_t num_max,
7568 Py_ssize_t num_found)
7570 Py_ssize_t num_expected;
7571 const char *more_or_less;
7572 if (num_found < num_min) {
7573 num_expected = num_min;
7574 more_or_less = "at least";
7575 } else {
7576 num_expected = num_max;
7577 more_or_less = "at most";
7579 if (exact) {
7580 more_or_less = "exactly";
7582 PyErr_Format(PyExc_TypeError,
7583 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
7584 func_name, more_or_less, num_expected,
7585 (num_expected == 1) ? "" : "s", num_found);
7588 /* PyObjectSetAttrStr */
7589 #if CYTHON_USE_TYPE_SLOTS
7590 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
7591 PyTypeObject* tp = Py_TYPE(obj);
7592 if (likely(tp->tp_setattro))
7593 return tp->tp_setattro(obj, attr_name, value);
7594 #if PY_MAJOR_VERSION < 3
7595 if (likely(tp->tp_setattr))
7596 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
7597 #endif
7598 return PyObject_SetAttr(obj, attr_name, value);
7600 #endif
7602 /* PyObjectCall2Args */
7603 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
7604 PyObject *args, *result = NULL;
7605 #if CYTHON_FAST_PYCALL
7606 if (PyFunction_Check(function)) {
7607 PyObject *args[2] = {arg1, arg2};
7608 return __Pyx_PyFunction_FastCall(function, args, 2);
7610 #endif
7611 #if CYTHON_FAST_PYCCALL
7612 if (__Pyx_PyFastCFunction_Check(function)) {
7613 PyObject *args[2] = {arg1, arg2};
7614 return __Pyx_PyCFunction_FastCall(function, args, 2);
7616 #endif
7617 args = PyTuple_New(2);
7618 if (unlikely(!args)) goto done;
7619 Py_INCREF(arg1);
7620 PyTuple_SET_ITEM(args, 0, arg1);
7621 Py_INCREF(arg2);
7622 PyTuple_SET_ITEM(args, 1, arg2);
7623 Py_INCREF(function);
7624 result = __Pyx_PyObject_Call(function, args, NULL);
7625 Py_DECREF(args);
7626 Py_DECREF(function);
7627 done:
7628 return result;
7631 /* PyFloatBinop */
7632 #if !CYTHON_COMPILING_IN_PYPY
7633 static PyObject* __Pyx_PyFloat_NeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
7634 const double b = floatval;
7635 double a;
7636 (void)inplace;
7637 (void)zerodivision_check;
7638 if (op1 == op2) {
7639 Py_RETURN_FALSE;
7641 if (likely(PyFloat_CheckExact(op1))) {
7642 a = PyFloat_AS_DOUBLE(op1);
7644 } else
7645 #if PY_MAJOR_VERSION < 3
7646 if (likely(PyInt_CheckExact(op1))) {
7647 a = (double) PyInt_AS_LONG(op1);
7649 } else
7650 #endif
7651 if (likely(PyLong_CheckExact(op1))) {
7652 #if CYTHON_USE_PYLONG_INTERNALS
7653 const digit* digits = ((PyLongObject*)op1)->ob_digit;
7654 const Py_ssize_t size = Py_SIZE(op1);
7655 switch (size) {
7656 case 0: a = 0.0; break;
7657 case -1: a = -(double) digits[0]; break;
7658 case 1: a = (double) digits[0]; break;
7659 case -2:
7660 case 2:
7661 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
7662 a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7663 if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
7664 if (size == -2)
7665 a = -a;
7666 break;
7669 CYTHON_FALLTHROUGH;
7670 case -3:
7671 case 3:
7672 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
7673 a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7674 if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
7675 if (size == -3)
7676 a = -a;
7677 break;
7680 CYTHON_FALLTHROUGH;
7681 case -4:
7682 case 4:
7683 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
7684 a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7685 if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
7686 if (size == -4)
7687 a = -a;
7688 break;
7691 CYTHON_FALLTHROUGH;
7692 default:
7693 #else
7695 #endif
7696 return (
7697 PyFloat_Type.tp_richcompare(op2, op1, Py_NE));
7699 } else {
7700 return (
7701 PyObject_RichCompare(op1, op2, Py_NE));
7703 if (a != b) {
7704 Py_RETURN_TRUE;
7705 } else {
7706 Py_RETURN_FALSE;
7709 #endif
7711 /* PyDictVersioning */
7712 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
7713 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
7714 PyObject *dict = Py_TYPE(obj)->tp_dict;
7715 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
7717 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
7718 PyObject **dictptr = NULL;
7719 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
7720 if (offset) {
7721 #if CYTHON_COMPILING_IN_CPYTHON
7722 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
7723 #else
7724 dictptr = _PyObject_GetDictPtr(obj);
7725 #endif
7727 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
7729 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
7730 PyObject *dict = Py_TYPE(obj)->tp_dict;
7731 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
7732 return 0;
7733 return obj_dict_version == __Pyx_get_object_dict_version(obj);
7735 #endif
7737 /* GetModuleGlobalName */
7738 #if CYTHON_USE_DICT_VERSIONS
7739 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
7740 #else
7741 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
7742 #endif
7744 PyObject *result;
7745 #if !CYTHON_AVOID_BORROWED_REFS
7746 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
7747 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
7748 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7749 if (likely(result)) {
7750 return __Pyx_NewRef(result);
7751 } else if (unlikely(PyErr_Occurred())) {
7752 return NULL;
7754 #else
7755 result = PyDict_GetItem(__pyx_d, name);
7756 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7757 if (likely(result)) {
7758 return __Pyx_NewRef(result);
7760 #endif
7761 #else
7762 result = PyObject_GetItem(__pyx_d, name);
7763 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
7764 if (likely(result)) {
7765 return __Pyx_NewRef(result);
7767 PyErr_Clear();
7768 #endif
7769 return __Pyx_GetBuiltinName(name);
7772 /* PyObjectFormat */
7773 #if CYTHON_USE_UNICODE_WRITER
7774 static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) {
7775 int ret;
7776 _PyUnicodeWriter writer;
7777 if (likely(PyFloat_CheckExact(obj))) {
7778 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
7779 _PyUnicodeWriter_Init(&writer, 0);
7780 #else
7781 _PyUnicodeWriter_Init(&writer);
7782 #endif
7783 ret = _PyFloat_FormatAdvancedWriter(
7784 &writer,
7785 obj,
7786 format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
7787 } else if (likely(PyLong_CheckExact(obj))) {
7788 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000
7789 _PyUnicodeWriter_Init(&writer, 0);
7790 #else
7791 _PyUnicodeWriter_Init(&writer);
7792 #endif
7793 ret = _PyLong_FormatAdvancedWriter(
7794 &writer,
7795 obj,
7796 format_spec, 0, PyUnicode_GET_LENGTH(format_spec));
7797 } else {
7798 return PyObject_Format(obj, format_spec);
7800 if (unlikely(ret == -1)) {
7801 _PyUnicodeWriter_Dealloc(&writer);
7802 return NULL;
7804 return _PyUnicodeWriter_Finish(&writer);
7806 #endif
7808 /* JoinPyUnicode */
7809 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
7810 CYTHON_UNUSED Py_UCS4 max_char) {
7811 #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7812 PyObject *result_uval;
7813 int result_ukind;
7814 Py_ssize_t i, char_pos;
7815 void *result_udata;
7816 #if CYTHON_PEP393_ENABLED
7817 result_uval = PyUnicode_New(result_ulength, max_char);
7818 if (unlikely(!result_uval)) return NULL;
7819 result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
7820 result_udata = PyUnicode_DATA(result_uval);
7821 #else
7822 result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
7823 if (unlikely(!result_uval)) return NULL;
7824 result_ukind = sizeof(Py_UNICODE);
7825 result_udata = PyUnicode_AS_UNICODE(result_uval);
7826 #endif
7827 char_pos = 0;
7828 for (i=0; i < value_count; i++) {
7829 int ukind;
7830 Py_ssize_t ulength;
7831 void *udata;
7832 PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
7833 if (unlikely(__Pyx_PyUnicode_READY(uval)))
7834 goto bad;
7835 ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
7836 if (unlikely(!ulength))
7837 continue;
7838 if (unlikely(char_pos + ulength < 0))
7839 goto overflow;
7840 ukind = __Pyx_PyUnicode_KIND(uval);
7841 udata = __Pyx_PyUnicode_DATA(uval);
7842 if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
7843 memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
7844 } else {
7845 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
7846 _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
7847 #else
7848 Py_ssize_t j;
7849 for (j=0; j < ulength; j++) {
7850 Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
7851 __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
7853 #endif
7855 char_pos += ulength;
7857 return result_uval;
7858 overflow:
7859 PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
7860 bad:
7861 Py_DECREF(result_uval);
7862 return NULL;
7863 #else
7864 result_ulength++;
7865 value_count++;
7866 return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
7867 #endif
7870 /* None */
7871 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
7872 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
7875 /* PyFloatBinop */
7876 #if !CYTHON_COMPILING_IN_PYPY
7877 static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
7878 const double b = floatval;
7879 double a, result;
7880 (void)inplace;
7881 (void)zerodivision_check;
7882 if (likely(PyFloat_CheckExact(op1))) {
7883 a = PyFloat_AS_DOUBLE(op1);
7885 } else
7886 #if PY_MAJOR_VERSION < 3
7887 if (likely(PyInt_CheckExact(op1))) {
7888 a = (double) PyInt_AS_LONG(op1);
7890 } else
7891 #endif
7892 if (likely(PyLong_CheckExact(op1))) {
7893 #if CYTHON_USE_PYLONG_INTERNALS
7894 const digit* digits = ((PyLongObject*)op1)->ob_digit;
7895 const Py_ssize_t size = Py_SIZE(op1);
7896 switch (size) {
7897 case 0: a = 0.0; break;
7898 case -1: a = -(double) digits[0]; break;
7899 case 1: a = (double) digits[0]; break;
7900 case -2:
7901 case 2:
7902 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
7903 a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7904 if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
7905 if (size == -2)
7906 a = -a;
7907 break;
7910 CYTHON_FALLTHROUGH;
7911 case -3:
7912 case 3:
7913 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
7914 a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7915 if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
7916 if (size == -3)
7917 a = -a;
7918 break;
7921 CYTHON_FALLTHROUGH;
7922 case -4:
7923 case 4:
7924 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
7925 a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7926 if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
7927 if (size == -4)
7928 a = -a;
7929 break;
7932 CYTHON_FALLTHROUGH;
7933 default:
7934 #else
7936 #endif
7937 a = PyLong_AsDouble(op1);
7938 if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
7941 } else {
7942 return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
7945 PyFPE_START_PROTECT("divide", return NULL)
7946 result = a / b;
7947 PyFPE_END_PROTECT(result)
7948 return PyFloat_FromDouble(result);
7950 #endif
7952 /* Import */
7953 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
7954 PyObject *empty_list = 0;
7955 PyObject *module = 0;
7956 PyObject *global_dict = 0;
7957 PyObject *empty_dict = 0;
7958 PyObject *list;
7959 #if PY_MAJOR_VERSION < 3
7960 PyObject *py_import;
7961 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
7962 if (!py_import)
7963 goto bad;
7964 #endif
7965 if (from_list)
7966 list = from_list;
7967 else {
7968 empty_list = PyList_New(0);
7969 if (!empty_list)
7970 goto bad;
7971 list = empty_list;
7973 global_dict = PyModule_GetDict(__pyx_m);
7974 if (!global_dict)
7975 goto bad;
7976 empty_dict = PyDict_New();
7977 if (!empty_dict)
7978 goto bad;
7980 #if PY_MAJOR_VERSION >= 3
7981 if (level == -1) {
7982 if (strchr(__Pyx_MODULE_NAME, '.')) {
7983 module = PyImport_ImportModuleLevelObject(
7984 name, global_dict, empty_dict, list, 1);
7985 if (!module) {
7986 if (!PyErr_ExceptionMatches(PyExc_ImportError))
7987 goto bad;
7988 PyErr_Clear();
7991 level = 0;
7993 #endif
7994 if (!module) {
7995 #if PY_MAJOR_VERSION < 3
7996 PyObject *py_level = PyInt_FromLong(level);
7997 if (!py_level)
7998 goto bad;
7999 module = PyObject_CallFunctionObjArgs(py_import,
8000 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
8001 Py_DECREF(py_level);
8002 #else
8003 module = PyImport_ImportModuleLevelObject(
8004 name, global_dict, empty_dict, list, level);
8005 #endif
8008 bad:
8009 #if PY_MAJOR_VERSION < 3
8010 Py_XDECREF(py_import);
8011 #endif
8012 Py_XDECREF(empty_list);
8013 Py_XDECREF(empty_dict);
8014 return module;
8017 /* ImportFrom */
8018 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
8019 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
8020 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
8021 PyErr_Format(PyExc_ImportError,
8022 #if PY_MAJOR_VERSION < 3
8023 "cannot import name %.230s", PyString_AS_STRING(name));
8024 #else
8025 "cannot import name %S", name);
8026 #endif
8028 return value;
8031 /* FetchCommonType */
8032 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
8033 PyObject* fake_module;
8034 PyTypeObject* cached_type = NULL;
8035 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
8036 if (!fake_module) return NULL;
8037 Py_INCREF(fake_module);
8038 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
8039 if (cached_type) {
8040 if (!PyType_Check((PyObject*)cached_type)) {
8041 PyErr_Format(PyExc_TypeError,
8042 "Shared Cython type %.200s is not a type object",
8043 type->tp_name);
8044 goto bad;
8046 if (cached_type->tp_basicsize != type->tp_basicsize) {
8047 PyErr_Format(PyExc_TypeError,
8048 "Shared Cython type %.200s has the wrong size, try recompiling",
8049 type->tp_name);
8050 goto bad;
8052 } else {
8053 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
8054 PyErr_Clear();
8055 if (PyType_Ready(type) < 0) goto bad;
8056 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
8057 goto bad;
8058 Py_INCREF(type);
8059 cached_type = type;
8061 done:
8062 Py_DECREF(fake_module);
8063 return cached_type;
8064 bad:
8065 Py_XDECREF(cached_type);
8066 cached_type = NULL;
8067 goto done;
8070 /* CythonFunction */
8071 #include <structmember.h>
8072 static PyObject *
8073 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
8075 if (unlikely(op->func_doc == NULL)) {
8076 if (op->func.m_ml->ml_doc) {
8077 #if PY_MAJOR_VERSION >= 3
8078 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
8079 #else
8080 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
8081 #endif
8082 if (unlikely(op->func_doc == NULL))
8083 return NULL;
8084 } else {
8085 Py_INCREF(Py_None);
8086 return Py_None;
8089 Py_INCREF(op->func_doc);
8090 return op->func_doc;
8092 static int
8093 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
8095 PyObject *tmp = op->func_doc;
8096 if (value == NULL) {
8097 value = Py_None;
8099 Py_INCREF(value);
8100 op->func_doc = value;
8101 Py_XDECREF(tmp);
8102 return 0;
8104 static PyObject *
8105 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
8107 if (unlikely(op->func_name == NULL)) {
8108 #if PY_MAJOR_VERSION >= 3
8109 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
8110 #else
8111 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
8112 #endif
8113 if (unlikely(op->func_name == NULL))
8114 return NULL;
8116 Py_INCREF(op->func_name);
8117 return op->func_name;
8119 static int
8120 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
8122 PyObject *tmp;
8123 #if PY_MAJOR_VERSION >= 3
8124 if (unlikely(value == NULL || !PyUnicode_Check(value)))
8125 #else
8126 if (unlikely(value == NULL || !PyString_Check(value)))
8127 #endif
8129 PyErr_SetString(PyExc_TypeError,
8130 "__name__ must be set to a string object");
8131 return -1;
8133 tmp = op->func_name;
8134 Py_INCREF(value);
8135 op->func_name = value;
8136 Py_XDECREF(tmp);
8137 return 0;
8139 static PyObject *
8140 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
8142 Py_INCREF(op->func_qualname);
8143 return op->func_qualname;
8145 static int
8146 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
8148 PyObject *tmp;
8149 #if PY_MAJOR_VERSION >= 3
8150 if (unlikely(value == NULL || !PyUnicode_Check(value)))
8151 #else
8152 if (unlikely(value == NULL || !PyString_Check(value)))
8153 #endif
8155 PyErr_SetString(PyExc_TypeError,
8156 "__qualname__ must be set to a string object");
8157 return -1;
8159 tmp = op->func_qualname;
8160 Py_INCREF(value);
8161 op->func_qualname = value;
8162 Py_XDECREF(tmp);
8163 return 0;
8165 static PyObject *
8166 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
8168 PyObject *self;
8169 self = m->func_closure;
8170 if (self == NULL)
8171 self = Py_None;
8172 Py_INCREF(self);
8173 return self;
8175 static PyObject *
8176 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
8178 if (unlikely(op->func_dict == NULL)) {
8179 op->func_dict = PyDict_New();
8180 if (unlikely(op->func_dict == NULL))
8181 return NULL;
8183 Py_INCREF(op->func_dict);
8184 return op->func_dict;
8186 static int
8187 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
8189 PyObject *tmp;
8190 if (unlikely(value == NULL)) {
8191 PyErr_SetString(PyExc_TypeError,
8192 "function's dictionary may not be deleted");
8193 return -1;
8195 if (unlikely(!PyDict_Check(value))) {
8196 PyErr_SetString(PyExc_TypeError,
8197 "setting function's dictionary to a non-dict");
8198 return -1;
8200 tmp = op->func_dict;
8201 Py_INCREF(value);
8202 op->func_dict = value;
8203 Py_XDECREF(tmp);
8204 return 0;
8206 static PyObject *
8207 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
8209 Py_INCREF(op->func_globals);
8210 return op->func_globals;
8212 static PyObject *
8213 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
8215 Py_INCREF(Py_None);
8216 return Py_None;
8218 static PyObject *
8219 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
8221 PyObject* result = (op->func_code) ? op->func_code : Py_None;
8222 Py_INCREF(result);
8223 return result;
8225 static int
8226 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
8227 int result = 0;
8228 PyObject *res = op->defaults_getter((PyObject *) op);
8229 if (unlikely(!res))
8230 return -1;
8231 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8232 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
8233 Py_INCREF(op->defaults_tuple);
8234 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
8235 Py_INCREF(op->defaults_kwdict);
8236 #else
8237 op->defaults_tuple = PySequence_ITEM(res, 0);
8238 if (unlikely(!op->defaults_tuple)) result = -1;
8239 else {
8240 op->defaults_kwdict = PySequence_ITEM(res, 1);
8241 if (unlikely(!op->defaults_kwdict)) result = -1;
8243 #endif
8244 Py_DECREF(res);
8245 return result;
8247 static int
8248 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
8249 PyObject* tmp;
8250 if (!value) {
8251 value = Py_None;
8252 } else if (value != Py_None && !PyTuple_Check(value)) {
8253 PyErr_SetString(PyExc_TypeError,
8254 "__defaults__ must be set to a tuple object");
8255 return -1;
8257 Py_INCREF(value);
8258 tmp = op->defaults_tuple;
8259 op->defaults_tuple = value;
8260 Py_XDECREF(tmp);
8261 return 0;
8263 static PyObject *
8264 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
8265 PyObject* result = op->defaults_tuple;
8266 if (unlikely(!result)) {
8267 if (op->defaults_getter) {
8268 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
8269 result = op->defaults_tuple;
8270 } else {
8271 result = Py_None;
8274 Py_INCREF(result);
8275 return result;
8277 static int
8278 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
8279 PyObject* tmp;
8280 if (!value) {
8281 value = Py_None;
8282 } else if (value != Py_None && !PyDict_Check(value)) {
8283 PyErr_SetString(PyExc_TypeError,
8284 "__kwdefaults__ must be set to a dict object");
8285 return -1;
8287 Py_INCREF(value);
8288 tmp = op->defaults_kwdict;
8289 op->defaults_kwdict = value;
8290 Py_XDECREF(tmp);
8291 return 0;
8293 static PyObject *
8294 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
8295 PyObject* result = op->defaults_kwdict;
8296 if (unlikely(!result)) {
8297 if (op->defaults_getter) {
8298 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
8299 result = op->defaults_kwdict;
8300 } else {
8301 result = Py_None;
8304 Py_INCREF(result);
8305 return result;
8307 static int
8308 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
8309 PyObject* tmp;
8310 if (!value || value == Py_None) {
8311 value = NULL;
8312 } else if (!PyDict_Check(value)) {
8313 PyErr_SetString(PyExc_TypeError,
8314 "__annotations__ must be set to a dict object");
8315 return -1;
8317 Py_XINCREF(value);
8318 tmp = op->func_annotations;
8319 op->func_annotations = value;
8320 Py_XDECREF(tmp);
8321 return 0;
8323 static PyObject *
8324 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
8325 PyObject* result = op->func_annotations;
8326 if (unlikely(!result)) {
8327 result = PyDict_New();
8328 if (unlikely(!result)) return NULL;
8329 op->func_annotations = result;
8331 Py_INCREF(result);
8332 return result;
8334 static PyGetSetDef __pyx_CyFunction_getsets[] = {
8335 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
8336 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
8337 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
8338 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
8339 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
8340 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
8341 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
8342 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
8343 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
8344 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
8345 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
8346 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
8347 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
8348 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
8349 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
8350 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
8351 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
8352 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
8353 {0, 0, 0, 0, 0}
8355 static PyMemberDef __pyx_CyFunction_members[] = {
8356 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
8357 {0, 0, 0, 0, 0}
8359 static PyObject *
8360 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
8362 #if PY_MAJOR_VERSION >= 3
8363 return PyUnicode_FromString(m->func.m_ml->ml_name);
8364 #else
8365 return PyString_FromString(m->func.m_ml->ml_name);
8366 #endif
8368 static PyMethodDef __pyx_CyFunction_methods[] = {
8369 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
8370 {0, 0, 0, 0}
8372 #if PY_VERSION_HEX < 0x030500A0
8373 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
8374 #else
8375 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
8376 #endif
8377 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
8378 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
8379 __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
8380 if (op == NULL)
8381 return NULL;
8382 op->flags = flags;
8383 __Pyx_CyFunction_weakreflist(op) = NULL;
8384 op->func.m_ml = ml;
8385 op->func.m_self = (PyObject *) op;
8386 Py_XINCREF(closure);
8387 op->func_closure = closure;
8388 Py_XINCREF(module);
8389 op->func.m_module = module;
8390 op->func_dict = NULL;
8391 op->func_name = NULL;
8392 Py_INCREF(qualname);
8393 op->func_qualname = qualname;
8394 op->func_doc = NULL;
8395 op->func_classobj = NULL;
8396 op->func_globals = globals;
8397 Py_INCREF(op->func_globals);
8398 Py_XINCREF(code);
8399 op->func_code = code;
8400 op->defaults_pyobjects = 0;
8401 op->defaults = NULL;
8402 op->defaults_tuple = NULL;
8403 op->defaults_kwdict = NULL;
8404 op->defaults_getter = NULL;
8405 op->func_annotations = NULL;
8406 PyObject_GC_Track(op);
8407 return (PyObject *) op;
8409 static int
8410 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
8412 Py_CLEAR(m->func_closure);
8413 Py_CLEAR(m->func.m_module);
8414 Py_CLEAR(m->func_dict);
8415 Py_CLEAR(m->func_name);
8416 Py_CLEAR(m->func_qualname);
8417 Py_CLEAR(m->func_doc);
8418 Py_CLEAR(m->func_globals);
8419 Py_CLEAR(m->func_code);
8420 Py_CLEAR(m->func_classobj);
8421 Py_CLEAR(m->defaults_tuple);
8422 Py_CLEAR(m->defaults_kwdict);
8423 Py_CLEAR(m->func_annotations);
8424 if (m->defaults) {
8425 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
8426 int i;
8427 for (i = 0; i < m->defaults_pyobjects; i++)
8428 Py_XDECREF(pydefaults[i]);
8429 PyObject_Free(m->defaults);
8430 m->defaults = NULL;
8432 return 0;
8434 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
8436 if (__Pyx_CyFunction_weakreflist(m) != NULL)
8437 PyObject_ClearWeakRefs((PyObject *) m);
8438 __Pyx_CyFunction_clear(m);
8439 PyObject_GC_Del(m);
8441 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
8443 PyObject_GC_UnTrack(m);
8444 __Pyx__CyFunction_dealloc(m);
8446 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
8448 Py_VISIT(m->func_closure);
8449 Py_VISIT(m->func.m_module);
8450 Py_VISIT(m->func_dict);
8451 Py_VISIT(m->func_name);
8452 Py_VISIT(m->func_qualname);
8453 Py_VISIT(m->func_doc);
8454 Py_VISIT(m->func_globals);
8455 Py_VISIT(m->func_code);
8456 Py_VISIT(m->func_classobj);
8457 Py_VISIT(m->defaults_tuple);
8458 Py_VISIT(m->defaults_kwdict);
8459 if (m->defaults) {
8460 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
8461 int i;
8462 for (i = 0; i < m->defaults_pyobjects; i++)
8463 Py_VISIT(pydefaults[i]);
8465 return 0;
8467 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
8469 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8470 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
8471 Py_INCREF(func);
8472 return func;
8474 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
8475 if (type == NULL)
8476 type = (PyObject *)(Py_TYPE(obj));
8477 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
8479 if (obj == Py_None)
8480 obj = NULL;
8481 return __Pyx_PyMethod_New(func, obj, type);
8483 static PyObject*
8484 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
8486 #if PY_MAJOR_VERSION >= 3
8487 return PyUnicode_FromFormat("<cyfunction %U at %p>",
8488 op->func_qualname, (void *)op);
8489 #else
8490 return PyString_FromFormat("<cyfunction %s at %p>",
8491 PyString_AsString(op->func_qualname), (void *)op);
8492 #endif
8494 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
8495 PyCFunctionObject* f = (PyCFunctionObject*)func;
8496 PyCFunction meth = f->m_ml->ml_meth;
8497 Py_ssize_t size;
8498 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
8499 case METH_VARARGS:
8500 if (likely(kw == NULL || PyDict_Size(kw) == 0))
8501 return (*meth)(self, arg);
8502 break;
8503 case METH_VARARGS | METH_KEYWORDS:
8504 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
8505 case METH_NOARGS:
8506 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
8507 size = PyTuple_GET_SIZE(arg);
8508 if (likely(size == 0))
8509 return (*meth)(self, NULL);
8510 PyErr_Format(PyExc_TypeError,
8511 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
8512 f->m_ml->ml_name, size);
8513 return NULL;
8515 break;
8516 case METH_O:
8517 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
8518 size = PyTuple_GET_SIZE(arg);
8519 if (likely(size == 1)) {
8520 PyObject *result, *arg0;
8521 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8522 arg0 = PyTuple_GET_ITEM(arg, 0);
8523 #else
8524 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
8525 #endif
8526 result = (*meth)(self, arg0);
8527 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
8528 Py_DECREF(arg0);
8529 #endif
8530 return result;
8532 PyErr_Format(PyExc_TypeError,
8533 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
8534 f->m_ml->ml_name, size);
8535 return NULL;
8537 break;
8538 default:
8539 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
8540 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
8541 "longer supported!");
8542 return NULL;
8544 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
8545 f->m_ml->ml_name);
8546 return NULL;
8548 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
8549 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
8551 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
8552 PyObject *result;
8553 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
8554 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
8555 Py_ssize_t argc;
8556 PyObject *new_args;
8557 PyObject *self;
8558 argc = PyTuple_GET_SIZE(args);
8559 new_args = PyTuple_GetSlice(args, 1, argc);
8560 if (unlikely(!new_args))
8561 return NULL;
8562 self = PyTuple_GetItem(args, 0);
8563 if (unlikely(!self)) {
8564 Py_DECREF(new_args);
8565 return NULL;
8567 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
8568 Py_DECREF(new_args);
8569 } else {
8570 result = __Pyx_CyFunction_Call(func, args, kw);
8572 return result;
8574 static PyTypeObject __pyx_CyFunctionType_type = {
8575 PyVarObject_HEAD_INIT(0, 0)
8576 "cython_function_or_method",
8577 sizeof(__pyx_CyFunctionObject),
8579 (destructor) __Pyx_CyFunction_dealloc,
8583 #if PY_MAJOR_VERSION < 3
8585 #else
8587 #endif
8588 (reprfunc) __Pyx_CyFunction_repr,
8593 __Pyx_CyFunction_CallAsMethod,
8598 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
8600 (traverseproc) __Pyx_CyFunction_traverse,
8601 (inquiry) __Pyx_CyFunction_clear,
8603 #if PY_VERSION_HEX < 0x030500A0
8604 offsetof(__pyx_CyFunctionObject, func_weakreflist),
8605 #else
8606 offsetof(PyCFunctionObject, m_weakreflist),
8607 #endif
8610 __pyx_CyFunction_methods,
8611 __pyx_CyFunction_members,
8612 __pyx_CyFunction_getsets,
8615 __Pyx_CyFunction_descr_get,
8617 offsetof(__pyx_CyFunctionObject, func_dict),
8630 #if PY_VERSION_HEX >= 0x030400a1
8632 #endif
8633 #if PY_VERSION_HEX >= 0x030800b1
8635 #endif
8637 static int __pyx_CyFunction_init(void) {
8638 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
8639 if (unlikely(__pyx_CyFunctionType == NULL)) {
8640 return -1;
8642 return 0;
8644 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
8645 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8646 m->defaults = PyObject_Malloc(size);
8647 if (unlikely(!m->defaults))
8648 return PyErr_NoMemory();
8649 memset(m->defaults, 0, size);
8650 m->defaults_pyobjects = pyobjects;
8651 return m->defaults;
8653 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
8654 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8655 m->defaults_tuple = tuple;
8656 Py_INCREF(tuple);
8658 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
8659 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8660 m->defaults_kwdict = dict;
8661 Py_INCREF(dict);
8663 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
8664 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8665 m->func_annotations = dict;
8666 Py_INCREF(dict);
8669 /* CalculateMetaclass */
8670 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
8671 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
8672 for (i=0; i < nbases; i++) {
8673 PyTypeObject *tmptype;
8674 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
8675 tmptype = Py_TYPE(tmp);
8676 #if PY_MAJOR_VERSION < 3
8677 if (tmptype == &PyClass_Type)
8678 continue;
8679 #endif
8680 if (!metaclass) {
8681 metaclass = tmptype;
8682 continue;
8684 if (PyType_IsSubtype(metaclass, tmptype))
8685 continue;
8686 if (PyType_IsSubtype(tmptype, metaclass)) {
8687 metaclass = tmptype;
8688 continue;
8690 PyErr_SetString(PyExc_TypeError,
8691 "metaclass conflict: "
8692 "the metaclass of a derived class "
8693 "must be a (non-strict) subclass "
8694 "of the metaclasses of all its bases");
8695 return NULL;
8697 if (!metaclass) {
8698 #if PY_MAJOR_VERSION < 3
8699 metaclass = &PyClass_Type;
8700 #else
8701 metaclass = &PyType_Type;
8702 #endif
8704 Py_INCREF((PyObject*) metaclass);
8705 return (PyObject*) metaclass;
8708 /* Py3ClassCreate */
8709 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
8710 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
8711 PyObject *ns;
8712 if (metaclass) {
8713 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
8714 if (prep) {
8715 PyObject *pargs = PyTuple_Pack(2, name, bases);
8716 if (unlikely(!pargs)) {
8717 Py_DECREF(prep);
8718 return NULL;
8720 ns = PyObject_Call(prep, pargs, mkw);
8721 Py_DECREF(prep);
8722 Py_DECREF(pargs);
8723 } else {
8724 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
8725 return NULL;
8726 PyErr_Clear();
8727 ns = PyDict_New();
8729 } else {
8730 ns = PyDict_New();
8732 if (unlikely(!ns))
8733 return NULL;
8734 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
8735 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
8736 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
8737 return ns;
8738 bad:
8739 Py_DECREF(ns);
8740 return NULL;
8742 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
8743 PyObject *dict, PyObject *mkw,
8744 int calculate_metaclass, int allow_py2_metaclass) {
8745 PyObject *result, *margs;
8746 PyObject *owned_metaclass = NULL;
8747 if (allow_py2_metaclass) {
8748 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
8749 if (owned_metaclass) {
8750 metaclass = owned_metaclass;
8751 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
8752 PyErr_Clear();
8753 } else {
8754 return NULL;
8757 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
8758 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
8759 Py_XDECREF(owned_metaclass);
8760 if (unlikely(!metaclass))
8761 return NULL;
8762 owned_metaclass = metaclass;
8764 margs = PyTuple_Pack(3, name, bases, dict);
8765 if (unlikely(!margs)) {
8766 result = NULL;
8767 } else {
8768 result = PyObject_Call(metaclass, margs, mkw);
8769 Py_DECREF(margs);
8771 Py_XDECREF(owned_metaclass);
8772 return result;
8775 /* CLineInTraceback */
8776 #ifndef CYTHON_CLINE_IN_TRACEBACK
8777 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
8778 PyObject *use_cline;
8779 PyObject *ptype, *pvalue, *ptraceback;
8780 #if CYTHON_COMPILING_IN_CPYTHON
8781 PyObject **cython_runtime_dict;
8782 #endif
8783 if (unlikely(!__pyx_cython_runtime)) {
8784 return c_line;
8786 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
8787 #if CYTHON_COMPILING_IN_CPYTHON
8788 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
8789 if (likely(cython_runtime_dict)) {
8790 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
8791 use_cline, *cython_runtime_dict,
8792 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
8793 } else
8794 #endif
8796 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
8797 if (use_cline_obj) {
8798 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
8799 Py_DECREF(use_cline_obj);
8800 } else {
8801 PyErr_Clear();
8802 use_cline = NULL;
8805 if (!use_cline) {
8806 c_line = 0;
8807 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
8809 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
8810 c_line = 0;
8812 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
8813 return c_line;
8815 #endif
8817 /* CodeObjectCache */
8818 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8819 int start = 0, mid = 0, end = count - 1;
8820 if (end >= 0 && code_line > entries[end].code_line) {
8821 return count;
8823 while (start < end) {
8824 mid = start + (end - start) / 2;
8825 if (code_line < entries[mid].code_line) {
8826 end = mid;
8827 } else if (code_line > entries[mid].code_line) {
8828 start = mid + 1;
8829 } else {
8830 return mid;
8833 if (code_line <= entries[mid].code_line) {
8834 return mid;
8835 } else {
8836 return mid + 1;
8839 static PyCodeObject *__pyx_find_code_object(int code_line) {
8840 PyCodeObject* code_object;
8841 int pos;
8842 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8843 return NULL;
8845 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8846 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8847 return NULL;
8849 code_object = __pyx_code_cache.entries[pos].code_object;
8850 Py_INCREF(code_object);
8851 return code_object;
8853 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8854 int pos, i;
8855 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8856 if (unlikely(!code_line)) {
8857 return;
8859 if (unlikely(!entries)) {
8860 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
8861 if (likely(entries)) {
8862 __pyx_code_cache.entries = entries;
8863 __pyx_code_cache.max_count = 64;
8864 __pyx_code_cache.count = 1;
8865 entries[0].code_line = code_line;
8866 entries[0].code_object = code_object;
8867 Py_INCREF(code_object);
8869 return;
8871 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8872 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
8873 PyCodeObject* tmp = entries[pos].code_object;
8874 entries[pos].code_object = code_object;
8875 Py_DECREF(tmp);
8876 return;
8878 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
8879 int new_max = __pyx_code_cache.max_count + 64;
8880 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
8881 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
8882 if (unlikely(!entries)) {
8883 return;
8885 __pyx_code_cache.entries = entries;
8886 __pyx_code_cache.max_count = new_max;
8888 for (i=__pyx_code_cache.count; i>pos; i--) {
8889 entries[i] = entries[i-1];
8891 entries[pos].code_line = code_line;
8892 entries[pos].code_object = code_object;
8893 __pyx_code_cache.count++;
8894 Py_INCREF(code_object);
8897 /* AddTraceback */
8898 #include "compile.h"
8899 #include "frameobject.h"
8900 #include "traceback.h"
8901 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
8902 const char *funcname, int c_line,
8903 int py_line, const char *filename) {
8904 PyCodeObject *py_code = 0;
8905 PyObject *py_srcfile = 0;
8906 PyObject *py_funcname = 0;
8907 #if PY_MAJOR_VERSION < 3
8908 py_srcfile = PyString_FromString(filename);
8909 #else
8910 py_srcfile = PyUnicode_FromString(filename);
8911 #endif
8912 if (!py_srcfile) goto bad;
8913 if (c_line) {
8914 #if PY_MAJOR_VERSION < 3
8915 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8916 #else
8917 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8918 #endif
8920 else {
8921 #if PY_MAJOR_VERSION < 3
8922 py_funcname = PyString_FromString(funcname);
8923 #else
8924 py_funcname = PyUnicode_FromString(funcname);
8925 #endif
8927 if (!py_funcname) goto bad;
8928 py_code = __Pyx_PyCode_New(
8934 __pyx_empty_bytes, /*PyObject *code,*/
8935 __pyx_empty_tuple, /*PyObject *consts,*/
8936 __pyx_empty_tuple, /*PyObject *names,*/
8937 __pyx_empty_tuple, /*PyObject *varnames,*/
8938 __pyx_empty_tuple, /*PyObject *freevars,*/
8939 __pyx_empty_tuple, /*PyObject *cellvars,*/
8940 py_srcfile, /*PyObject *filename,*/
8941 py_funcname, /*PyObject *name,*/
8942 py_line,
8943 __pyx_empty_bytes /*PyObject *lnotab*/
8945 Py_DECREF(py_srcfile);
8946 Py_DECREF(py_funcname);
8947 return py_code;
8948 bad:
8949 Py_XDECREF(py_srcfile);
8950 Py_XDECREF(py_funcname);
8951 return NULL;
8953 static void __Pyx_AddTraceback(const char *funcname, int c_line,
8954 int py_line, const char *filename) {
8955 PyCodeObject *py_code = 0;
8956 PyFrameObject *py_frame = 0;
8957 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8958 if (c_line) {
8959 c_line = __Pyx_CLineForTraceback(tstate, c_line);
8961 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
8962 if (!py_code) {
8963 py_code = __Pyx_CreateCodeObjectForTraceback(
8964 funcname, c_line, py_line, filename);
8965 if (!py_code) goto bad;
8966 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
8968 py_frame = PyFrame_New(
8969 tstate, /*PyThreadState *tstate,*/
8970 py_code, /*PyCodeObject *code,*/
8971 __pyx_d, /*PyObject *globals,*/
8972 0 /*PyObject *locals*/
8974 if (!py_frame) goto bad;
8975 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
8976 PyTraceBack_Here(py_frame);
8977 bad:
8978 Py_XDECREF(py_code);
8979 Py_XDECREF(py_frame);
8982 /* CIntToPy */
8983 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
8984 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8985 const int is_unsigned = neg_one > const_zero;
8986 if (is_unsigned) {
8987 if (sizeof(long) < sizeof(long)) {
8988 return PyInt_FromLong((long) value);
8989 } else if (sizeof(long) <= sizeof(unsigned long)) {
8990 return PyLong_FromUnsignedLong((unsigned long) value);
8991 #ifdef HAVE_LONG_LONG
8992 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8993 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8994 #endif
8996 } else {
8997 if (sizeof(long) <= sizeof(long)) {
8998 return PyInt_FromLong((long) value);
8999 #ifdef HAVE_LONG_LONG
9000 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9001 return PyLong_FromLongLong((PY_LONG_LONG) value);
9002 #endif
9006 int one = 1; int little = (int)*(unsigned char *)&one;
9007 unsigned char *bytes = (unsigned char *)&value;
9008 return _PyLong_FromByteArray(bytes, sizeof(long),
9009 little, !is_unsigned);
9013 /* CIntFromPyVerify */
9014 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
9015 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
9016 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
9017 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
9018 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
9020 func_type value = func_value;\
9021 if (sizeof(target_type) < sizeof(func_type)) {\
9022 if (unlikely(value != (func_type) (target_type) value)) {\
9023 func_type zero = 0;\
9024 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
9025 return (target_type) -1;\
9026 if (is_unsigned && unlikely(value < zero))\
9027 goto raise_neg_overflow;\
9028 else\
9029 goto raise_overflow;\
9032 return (target_type) value;\
9035 /* CIntFromPy */
9036 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
9037 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
9038 const int is_unsigned = neg_one > const_zero;
9039 #if PY_MAJOR_VERSION < 3
9040 if (likely(PyInt_Check(x))) {
9041 if (sizeof(long) < sizeof(long)) {
9042 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
9043 } else {
9044 long val = PyInt_AS_LONG(x);
9045 if (is_unsigned && unlikely(val < 0)) {
9046 goto raise_neg_overflow;
9048 return (long) val;
9050 } else
9051 #endif
9052 if (likely(PyLong_Check(x))) {
9053 if (is_unsigned) {
9054 #if CYTHON_USE_PYLONG_INTERNALS
9055 const digit* digits = ((PyLongObject*)x)->ob_digit;
9056 switch (Py_SIZE(x)) {
9057 case 0: return (long) 0;
9058 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
9059 case 2:
9060 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9061 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9062 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9063 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
9064 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9067 break;
9068 case 3:
9069 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9070 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9071 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9072 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
9073 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9076 break;
9077 case 4:
9078 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9079 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9080 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9081 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
9082 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9085 break;
9087 #endif
9088 #if CYTHON_COMPILING_IN_CPYTHON
9089 if (unlikely(Py_SIZE(x) < 0)) {
9090 goto raise_neg_overflow;
9092 #else
9094 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9095 if (unlikely(result < 0))
9096 return (long) -1;
9097 if (unlikely(result == 1))
9098 goto raise_neg_overflow;
9100 #endif
9101 if (sizeof(long) <= sizeof(unsigned long)) {
9102 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
9103 #ifdef HAVE_LONG_LONG
9104 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9105 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9106 #endif
9108 } else {
9109 #if CYTHON_USE_PYLONG_INTERNALS
9110 const digit* digits = ((PyLongObject*)x)->ob_digit;
9111 switch (Py_SIZE(x)) {
9112 case 0: return (long) 0;
9113 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
9114 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
9115 case -2:
9116 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
9117 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9118 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9119 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9120 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9123 break;
9124 case 2:
9125 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9126 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9127 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9128 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9129 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9132 break;
9133 case -3:
9134 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9135 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9136 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9137 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9138 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9141 break;
9142 case 3:
9143 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9144 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9145 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9146 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9147 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9150 break;
9151 case -4:
9152 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9153 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9154 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9155 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9156 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9159 break;
9160 case 4:
9161 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9162 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9163 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9164 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9165 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9168 break;
9170 #endif
9171 if (sizeof(long) <= sizeof(long)) {
9172 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
9173 #ifdef HAVE_LONG_LONG
9174 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9175 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
9176 #endif
9180 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9181 PyErr_SetString(PyExc_RuntimeError,
9182 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9183 #else
9184 long val;
9185 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9186 #if PY_MAJOR_VERSION < 3
9187 if (likely(v) && !PyLong_Check(v)) {
9188 PyObject *tmp = v;
9189 v = PyNumber_Long(tmp);
9190 Py_DECREF(tmp);
9192 #endif
9193 if (likely(v)) {
9194 int one = 1; int is_little = (int)*(unsigned char *)&one;
9195 unsigned char *bytes = (unsigned char *)&val;
9196 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9197 bytes, sizeof(val),
9198 is_little, !is_unsigned);
9199 Py_DECREF(v);
9200 if (likely(!ret))
9201 return val;
9203 #endif
9204 return (long) -1;
9206 } else {
9207 long val;
9208 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9209 if (!tmp) return (long) -1;
9210 val = __Pyx_PyInt_As_long(tmp);
9211 Py_DECREF(tmp);
9212 return val;
9214 raise_overflow:
9215 PyErr_SetString(PyExc_OverflowError,
9216 "value too large to convert to long");
9217 return (long) -1;
9218 raise_neg_overflow:
9219 PyErr_SetString(PyExc_OverflowError,
9220 "can't convert negative value to long");
9221 return (long) -1;
9224 /* CIntFromPy */
9225 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
9226 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
9227 const int is_unsigned = neg_one > const_zero;
9228 #if PY_MAJOR_VERSION < 3
9229 if (likely(PyInt_Check(x))) {
9230 if (sizeof(int) < sizeof(long)) {
9231 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
9232 } else {
9233 long val = PyInt_AS_LONG(x);
9234 if (is_unsigned && unlikely(val < 0)) {
9235 goto raise_neg_overflow;
9237 return (int) val;
9239 } else
9240 #endif
9241 if (likely(PyLong_Check(x))) {
9242 if (is_unsigned) {
9243 #if CYTHON_USE_PYLONG_INTERNALS
9244 const digit* digits = ((PyLongObject*)x)->ob_digit;
9245 switch (Py_SIZE(x)) {
9246 case 0: return (int) 0;
9247 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
9248 case 2:
9249 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9250 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9251 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9252 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
9253 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9256 break;
9257 case 3:
9258 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9259 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9260 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9261 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
9262 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9265 break;
9266 case 4:
9267 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9268 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9269 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9270 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
9271 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9274 break;
9276 #endif
9277 #if CYTHON_COMPILING_IN_CPYTHON
9278 if (unlikely(Py_SIZE(x) < 0)) {
9279 goto raise_neg_overflow;
9281 #else
9283 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9284 if (unlikely(result < 0))
9285 return (int) -1;
9286 if (unlikely(result == 1))
9287 goto raise_neg_overflow;
9289 #endif
9290 if (sizeof(int) <= sizeof(unsigned long)) {
9291 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
9292 #ifdef HAVE_LONG_LONG
9293 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
9294 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9295 #endif
9297 } else {
9298 #if CYTHON_USE_PYLONG_INTERNALS
9299 const digit* digits = ((PyLongObject*)x)->ob_digit;
9300 switch (Py_SIZE(x)) {
9301 case 0: return (int) 0;
9302 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
9303 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
9304 case -2:
9305 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
9306 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9307 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9308 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9309 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9312 break;
9313 case 2:
9314 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9315 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9316 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9317 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9318 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9321 break;
9322 case -3:
9323 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9324 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9325 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9326 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9327 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9330 break;
9331 case 3:
9332 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9333 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9334 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9335 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9336 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9339 break;
9340 case -4:
9341 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9342 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9343 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9344 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9345 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9348 break;
9349 case 4:
9350 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9351 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9352 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9353 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9354 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9357 break;
9359 #endif
9360 if (sizeof(int) <= sizeof(long)) {
9361 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
9362 #ifdef HAVE_LONG_LONG
9363 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9364 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
9365 #endif
9369 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9370 PyErr_SetString(PyExc_RuntimeError,
9371 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9372 #else
9373 int val;
9374 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9375 #if PY_MAJOR_VERSION < 3
9376 if (likely(v) && !PyLong_Check(v)) {
9377 PyObject *tmp = v;
9378 v = PyNumber_Long(tmp);
9379 Py_DECREF(tmp);
9381 #endif
9382 if (likely(v)) {
9383 int one = 1; int is_little = (int)*(unsigned char *)&one;
9384 unsigned char *bytes = (unsigned char *)&val;
9385 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9386 bytes, sizeof(val),
9387 is_little, !is_unsigned);
9388 Py_DECREF(v);
9389 if (likely(!ret))
9390 return val;
9392 #endif
9393 return (int) -1;
9395 } else {
9396 int val;
9397 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9398 if (!tmp) return (int) -1;
9399 val = __Pyx_PyInt_As_int(tmp);
9400 Py_DECREF(tmp);
9401 return val;
9403 raise_overflow:
9404 PyErr_SetString(PyExc_OverflowError,
9405 "value too large to convert to int");
9406 return (int) -1;
9407 raise_neg_overflow:
9408 PyErr_SetString(PyExc_OverflowError,
9409 "can't convert negative value to int");
9410 return (int) -1;
9413 /* FastTypeChecks */
9414 #if CYTHON_COMPILING_IN_CPYTHON
9415 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
9416 while (a) {
9417 a = a->tp_base;
9418 if (a == b)
9419 return 1;
9421 return b == &PyBaseObject_Type;
9423 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
9424 PyObject *mro;
9425 if (a == b) return 1;
9426 mro = a->tp_mro;
9427 if (likely(mro)) {
9428 Py_ssize_t i, n;
9429 n = PyTuple_GET_SIZE(mro);
9430 for (i = 0; i < n; i++) {
9431 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
9432 return 1;
9434 return 0;
9436 return __Pyx_InBases(a, b);
9438 #if PY_MAJOR_VERSION == 2
9439 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
9440 PyObject *exception, *value, *tb;
9441 int res;
9442 __Pyx_PyThreadState_declare
9443 __Pyx_PyThreadState_assign
9444 __Pyx_ErrFetch(&exception, &value, &tb);
9445 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
9446 if (unlikely(res == -1)) {
9447 PyErr_WriteUnraisable(err);
9448 res = 0;
9450 if (!res) {
9451 res = PyObject_IsSubclass(err, exc_type2);
9452 if (unlikely(res == -1)) {
9453 PyErr_WriteUnraisable(err);
9454 res = 0;
9457 __Pyx_ErrRestore(exception, value, tb);
9458 return res;
9460 #else
9461 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
9462 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
9463 if (!res) {
9464 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
9466 return res;
9468 #endif
9469 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
9470 Py_ssize_t i, n;
9471 assert(PyExceptionClass_Check(exc_type));
9472 n = PyTuple_GET_SIZE(tuple);
9473 #if PY_MAJOR_VERSION >= 3
9474 for (i=0; i<n; i++) {
9475 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
9477 #endif
9478 for (i=0; i<n; i++) {
9479 PyObject *t = PyTuple_GET_ITEM(tuple, i);
9480 #if PY_MAJOR_VERSION < 3
9481 if (likely(exc_type == t)) return 1;
9482 #endif
9483 if (likely(PyExceptionClass_Check(t))) {
9484 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
9485 } else {
9488 return 0;
9490 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
9491 if (likely(err == exc_type)) return 1;
9492 if (likely(PyExceptionClass_Check(err))) {
9493 if (likely(PyExceptionClass_Check(exc_type))) {
9494 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
9495 } else if (likely(PyTuple_Check(exc_type))) {
9496 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
9497 } else {
9500 return PyErr_GivenExceptionMatches(err, exc_type);
9502 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
9503 assert(PyExceptionClass_Check(exc_type1));
9504 assert(PyExceptionClass_Check(exc_type2));
9505 if (likely(err == exc_type1 || err == exc_type2)) return 1;
9506 if (likely(PyExceptionClass_Check(err))) {
9507 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
9509 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
9511 #endif
9513 /* CStringEquals */
9514 static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
9515 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
9516 return *s1 == *s2;
9519 /* CheckBinaryVersion */
9520 static int __Pyx_check_binary_version(void) {
9521 char ctversion[4], rtversion[4];
9522 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
9523 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
9524 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
9525 char message[200];
9526 PyOS_snprintf(message, sizeof(message),
9527 "compiletime version %s of module '%.100s' "
9528 "does not match runtime version %s",
9529 ctversion, __Pyx_MODULE_NAME, rtversion);
9530 return PyErr_WarnEx(NULL, message, 1);
9532 return 0;
9535 /* InitStrings */
9536 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9537 while (t->p) {
9538 #if PY_MAJOR_VERSION < 3
9539 if (t->is_unicode) {
9540 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9541 } else if (t->intern) {
9542 *t->p = PyString_InternFromString(t->s);
9543 } else {
9544 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9546 #else
9547 if (t->is_unicode | t->is_str) {
9548 if (t->intern) {
9549 *t->p = PyUnicode_InternFromString(t->s);
9550 } else if (t->encoding) {
9551 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9552 } else {
9553 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9555 } else {
9556 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9558 #endif
9559 if (!*t->p)
9560 return -1;
9561 if (PyObject_Hash(*t->p) == -1)
9562 return -1;
9563 ++t;
9565 return 0;
9568 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
9569 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
9571 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
9572 Py_ssize_t ignore;
9573 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
9575 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9576 #if !CYTHON_PEP393_ENABLED
9577 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9578 char* defenc_c;
9579 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
9580 if (!defenc) return NULL;
9581 defenc_c = PyBytes_AS_STRING(defenc);
9582 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9584 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
9585 char* c;
9586 for (c = defenc_c; c < end; c++) {
9587 if ((unsigned char) (*c) >= 128) {
9588 PyUnicode_AsASCIIString(o);
9589 return NULL;
9593 #endif
9594 *length = PyBytes_GET_SIZE(defenc);
9595 return defenc_c;
9597 #else
9598 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9599 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
9600 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9601 if (likely(PyUnicode_IS_ASCII(o))) {
9602 *length = PyUnicode_GET_LENGTH(o);
9603 return PyUnicode_AsUTF8(o);
9604 } else {
9605 PyUnicode_AsASCIIString(o);
9606 return NULL;
9608 #else
9609 return PyUnicode_AsUTF8AndSize(o, length);
9610 #endif
9612 #endif
9613 #endif
9614 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9615 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9616 if (
9617 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9618 __Pyx_sys_getdefaultencoding_not_ascii &&
9619 #endif
9620 PyUnicode_Check(o)) {
9621 return __Pyx_PyUnicode_AsStringAndSize(o, length);
9622 } else
9623 #endif
9624 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
9625 if (PyByteArray_Check(o)) {
9626 *length = PyByteArray_GET_SIZE(o);
9627 return PyByteArray_AS_STRING(o);
9628 } else
9629 #endif
9631 char* result;
9632 int r = PyBytes_AsStringAndSize(o, &result, length);
9633 if (unlikely(r < 0)) {
9634 return NULL;
9635 } else {
9636 return result;
9640 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
9641 int is_true = x == Py_True;
9642 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
9643 else return PyObject_IsTrue(x);
9645 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
9646 int retval;
9647 if (unlikely(!x)) return -1;
9648 retval = __Pyx_PyObject_IsTrue(x);
9649 Py_DECREF(x);
9650 return retval;
9652 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
9653 #if PY_MAJOR_VERSION >= 3
9654 if (PyLong_Check(result)) {
9655 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
9656 "__int__ returned non-int (type %.200s). "
9657 "The ability to return an instance of a strict subclass of int "
9658 "is deprecated, and may be removed in a future version of Python.",
9659 Py_TYPE(result)->tp_name)) {
9660 Py_DECREF(result);
9661 return NULL;
9663 return result;
9665 #endif
9666 PyErr_Format(PyExc_TypeError,
9667 "__%.4s__ returned non-%.4s (type %.200s)",
9668 type_name, type_name, Py_TYPE(result)->tp_name);
9669 Py_DECREF(result);
9670 return NULL;
9672 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
9673 #if CYTHON_USE_TYPE_SLOTS
9674 PyNumberMethods *m;
9675 #endif
9676 const char *name = NULL;
9677 PyObject *res = NULL;
9678 #if PY_MAJOR_VERSION < 3
9679 if (likely(PyInt_Check(x) || PyLong_Check(x)))
9680 #else
9681 if (likely(PyLong_Check(x)))
9682 #endif
9683 return __Pyx_NewRef(x);
9684 #if CYTHON_USE_TYPE_SLOTS
9685 m = Py_TYPE(x)->tp_as_number;
9686 #if PY_MAJOR_VERSION < 3
9687 if (m && m->nb_int) {
9688 name = "int";
9689 res = m->nb_int(x);
9691 else if (m && m->nb_long) {
9692 name = "long";
9693 res = m->nb_long(x);
9695 #else
9696 if (likely(m && m->nb_int)) {
9697 name = "int";
9698 res = m->nb_int(x);
9700 #endif
9701 #else
9702 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
9703 res = PyNumber_Int(x);
9705 #endif
9706 if (likely(res)) {
9707 #if PY_MAJOR_VERSION < 3
9708 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
9709 #else
9710 if (unlikely(!PyLong_CheckExact(res))) {
9711 #endif
9712 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
9715 else if (!PyErr_Occurred()) {
9716 PyErr_SetString(PyExc_TypeError,
9717 "an integer is required");
9719 return res;
9721 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
9722 Py_ssize_t ival;
9723 PyObject *x;
9724 #if PY_MAJOR_VERSION < 3
9725 if (likely(PyInt_CheckExact(b))) {
9726 if (sizeof(Py_ssize_t) >= sizeof(long))
9727 return PyInt_AS_LONG(b);
9728 else
9729 return PyInt_AsSsize_t(b);
9731 #endif
9732 if (likely(PyLong_CheckExact(b))) {
9733 #if CYTHON_USE_PYLONG_INTERNALS
9734 const digit* digits = ((PyLongObject*)b)->ob_digit;
9735 const Py_ssize_t size = Py_SIZE(b);
9736 if (likely(__Pyx_sst_abs(size) <= 1)) {
9737 ival = likely(size) ? digits[0] : 0;
9738 if (size == -1) ival = -ival;
9739 return ival;
9740 } else {
9741 switch (size) {
9742 case 2:
9743 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9744 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9746 break;
9747 case -2:
9748 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9749 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9751 break;
9752 case 3:
9753 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9754 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9756 break;
9757 case -3:
9758 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9759 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9761 break;
9762 case 4:
9763 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9764 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9766 break;
9767 case -4:
9768 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9769 return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9771 break;
9774 #endif
9775 return PyLong_AsSsize_t(b);
9777 x = PyNumber_Index(b);
9778 if (!x) return -1;
9779 ival = PyInt_AsSsize_t(x);
9780 Py_DECREF(x);
9781 return ival;
9783 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
9784 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
9786 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
9787 return PyInt_FromSize_t(ival);
9791 #endif /* Py_PYTHON_H */